summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2011-07-28 14:24:40 +0200
committerVolker Lendecke <vlendec@samba.org>2011-07-28 18:53:38 +0200
commit5812645f496e85d2178e7f0b9812c95ed651ded5 (patch)
tree3c6984f79a1deb99f12fccdefb676abc61254c78
parent83740555ea8664da0830f88a1dd5afa69880bb40 (diff)
downloadsamba-5812645f496e85d2178e7f0b9812c95ed651ded5.tar.gz
samba-5812645f496e85d2178e7f0b9812c95ed651ded5.tar.bz2
samba-5812645f496e85d2178e7f0b9812c95ed651ded5.zip
s3: Priorize the async echo responder over the client
Without this, an active client connection can starve the echo responder. This leads to apparently "lost" SMBs. Autobuild-User: Volker Lendecke <vlendec@samba.org> Autobuild-Date: Thu Jul 28 18:53:38 CEST 2011 on sn-devel-104
-rw-r--r--source3/smbd/process.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/source3/smbd/process.c b/source3/smbd/process.c
index 5e9392bddb..9df95a8d9d 100644
--- a/source3/smbd/process.c
+++ b/source3/smbd/process.c
@@ -2201,10 +2201,21 @@ static void smbd_server_connection_read_handler(
if (from_client) {
smbd_lock_socket(sconn);
- if (lp_async_smb_echo_handler() && !fd_is_readable(fd)) {
- DEBUG(10,("the echo listener was faster\n"));
- smbd_unlock_socket(sconn);
- return;
+ if (lp_async_smb_echo_handler()) {
+
+ if (fd_is_readable(sconn->smb1.echo_handler.trusted_fd)) {
+ /*
+ * This is the super-ugly hack to
+ * prefer the packets forwarded by the
+ * echo handler over the ones by the
+ * client directly
+ */
+ fd = sconn->smb1.echo_handler.trusted_fd;
+ } else if (!fd_is_readable(fd)) {
+ DEBUG(10,("the echo listener was faster\n"));
+ smbd_unlock_socket(sconn);
+ return;
+ }
}
/* TODO: make this completely nonblocking */