Bugzilla – Bug 227
tcp-large-transfer.cc does not work with smaller tcp sndbuf
Last modified: 2008-06-19 17:58:44 UTC
When adding something like localSocket->SetAttribute("SndBufSize", UintegerValue(8192)); to tcp-large-transfer.cc, it sends out a lot less data than its supposed to (~8k instead of ~2M). This is caused by several factors: 1. tcp-impl 'forgetting' to call NotifySend (see bugzilla bug #226) 2. tcp-large-transfer calling Close() from the OnConnect Callback 3. tcp-large-transfer assuming that the argument to its WriteUntilBufferFull function is the number of bytes to xmit (its the amout of new space is the tcp sndbuf when invoked as the NotifySend callback) To be honest i'm not entirely sure how the proper fix for this would look like. I'm attaching a diff that makes the example work correctly even with a small tcpsndbuf for consideration.
Created attachment 173 [details] Patch that allows tcp-large-transfer to send all data with smaller tcp sndbuf.
Created attachment 178 [details] Florian's fix + cleanup + example documentation Okay, so after carefully reviewing the patch and the issue, I notice that since bug 226 was closed out, the only code touched to support this case is the example itself, tcp-large-transfer. The provided patch causes no regression, while supporting the case of finite send buffers with this example program, if you uncomment the relevant line. In documenting this usage, I ended up cleaning up the entire file and adding lots of comments explaining what's going on. I also did some renaming of variables, and got rid of some dead code. I think its ready to merge.
Applied patch 2008-06-19 17:42