TODO: oplock break tcp ack...
authorStefan Metzmacher <metze@samba.org>
Thu, 18 Sep 2014 19:24:13 +0000 (21:24 +0200)
committerStefan Metzmacher <metze@samba.org>
Mon, 10 Feb 2020 14:17:27 +0000 (15:17 +0100)
source3/smbd/smb2_break.c
source3/smbd/smb2_server.c

index a2eac21e5441cdee2e724742006246df2c4f1c99..e92aea91f52c1e70afb5e0062b4214fba49594ef 100644 (file)
@@ -438,6 +438,12 @@ static NTSTATUS smbd_smb2_lease_break_recv(struct tevent_req *req,
  SMB2 OPLOCK_BREAK_NOTIFICATION.
 *********************************************************/
 
+struct send_break_message_smb2_state {
+       struct files_struct *fsp;
+       int level;
+       uint32_t tcp_seqnum;
+};
+
 void send_break_message_smb2(files_struct *fsp,
                             uint32_t break_from,
                             uint32_t break_to)
index 08cbb899ffac9dbb992f4d602f8d08679b0e1236..cd19cffa6f4842b4a0656eb659d61606ca266235 100644 (file)
@@ -3981,6 +3981,28 @@ static NTSTATUS smbd_smb2_flush_send_queue(struct smbXsrv_connection *xconn)
                        return NT_STATUS_OK;
                }
 
+               if (e->ack.req != NULL && e->ack.started) {
+                       struct tcp_info info;
+                       socklen_t ilen = sizeof(info);
+
+                       ret = getsockopt(xconn->transport.sock, IPPROTO_TCP,
+                                        TCP_INFO, (void *)&info, &ilen);
+                       if (ret != 0) {
+                               DEBUG(0,("%s:%s: errno[%d/%s]\n",
+                                     __location__, __func__,
+                                     errno, strerror(errno)));
+                               ZERO_STRUCT(info);
+                       } else {
+                               DEBUG(0,("%s:%s: unacked[%u] sacked[%u]\n",
+                                     __location__, __func__,
+                                     (unsigned)info.tcpi_unacked,
+                                     (unsigned)info.tcpi_sacked));
+                       }
+
+                       //e->ack.seqnum >=info.tcpi_sacked + iov_buflen(e->vector, e->count);
+                       tevent_wait_done(e->ack.req);
+               }
+
                xconn->smb2.send_queue_len--;
                DLIST_REMOVE(xconn->smb2.send_queue, e);