The branch, master has been updated
       via  aa70e44cd0576e5280e24cf35000369a47dd958f (commit)
      from  2722dd357cedcd3fad1e3739a4a64f924d53eccb (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit aa70e44cd0576e5280e24cf35000369a47dd958f
Author: Bo Yang <[email protected]>
Date:   Tue May 19 01:13:36 2009 +0800

    s3: tevent_req_poll() loops forever when pipe is broken
    
    Signed-off-by: Bo Yang <[email protected]>

-----------------------------------------------------------------------

Summary of changes:
 source3/libsmb/async_smb.c              |    8 ++++++++
 source3/rpc_client/rpc_transport_sock.c |   21 ++++++++++++++++++++-
 2 files changed, 28 insertions(+), 1 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/libsmb/async_smb.c b/source3/libsmb/async_smb.c
index 7afba0d..96b7054 100644
--- a/source3/libsmb/async_smb.c
+++ b/source3/libsmb/async_smb.c
@@ -742,6 +742,10 @@ static void cli_smb_sent(struct tevent_req *subreq)
        nwritten = writev_recv(subreq, &err);
        TALLOC_FREE(subreq);
        if (nwritten == -1) {
+               if (err == EPIPE) {
+                       close(state->cli->fd);
+                       state->cli->fd = -1;
+               }
                tevent_req_nterror(req, map_nt_error_from_unix(err));
                return;
        }
@@ -787,6 +791,10 @@ static void cli_smb_received(struct tevent_req *subreq)
        received = read_smb_recv(subreq, talloc_tos(), &inbuf, &err);
        TALLOC_FREE(subreq);
        if (received == -1) {
+               if (err == EPIPE) {
+                       close(cli->fd);
+                       cli->fd = -1;
+               }
                status = map_nt_error_from_unix(err);
                goto fail;
        }
diff --git a/source3/rpc_client/rpc_transport_sock.c 
b/source3/rpc_client/rpc_transport_sock.c
index 570d792..3756f73 100644
--- a/source3/rpc_client/rpc_transport_sock.c
+++ b/source3/rpc_client/rpc_transport_sock.c
@@ -36,6 +36,7 @@ static int rpc_transport_sock_state_destructor(struct 
rpc_transport_sock_state *
 }
 
 struct rpc_sock_read_state {
+       struct rpc_transport_sock_state *transp;
        ssize_t received;
 };
 
@@ -55,7 +56,11 @@ static struct tevent_req *rpc_sock_read_send(TALLOC_CTX 
*mem_ctx,
        if (req == NULL) {
                return NULL;
        }
-
+       if (sock_transp->fd == -1) {
+               tevent_req_nterror(req, NT_STATUS_CONNECTION_INVALID);
+               return tevent_req_post(req, ev);
+       }
+       state->transp = sock_transp;
        subreq = async_recv_send(state, ev, sock_transp->fd, data, size, 0);
        if (subreq == NULL) {
                goto fail;
@@ -77,6 +82,10 @@ static void rpc_sock_read_done(struct tevent_req *subreq)
 
        state->received = async_recv_recv(subreq, &err);
        if (state->received == -1) {
+               if (err == EPIPE) {
+                       close(state->transp->fd);
+                       state->transp->fd = -1;
+               }
                tevent_req_nterror(req, map_nt_error_from_unix(err));
                return;
        }
@@ -97,6 +106,7 @@ static NTSTATUS rpc_sock_read_recv(struct tevent_req *req, 
ssize_t *preceived)
 }
 
 struct rpc_sock_write_state {
+       struct rpc_transport_sock_state *transp;
        ssize_t sent;
 };
 
@@ -116,6 +126,11 @@ static struct tevent_req *rpc_sock_write_send(TALLOC_CTX 
*mem_ctx,
        if (req == NULL) {
                return NULL;
        }
+       if (sock_transp->fd == -1) {
+               tevent_req_nterror(req, NT_STATUS_CONNECTION_INVALID);
+               return tevent_req_post(req, ev);
+       }
+       state->transp = sock_transp;
        subreq = async_send_send(state, ev, sock_transp->fd, data, size, 0);
        if (subreq == NULL) {
                goto fail;
@@ -137,6 +152,10 @@ static void rpc_sock_write_done(struct tevent_req *subreq)
 
        state->sent = async_send_recv(subreq, &err);
        if (state->sent == -1) {
+               if (err == EPIPE) {
+                       close(state->transp->fd);
+                       state->transp->fd = -1;
+               }
                tevent_req_nterror(req, map_nt_error_from_unix(err));
                return;
        }


-- 
Samba Shared Repository

Reply via email to