r2624: - save some system calls by only trying read/write operations that select...
authorAndrew Tridgell <tridge@samba.org>
Sat, 25 Sep 2004 11:18:04 +0000 (11:18 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 17:59:13 +0000 (12:59 -0500)
- when a socket is dead, don't try to do anything more on it

source/libcli/raw/clitransport.c

index 2d29ba371f1169c010f0a64ce7670591d87a0cd1..85d5337da7abc297081793d22262167e0eaed059 100644 (file)
 
 #include "includes.h"
 
+
+static void smbcli_transport_process_recv(struct smbcli_transport *transport);
+static void smbcli_transport_process_send(struct smbcli_transport *transport);
+
 /*
   an event has happened on the socket
 */
@@ -29,7 +33,12 @@ static void smbcli_transport_event_handler(struct event_context *ev, struct fd_e
 {
        struct smbcli_transport *transport = fde->private;
 
-       smbcli_transport_process(transport);
+       if (flags & EVENT_FD_READ) {
+               smbcli_transport_process_recv(transport);
+       }
+       if (flags & EVENT_FD_WRITE) {
+               smbcli_transport_process_send(transport);
+       }
 }
 
 /*
@@ -265,6 +274,7 @@ static void smbcli_transport_process_send(struct smbcli_transport *transport)
                                return;
                        }
                        smbcli_transport_dead(transport);
+                       return;
                }
                req->out.buffer += ret;
                req->out.size -= ret;