patchlwIP - A Lightweight TCP/IP stack - Patches: patch #5959, Implement SO_RCVTIMEO for accept...

 
 

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

patch #5959: Implement SO_RCVTIMEO for accept and recv (on TCP netconn)

Submitter:  Frédéric Bernon <fbernon>
Submitted:  Wed 23 May 2007 10:32:20 AM UTC
   
 
Category:  None Priority:  3 - Low
Status:  Done Privacy:  Public
Assigned to:  fbernon Open/Closed:  Closed
Planned Release:  None

Thu 24 May 2007 03:20:44 PM UTC, comment #4: 

So, if I understand, like it's check in, it's good for you?

Ok, so, I close that... (reopen if I'm wrong...)

Frédéric Bernon <fbernon>
Group Member
Thu 24 May 2007 03:15:44 PM UTC, comment #3: 

Since you asked for a comment.... I don't think the code is made sufficiently more complex that this "simpler" is worth the test and set. It looks neater, but the version without the macro is still easy to understand and maintain. In fact, since someone would have to look up what macro does, I'm not sure it would save the complexity anyway.

Jonathan Larmour <jifl>
Group Member
Wed 23 May 2007 07:24:56 PM UTC, comment #2: 

Ok, I check in. Just a tips about the fact to call or not the conn->callback with NETCONN_EVT_RCVMINUS, I'm not 100% sure of the thing to do, but I have try to respect the current instruction flow, but tell me.

It is also possible to get a "simpler" code with #if/#else/#endif in the code, with a macro like this at the beginning of api_lib.c:

#if LWIP_SO_RCVTIMEO
#define CONN_RCVTIMEO(conn) (conn->recv_timeout)
#else
#define CONN_RCVTIMEO(conn) (0)
#endif /* LWIP_SO_RCVTIMEO*/

And further in the code always let the test like this:

if (sys_arch_mbox_fetch(conn->recvmbox, (void *)&p, CONN_RCVTIMEO(conn))==SYS_ARCH_TIMEOUT) {
  p = NULL;
}

It better to get a code more lisible, but add a test and a set.

Tell me if you prefer...


Frédéric Bernon <fbernon>
Group Member
Wed 23 May 2007 01:40:19 PM UTC, comment #1: 

Looks fine to me.

Jonathan Larmour <jifl>
Group Member
Wed 23 May 2007 10:32:20 AM UTC, original submission:  

It's a very simple patch I propose :

for netconn_accept, in api_lib.c :

#if LWIP_SO_RCVTIMEO
    if (sys_arch_mbox_fetch(conn->acceptmbox, (void *)&newconn, conn->recv_timeout)==SYS_ARCH_TIMEOUT) {
      newconn = NULL;
    }
#else
    sys_arch_mbox_fetch(conn->acceptmbox, (void *)&newconn, 0);
#endif /* LWIP_SO_RCVTIMEO*/

for netconn_recv, it the same thing.

No more code for users using LWIP_SO_RCVTIMEO=0, a little bit for users using LWIP_SO_RCVTIMEO=1 (+2 tests and +2 set).

For accept, it's very useful when you want to stop some services (some others stack allows to do a "close" on a socket currently use in a "accept", but don't try with lwIP ;) )


Frédéric Bernon <fbernon>
Group Member

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by jifl (Posted a comment)
  • -email is unavailable- added by fbernon (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

     

    Follow 2 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2007-05-24 fbernon StatusNone Done
        Open/ClosedOpen Closed

    Back to the top

    Powered by Savane 3.13-d3ae.
    Corresponding source code