summaryrefslogtreecommitdiff
path: root/source4/smbd/process_standard.c
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2005-10-12 11:04:01 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:39:43 -0500
commitf308cc1616b1eb504368fbd7a8aac76333869e3c (patch)
tree675cfe67bdae0bf0e18f71765199a7e9c2afa26c /source4/smbd/process_standard.c
parent2e61cce2b43570245825c3bdb9ee526fcbbceb6c (diff)
downloadsamba-f308cc1616b1eb504368fbd7a8aac76333869e3c.tar.gz
samba-f308cc1616b1eb504368fbd7a8aac76333869e3c.tar.bz2
samba-f308cc1616b1eb504368fbd7a8aac76333869e3c.zip
r10920: in case of a accept() failure just failing and trying again is no
good, as it is probably a resource constraint, so if we just try again we will spin (as the incoming socket will still be readable). Using a sleep(1) solves this by throtting smbd until the resource constraint goes away. if the resource constraint doesn't go away, then at least smbd won't be spinning chewing cpu (This used to be commit 7a5a9da477186b5e4fdb34ec64cc97915de4fd8e)
Diffstat (limited to 'source4/smbd/process_standard.c')
-rw-r--r--source4/smbd/process_standard.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/source4/smbd/process_standard.c b/source4/smbd/process_standard.c
index 014bd34afd..bbc0aa4c7e 100644
--- a/source4/smbd/process_standard.c
+++ b/source4/smbd/process_standard.c
@@ -56,6 +56,9 @@ static void standard_accept_connection(struct event_context *ev,
if (!NT_STATUS_IS_OK(status)) {
DEBUG(0,("standard_accept_connection: accept: %s\n",
nt_errstr(status)));
+ /* this looks strange, but is correct. We need to throttle things until
+ the system clears enough resources to handle this new socket */
+ sleep(1);
return;
}