cpprestsdk
cpprestsdk copied to clipboard
disable-socket-send-buffer option added
This PR adds an option to disable the underlying sockets send-buffer by setting SO_SNDBUF to zero.
During sending requests with larger bodies we encountered, especially on low bandwidth connections, that after the progress was set to 100% theire were still outgoing data to process. So visually, by following the progress, sending the data was done but technically the data was just pumped into the send-buffer of the socket and sits theire to wait for transmission. This leads to a significant gap on low bandwidth connections between signaling 100% progress and finishing the task. At 64 kbps and a one MB file this can be up to 90 seconds. The same applies for connections suffering on a large error rate resulting in many retransmissions. The data was buffered just fine quick but it took a significant long time for finally closing the task. On higher bandwidth or errorless connections the buffering take a minor part.
This way we decide to send the data unbuffered. So the write-handler will ever been called if the data was successfully send by the socket and not if the data was just putted into the buffer. Regardless the network bandwidth or error-rate the task was finished right after the last chunk of data was send.
Thats maybe a worthwhile addition for people transferring larger data chunks and want to rely on a accurate progress and task completion state.
Do you think this change could affect https://github.com/Microsoft/cpprestsdk/issues/467 as well?