diff options
author | Stefan Metzmacher <metze@samba.org> | 2010-03-05 16:03:23 +0100 |
---|---|---|
committer | Stefan Metzmacher <metze@samba.org> | 2010-03-07 16:52:38 +0100 |
commit | 8c16d5e4dc9312475c7d5dcc07022dbf316500cf (patch) | |
tree | 751c7c780d9f530b55ccba4d89a3d8b7f59235d5 | |
parent | f1e28a0b410169d3bfc0a069bf5de50c6cc8a27c (diff) | |
download | samba-8c16d5e4dc9312475c7d5dcc07022dbf316500cf.tar.gz samba-8c16d5e4dc9312475c7d5dcc07022dbf316500cf.tar.bz2 samba-8c16d5e4dc9312475c7d5dcc07022dbf316500cf.zip |
s4:libcli/wrepl: add wrepl_socket_is_connected()
metze
-rw-r--r-- | source4/libcli/wrepl/winsrepl.c | 17 | ||||
-rw-r--r-- | source4/wrepl_server/wrepl_out_helpers.c | 2 |
2 files changed, 18 insertions, 1 deletions
diff --git a/source4/libcli/wrepl/winsrepl.c b/source4/libcli/wrepl/winsrepl.c index 661a8613fe..5a5719f2c1 100644 --- a/source4/libcli/wrepl/winsrepl.c +++ b/source4/libcli/wrepl/winsrepl.c @@ -101,6 +101,23 @@ static void wrepl_socket_dead(struct wrepl_socket *wrepl_socket, NTSTATUS status } } +bool wrepl_socket_is_connected(struct wrepl_socket *wrepl_sock) +{ + if (!wrepl_sock) { + return false; + } + + if (wrepl_sock->dead) { + return false; + } + + if (!wrepl_sock->sock) { + return false; + } + + return true; +} + static void wrepl_request_timeout_handler(struct tevent_context *ev, struct tevent_timer *te, struct timeval t, void *ptr) { diff --git a/source4/wrepl_server/wrepl_out_helpers.c b/source4/wrepl_server/wrepl_out_helpers.c index 19cabd1e12..1bd996d8c2 100644 --- a/source4/wrepl_server/wrepl_out_helpers.c +++ b/source4/wrepl_server/wrepl_out_helpers.c @@ -166,7 +166,7 @@ static struct composite_context *wreplsrv_out_connect_send(struct wreplsrv_partn /* we have a connection already, so use it */ if (wreplconn) { - if (!wreplconn->sock->dead) { + if (wrepl_socket_is_connected(wreplconn->sock)) { state->stage = WREPLSRV_OUT_CONNECT_STAGE_DONE; state->wreplconn= wreplconn; composite_done(c); |