On Fri, 04 Sep 2009 15:16:53 +0200, Detlev Casanova <detlev.casan...@gmail.com> wrote:
Hi, > Hi Roman, > >> there has been a lot of complains that protocols don't disconnect >> themselves >> when somehow connection is lost (or disconnect after long time). >> >> So after lot of googling I found linux only way how we can fix this. >> There is TCP_INFO struct which contains info when last ACK was received >> and when last data were sent and from this we can check if server still >> gets packets from us. > > I don't really understand how the line > > if ( info.tcpi_last_ack_recv >= info.tcpi_last_data_sent && > (info.tcpi_last_ack_recv - info.tcpi_last_data_sent) > mTimeoutThreshold > ) > > works (sockettimoutwatcher.cpp:94). > > > If the last ack received time it greater the the last data sent time, > that > means that the sent data has been acked, right ? So, why check the time > difference btween those 2 and not the time difference between the last > sent data > time and the current time if the ack has not been received yet ? The tcpi_last_ack_recv, tcpi_last_data_sent don't hold time (timestamp) but elapsed time interval so if tcpi_last_ack_recv > tcpi_last_data_sent then this means that we didn't receive ack for sent data. And if the elapse time difference (info.tcpi_last_ack_recv - info.tcpi_last_data_sent) is greater than mTimeoutThreshold we close the connection. >> This is all the code that needs to be add when we want to watch for >> timeouts on some tcp based socket >> >> new SocketTimeoutWatcher(some_tcp_based_socket, timeout); >> >> I would like to put in into libkopete and add SocketTimeoutWatcher >> to most protocols. I'll also add Q_WS_X11 to SocketTimeoutWatcher >> so it doesn't break Win or Mac > > Detlev. Roman _______________________________________________ kopete-devel mailing list kopete-devel@kde.org https://mail.kde.org/mailman/listinfo/kopete-devel