summaryrefslogtreecommitdiff
path: root/source3/smbd
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2006-04-14 03:55:42 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 11:16:22 -0500
commitcc203f3e59840b75fbb42a53d36b717a57268c2f (patch)
tree84756b715fb89cd96d83951f348e47c085a7013e /source3/smbd
parent713eaf1d67d9ef967fb4526113e2a3ba3dd5e229 (diff)
downloadsamba-cc203f3e59840b75fbb42a53d36b717a57268c2f.tar.gz
samba-cc203f3e59840b75fbb42a53d36b717a57268c2f.tar.bz2
samba-cc203f3e59840b75fbb42a53d36b717a57268c2f.zip
r15084: Try and squeeze more out of the non-read/write code path.
Jeremy. (This used to be commit 23dcff4d50d1d35b7ddee0d0cb79c16a312f179c)
Diffstat (limited to 'source3/smbd')
-rw-r--r--source3/smbd/process.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/source3/smbd/process.c b/source3/smbd/process.c
index c0a43e99dd..ba14e57c54 100644
--- a/source3/smbd/process.c
+++ b/source3/smbd/process.c
@@ -357,7 +357,7 @@ static BOOL receive_message_or_smb(char *buffer, int buffer_len, int timeout)
{
fd_set fds;
int selrtn;
- struct timeval to = timeval_set(SMBD_SELECT_TIMEOUT, 0);
+ struct timeval to;
int maxfd = 0;
smb_read_error = 0;
@@ -367,6 +367,9 @@ static BOOL receive_message_or_smb(char *buffer, int buffer_len, int timeout)
if (timeout >= 0) {
to.tv_sec = timeout / 1000;
to.tv_usec = (timeout % 1000) * 1000;
+ } else {
+ to.tv_sec = SMBD_SELECT_TIMEOUT;
+ to.tv_usec = 0;
}
/*
@@ -441,14 +444,20 @@ static BOOL receive_message_or_smb(char *buffer, int buffer_len, int timeout)
goto again;
}
+ /*
+ * Are there any timed events waiting ? If so, ensure we don't
+ * select for longer than it would take to wait for them.
+ */
+
{
struct timeval tmp;
- struct timeval *tp = get_timed_events_timeout(&tmp,SMBD_SELECT_TIMEOUT);
+ struct timeval *tp = get_timed_events_timeout(&tmp);
if (tp) {
to = timeval_min(&to, tp);
if (timeval_is_zero(&to)) {
- return True;
+ /* Process a timed event now... */
+ run_events();
}
}
}