SQ: moving SIOCOUTQ printout ...
authorGünther Deschner <gd@samba.org>
Mon, 5 Sep 2016 17:00:46 +0000 (19:00 +0200)
committerGünther Deschner <gd@samba.org>
Mon, 19 Sep 2016 20:20:49 +0000 (22:20 +0200)
source3/smbd/smb2_server.c

index 36e30b243d5b030c2c1226b4972ffc7f62024c38..e92cbf6293e65bf2937005b3ad6c17a1eb96b943 100644 (file)
@@ -3781,12 +3781,6 @@ static NTSTATUS smbd_smb2_flush_send_queue(struct smbXsrv_connection *xconn)
                        return NT_STATUS_INTERNAL_ERROR;
                }
 
-               if (e->count > 0) {
-                       /* we have more to write */
-                       TEVENT_FD_WRITEABLE(xconn->transport.fde);
-                       return NT_STATUS_OK;
-               }
-
                if (e->ack.req != NULL && e->ack.started) {
                        int _ret;
                        _ret = ioctl(xconn->transport.sock, SIOCOUTQ, &value2);
@@ -3797,16 +3791,24 @@ static NTSTATUS smbd_smb2_flush_send_queue(struct smbXsrv_connection *xconn)
                        }
                }
 
+               if (e->count > 0) {
+                       /* we have more to write */
+                       TEVENT_FD_WRITEABLE(xconn->transport.fde);
+                       return NT_STATUS_OK;
+               }
+
                if (e->ack.req != NULL && e->ack.started) {
                        tevent_wait_done(e->ack.req);
                }
 
                xconn->smb2.send_queue_len--;
                DLIST_REMOVE(xconn->smb2.send_queue, e);
+
                if (e->ack.req != NULL && e->ack.started) {
                        DLIST_ADD_END(xconn->smb2.ack_queue, e);
                        continue;
                }
+
                talloc_free(e->mem_ctx);
        }