[En-Nut-Discussion] TCP sockets stuck in closing state
Stefan Hax
stefan at escherlogic.com
Tue May 5 17:39:47 CEST 2015
Just checking...
the fix makes use of: sock->so_write_to
so you do need to do something like:
uint32_t gto = TIMEOUT_VALUE;
NutTcpSetSockOpt(sock, SO_SNDTIMEO, >o, sizeof(gto));
to ensure it's not 0 (wait forever)
Stefan.
On 2015-05-05 11:25 AM, Coleman Brumley wrote:
> Stefan,
>
> Thank you. That didn't correct it though.
>
> I notice that when this scenario occurs, it's always the last socket in the
> list that gets in this state. I'm wondering if that means something. Perhaps
> the last socket is not updated when it gets the ACK?
>
> Coleman
>
>> -----Original Message-----
>> From: en-nut-discussion-bounces at egnite.de [mailto:en-nut-discussion-
>> bounces at egnite.de] On Behalf Of Stefan Hax
>> Sent: Tuesday, May 05, 2015 9:59 AM
>> To: Ethernut User Chat (English)
>> Subject: Re: [En-Nut-Discussion] TCP sockets stuck in closing state
>>
>> Hi,
>>
>> This is what I did to fix this issue in 'tcpsm.c':
>>
>> int NutTcpStateActiveOpenEvent(TCPSOCKET * sock) {
>> /*
>> * Switch state to SYN_SENT. This will
>> * transmit a SYN packet.
>> */
>> NutTcpStateChange(sock, TCPS_SYN_SENT);
>>
>> /*
>> * Block application.
>> */
>> if(sock->so_state == TCPS_SYN_SENT) {
>> //NutEventWait(&sock->so_ac_tq, 0);
>> if( NutEventWait(&sock->so_ac_tq, sock->so_write_to) ) {
>> // added the write T.O. to the blocking ... so we are not stuck here
> forever!!
>> return -1;
>> }
>> }
>>
>>
>> if (sock->so_state != TCPS_ESTABLISHED && sock->so_state !=
>> TCPS_CLOSE_WAIT)
>> return -1;
>>
>> return 0;
>> }
>>
>> Hope this helps,
>>
>> Stefan Hax.
>>
>>
>>
>> On 2015-05-05 9:40 AM, Uwe Bonnes wrote:
>>>>>>>> "Coleman" == Coleman Brumley <cbrumley at polarsoft.biz> writes:
>>> Coleman> Sorry, that should have said "is there no timeout for the
> ACK
>>> Coleman> in the CLOSING state".
>>>
>>> Hello,
>>>
>>> I can feel your pain, but I am no TCP expert. Hopefully somebody
>>> knowledgeable will drop into this discussion...
>>>
>>> Bye
>> _______________________________________________
>> http://lists.egnite.de/mailman/listinfo/en-nut-discussion
> _______________________________________________
> http://lists.egnite.de/mailman/listinfo/en-nut-discussion
More information about the En-Nut-Discussion
mailing list