Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Arne Øslebø
mapi
Commits
add33d00
Commit
add33d00
authored
Jul 20, 2008
by
Browse files
important bug fix for mapi_get_next_pkt
git-svn-id:
file:///home/svn/mapi/trunk@1423
8d5bb341-7cf1-0310-8cf6-ba355fef3186
parent
81332213
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/common/mapiipc.c
View file @
add33d00
...
@@ -1874,6 +1874,7 @@ int check_network_mapid(void){
...
@@ -1874,6 +1874,7 @@ int check_network_mapid(void){
if
(
connect
(
sockfd
,
(
struct
sockaddr
*
)
&
mapidaddr_
,
mapidaddr_len_
)
<
0
){
// mapid is down
if
(
connect
(
sockfd
,
(
struct
sockaddr
*
)
&
mapidaddr_
,
mapidaddr_len_
)
<
0
){
// mapid is down
free
(
mapidsocket_
);
free
(
mapidsocket_
);
close
(
sockfd
);
return
0
;
return
0
;
}
}
...
...
src/common/mapiipc.h
View file @
add33d00
...
@@ -156,6 +156,9 @@ int mapiipc_read_fd();
...
@@ -156,6 +156,9 @@ int mapiipc_read_fd();
void
mapiipc_client_close
(
void
);
void
mapiipc_client_close
(
void
);
void
mapiipc_daemon_close
(
void
);
void
mapiipc_daemon_close
(
void
);
#define PKT_LENGTH 131072 // pkt info and actual pkt
// large enough for cooking (stream re-assembled packets)
#ifdef DIMAPI
#ifdef DIMAPI
//holds info about a remote mapid
//holds info about a remote mapid
struct
host
{
struct
host
{
...
@@ -190,7 +193,6 @@ struct dmapiipcbuf {
...
@@ -190,7 +193,6 @@ struct dmapiipcbuf {
};
};
#define BASIC_SIZE (sizeof(struct dmapiipcbuf) - DIMAPI_DATA_SIZE)
#define BASIC_SIZE (sizeof(struct dmapiipcbuf) - DIMAPI_DATA_SIZE)
#define PKT_LENGTH 131072 // pkt info and actual pkt
typedef
struct
host_flow
{
typedef
struct
host_flow
{
struct
host
*
rhost
;
struct
host
*
rhost
;
...
...
src/lib/mapi.c
View file @
add33d00
...
@@ -145,6 +145,7 @@ typedef struct functdescr {
...
@@ -145,6 +145,7 @@ typedef struct functdescr {
mapidflib_function_t
*
funct
;
mapidflib_function_t
*
funct
;
void
*
data
;
void
*
data
;
mapi_results_t
*
result
;
mapi_results_t
*
result
;
struct
mapipkt
*
pkt
;
#ifdef RECONNECT
#ifdef RECONNECT
flowdescr_t
*
flow
;
flowdescr_t
*
flow
;
int
numfd
;
int
numfd
;
...
@@ -1347,6 +1348,7 @@ int mapi_close_flow(int fd)
...
@@ -1347,6 +1348,7 @@ int mapi_close_flow(int fd)
free
(
f
->
funct
->
instance
);
free
(
f
->
funct
->
instance
);
free
(
f
->
funct
);
free
(
f
->
funct
);
free
(
f
->
data
);
free
(
f
->
data
);
if
(
f
->
pkt
!=
NULL
)
free
(
f
->
pkt
);
free
(
f
);
free
(
f
);
f
=
NULL
;
f
=
NULL
;
}
}
...
@@ -1964,7 +1966,9 @@ int mapi_apply_function(int fd, const char* funct, ...)
...
@@ -1964,7 +1966,9 @@ int mapi_apply_function(int fd, const char* funct, ...)
f
->
result_init
=
0
;
f
->
result_init
=
0
;
f
->
data
=
NULL
;
f
->
data
=
NULL
;
f
->
result
=
NULL
;
f
->
result
=
NULL
;
if
(
strncmp
(
funct
,
"TO_BUFFER"
,
9
)
==
0
)
f
->
pkt
=
malloc
(
sizeof
(
struct
mapipkt
)
+
PKT_LENGTH
);
else
f
->
pkt
=
NULL
;
f
->
funct
=
malloc
(
sizeof
(
mapidflib_function_t
));
f
->
funct
=
malloc
(
sizeof
(
mapidflib_function_t
));
#ifdef RECONNECT // FIXME
#ifdef RECONNECT // FIXME
f
->
funct
->
fd
=
flow
->
fd
;
f
->
funct
->
fd
=
flow
->
fd
;
...
@@ -2470,7 +2474,9 @@ mapi_get_next_pkt(int fd,int fid)
...
@@ -2470,7 +2474,9 @@ mapi_get_next_pkt(int fd,int fid)
return
NULL
;
return
NULL
;
}
}
return
res
.
res
;
memcpy
(
f
->
pkt
,
res
.
res
,
res
.
size
);
return
f
->
pkt
;
}
}
// Get the next packet from a to_buffer function, using asynchronous mechanism - PUSH MODEL (only for DiMAPI)
// Get the next packet from a to_buffer function, using asynchronous mechanism - PUSH MODEL (only for DiMAPI)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment