Hello curl team, Here is my situation. I use curl_easy interface for uploading data from the GSM/CDMA modem (ARM, Linux) to the HTTPS server. I implemented a retry logic based on a set of timeouts: CURLOPT_TIMEOUT, CURLOPT_CONNECTTIMEOUT. In addition I have implemented an inactivity timer which goes off if number of uploaded bytes not is not changing during configured time (I used curl_progress_callback).
Now the problem. Once my inactivity timer goes off I return non-zero value from curl_progress_callback and curl_easy_perform returns CURLE_ABORTED_BY_CALLBACK code. In this case libcurl closes the connection, by, I assume, calling close(sock). Close() call returns immediately and my retry logic algorithm proceed with additional attempts. If there is an unsent data in the TCP socket buffer then, as I understand, TCP FIN segments will not be sent immediately. Taking into account that TCP uses 1,2,4,8,... retransmission intervals then it is possible that the connection quality is acceptable already but the data is still not being sent for, say 16 or more seconds. It means that the connection will remain open on the server for quite a long time even though there is no need in it. So, I think I could take advantage of SO_LINGER socket option since it seems may be used to force TCP/IP stack to sent the connection reset state to the server immediately. It least this can lower the number of stale connections on the server. The questions are: 1) Does my reasoning makes sense? 2) How can I set SO_LINGER option to the socket? 3) Is it possible to set SO_LINGER option just before closing the connection? Not sure if it is safe to use the options form all communications I have, BTW, I use curl-7.20.0 + openssl-0.9.8.l Thanks, Nikita
------------------------------------------------------------------- List admin: http://cool.haxx.se/list/listinfo/curl-library Etiquette: http://curl.haxx.se/mail/etiquette.html
