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
or nothing).
Simon
Fabian Koch wrote:
address@hidden
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
share
> the work as a patch entry on savannah.
Hey Simon,
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),
correct?
It would be great to document that at the
appropriate
places (release notes and Wiki) so that people don't trip over the
missing
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
disabled
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
current
timestamp via sys_now() and compare it to
msg->conn->write_timestamp
3) if the difference is greater than
conn->pcb.tcp->snd_timeo
then clear write_msg,_offset and state and signal op_complete (with
ERR_*
set)
4) have a reasonable default value for
conn->pcb.tcp->snd_timeo
in the area of 10-30 sec.?
[5) add the parsing of SOCKET_SO_SNDTIMEO to the
socket
API. I might not do that because I don't use that API]
Would that be okay with you guys and are there
plans
to release another 1.3.x Version before 1.4.0?
As I said before, we treat LwIP as an external
Blob
of Software that we don't change, so I'd need my own Patch included in
an official Version "soon".
kind regards,
Fabian
_______________________________________________
lwip-users mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/lwip-users
|