[IRCServices] Patch: Flush write buffer on connect

Alexander Barton alex at barton.de
Thu Nov 20 13:45:22 PST 2008


Hi all!

Any comments to this patch?

Regards
Alex

Am 11.11.2008 18:14, Alexander Barton schrieb:

> Hi!
> 
> The attached patch fixes the problem that IRCServices don't flush the  
> write buffer when the connection to the server is establised and data  
> has already been written to the buffer.
> 
> This caused the server to disconnect IRCServices after a timeout  
> because of no data has been sent. Solution has been to send  
> IRCServices a HUP signal right after starting it. I was able to  
> reproduce this problem on all of my machines (Linux on HPPA, Linux on  
> amd64, and Mac OS X on i386).
> 
> I think these messages describe the same problem:
> <http://lists.ircservices.za.net/pipermail/ircservices/2007/005283.html>
> <http://lists.ircservices.za.net/pipermail/ircservices/2007/005288.html>
> <http://lists.ircservices.za.net/pipermail/ircservices/2007/005318.html>
> <http://lists.ircservices.za.net/pipermail/ircservices/2007/005319.html>
> <http://lists.ircservices.za.net/pipermail/ircservices/2007/005287.html>
> 
> Regards
> Alex
> 
> 
> diff -rup ircservices-5.1.13-orig/sockets.c ircservices-5.1.13/sockets.c
> --- ircservices-5.1.13-orig/sockets.c	2008-11-07 18:11:57.000000000  
> +0100
> +++ ircservices-5.1.13/sockets.c	2008-11-09 15:53:35.000000000 +0100
> @@ -691,6 +691,10 @@ void check_sockets(void)
>                  }
>                  s->flags &= ~SF_CONNECTING;
>                  s->flags |= SF_CONNECTED;
> +
> +		/* Flush already cached data for this socket */
> +		flush_write_buffer(s);
> +
>                  FD_CLR(i, &write_fds);
>                  if (!(s->flags & SF_MUTE))
>                      FD_SET(i, &sock_fds);
>