Hi Ilya,

thanks for the report.  It seems that the SO_LINGER is not necessary
there.  I put this into the tracker:

  
http://sourceforge.net/tracker/index.php?func=detail&aid=1851137&group_id=50884&atid=461322

You can see updates there.

Thank you,
 Niels.

On Dec 14, 2007 3:40 AM, Ilya Martynov <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I wonder if anybody could elaborate what is the reason for setting
> SO_LINGER option for sockets created by evhttp. I mean this part of code
> inside of http.c:
>
> static int
> bind_socket_ai(struct addrinfo *ai)
> {
>          ...
>          linger.l_onoff = 1;
>          linger.l_linger = 5;
>          setsockopt(fd, SOL_SOCKET, SO_LINGER, (void *)&linger,
> sizeof(linger));
>          ...
> }
>
> If I'm reading the documentation correctly at least for Linux this
> makes close() on the socket to block what probably not a very good thing
> in programs based on libevent. From
> http://linux.about.com/od/commands/l/blcmdl7_socket.htm:
>
> SO_LINGER
>      Sets or gets the SO_LINGER option. ... When enabled, a close(2) or
> shutdown(2) will not return until all queued messages for the socket
> have been successfully sent or the linger timeout has been reached.
> Otherwise, the call returns immediately and the closing is done in the
> background.
>
> --
> Ilya Martynov,  [EMAIL PROTECTED]
> CTO IPonWEB (UK) Ltd
> _______________________________________________
> Libevent-users mailing list
> Libevent-users@monkey.org
> http://monkeymail.org/mailman/listinfo/libevent-users
>
>
_______________________________________________
Libevent-users mailing list
Libevent-users@monkey.org
http://monkeymail.org/mailman/listinfo/libevent-users

Reply via email to