OSSP CVS Repository |
|
I've found a problem in the code managing the SO_LINGER option. In some circumstances you got a TIME_WAIT socket. In fact I've investigated the code and found that you only deal with two of the three possibilities of lingering option. (see 'Network Programming" by Stevens, page 187, case 2).I've resolved this modifying the way 0 case is handled, but I must admit it would be better to use negative values for it, keeping 0 value for disabling, and positives for enabling lingering on close.
The code I've used is on line 991 of sa.c :
// [ABA, 11/06/2004 : null mean onoff nonzero, linger zero]
linger.l_onoff = (sa->optInfo[i].value == 0 ? 1 : 1);
linger.l_linger = sa->optInfo[i].value == 0 ? 0 : sa->optInfo[i].
// [END ABA, 11/06/2004 : null mean onoff nonzero, linger zero]
But I think the following would be better :
// [ABA, 11/06/2004 : negative mean onoff nonzero, linger zero]
linger.l_onoff = (sa->optInfo[i].value == 0 ? 0 : 1);
linger.l_linger = sa->optInfo[i].value <= 0 ? 0 : sa->optInfo[i].
// [END ABA, 11/06/2004 : negative mean onoff nonzero, linger zero]
if you modify also line 1344 this way :
// [ABA, 14/06/2004 : negatives values are OK now]
int amount = (int)va_arg(ap, int);
// [END ABA, 14/06/2004 : negatives values are OK now]
Best regards,
Alexandre Balaban.
|
Type: code Version: 1.2.0 Status: fixed Created: 2004-Jun-14 10:32 Severity: 2 Last Change: 2004-Jun-26 13:16 Priority: 3 Subsystem: sa Assigned To: rse Derived From: Creator: anonymous
2004-Jun-26 13:16 | • | Check-in [4605]: Allow negative values for SA_OPTION_LINGER to cover the special case of l_onoff=1/l_linger=0 where a TCP RST based connection termination is performed on close(2). Submitted by: Alexandre Balaban <abalaban@free.fr> (By rse) |