buglwIP - A Lightweight TCP/IP stack - Bugs: bug #38121, error in connect() with O_NONBLOCK

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #38121: error in connect() with O_NONBLOCK

Submitted by:  hanhui <hanhui03>
Submitted on:  Sun 20 Jan 2013 06:12:00 AM UTC  
 
Category: sockets/netconnSeverity: 3 - Normal
Item Group: Faulty BehaviourStatus: Fixed
Privacy: PublicAssigned to: Simon Goldschmidt <goldsimon>
Open/Closed: ClosedPlanned Release: None
lwIP version: CVS Head

Thu 19 Mar 2015 08:21:48 PM UTC, comment #2:

Fixed with bug #37676, thanks for reporting.

Simon Goldschmidt <goldsimon>
Project AdministratorIn charge of this item.
Tue 09 Dec 2014 08:29:11 PM UTC, comment #1:

Looking at this, there might be more problems like this one. A clean solution would be to set conn->err when the error arises (i.e. in the api_msg.c functions, not in the api_lib.c functions - but that would include tcpip_apimsg() in tcpip.c, too).

Simon Goldschmidt <goldsimon>
Project AdministratorIn charge of this item.
Sun 20 Jan 2013 06:12:00 AM UTC, original submission:

The socket is non-blocking and the connection can not be completed immediately. It is possible to select() for completion by selecting the socket for writing. After select indicates writability, use getsockopt() to read the SO_ERROR option at level SOL_SOCKET to determine whether connect completed successfully (SO_ERROR is zero) or unsuccessfully (SO_ERROR is not zero).

Lwip in normal conditions does the same way, but if the server responds very quickly, for example, the server is 127.0.0.1, in this case, Lwip will get errors.

Because netconn_connect() call lwip_netconn_do_connect() in tcpip thread, then lwip_netconn_do_connect() will set [msg->err = ERR_INPROGRESS;], so netconn_connect() will use NETCONN_SET_SAFE_ERR() set netconn error, and return is to user. If server responds very quickly, and completed the connection operation between call lwip_netconn_do_connect() and NETCONN_SET_SAFE_ERR() in netconn_connect() function, use getsockopt() to read the SO_ERROR will get ERR_INPROGRESS value not zero in a already connected socket.

hanhui <hanhui03>

 

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by goldsimon (Posted a comment)
  • -unavailable- added by hanhui03 (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 3 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Thu 19 Mar 2015 08:21:48 PM UTCgoldsimonStatusNone=>Fixed
      Assigned toNone=>goldsimon
      Open/ClosedOpen=>Closed

    Back to the top


    Powered by Savane 3.1-cleanup1