Just one more thing about the send timeout - I've written it in bug
#28605, too: What do you want to do on a timeout? With the suggested
implementation below, you don't know how much data has already been
sent when send() returns with an error... And there's not a simple
solution for that aside from only allowing single-write in send-timeout
mode (i.e. in do_writemore, skip the if (available < len) - send all
Fabian Koch wrote:
on 13.01.2010 17:41:54:
> A more sophisticated way to implement this (which might even have
> the potential to be included in CVS?) would be to have a timstamp
> when write was started and let poll_tcp() or do_writemore() check
> whether the operation timed out (using sys_now() to get the
> timestamp and compare it). If you do that, it would be nice to
> the work as a patch entry on savannah.
sys_now() is only used when LWIP_TCP_TIMESTAMPS is
1 and it's implementation is up to the user (probably in sys_arch.c),
It would be great to document that at the
places (release notes and Wiki) so that people don't trip over the
function, when I use that as a timestamp provider. (Maybe I just missed
it, but in "porting for an OS" it's not documented)
Also, I would make the feature optional and
in the standard version (just like the UDP Infos).
And maybe create the sockopt for it.
So in short:
1) create a timestamp in do_write() via sys_now()
and save it in msg->conn->write_timestamp
2) at the beginning of do_writemore() get a
timestamp via sys_now() and compare it to
3) if the difference is greater than
then clear write_msg,_offset and state and signal op_complete (with
4) have a reasonable default value for
in the area of 10-30 sec.?
[5) add the parsing of SOCKET_SO_SNDTIMEO to the
API. I might not do that because I don't use that API]
Would that be okay with you guys and are there
to release another 1.3.x Version before 1.4.0?
As I said before, we treat LwIP as an external
of Software that we don't change, so I'd need my own Patch included in
an official Version "soon".
lwip-users mailing list