[stunnel-users] Re: stunnel 4.09 problem: Connection rejected: too many clients
Steven Van Acker
deepstar at ulyssis.org
Fri Apr 1 12:36:00 CEST 2005
On Thu, Mar 31, 2005 at 02:18:07PM +0200, Steven Van Acker wrote:
> then 1 minute later, this follows:
>
> 2005.03.31 14:06:06 LOG6[4553:0]: s_poll_wait timeout: connection close
> 2005.03.31 14:06:06 LOG5[4553:0]: Connection closed: 26 bytes sent to SSL, 0 bytes sent to socket
> 2005.03.31 14:06:06 LOG7[4553:0]: removing pid file /stunnel.pid
> 2005.03.31 14:06:06 LOG7[4552:0]: Steven: going into client_status with num_clients = 1
> 2005.03.31 14:06:06 LOG7[4552:0]: Process 4553 finished with code 0 (0 left)
>
Hi,
I've traced the problem with strace, and found that in transfer() in client.c, the code does an unintended sleep(60).
This happens because no filedescriptors are added to fds, causing poll
to be called like poll(0xwhatever,0,60*1000), which is the same as
sleep(60);
The attached patch fixes the problem. I'm unsure whether the fix can be
applied to s_poll_wait(). Are there any calls to s_poll_wait() that are
intended to be sleep() calls ?
At first glance, the patch also seems to fix the second problem I had.
greets,
-- Steven
-------------- next part --------------
--- stunnel-4.09/src/client.c Fri Mar 11 19:37:27 2005
+++ stunnel-4.09-fixed/src/client.c Fri Apr 1 12:16:13 2005
@@ -394,10 +394,18 @@
s_poll_add(&fds, c->ssl_wfd->fd, 0, 1);
/****************************** wait for an event */
+ if(fds.nfds)
+ {
err=s_poll_wait(&fds, (sock_rd && ssl_rd) /* both peers open */ ||
c->ssl_ptr /* data buffered to write to socket */ ||
c->sock_ptr /* data buffered to write to SSL */ ?
c->opt->timeout_idle : c->opt->timeout_close);
+ }
+ else
+ {
+ err = 0;
+ }
+
switch(err) {
case -1:
sockerror("s_poll_wait");
More information about the stunnel-users
mailing list