Commit Graph

3624 Commits

Author SHA1 Message Date
Jordan Lee 0c6c569b69 (trunk libT) minor cleanup: improve the function names torrentConstructor() and torrentDestructor().
These functions actually allocate/free the memory where these objects reside, so it's clearer to name them torrentNew() and torrentDelete().
2011-02-23 06:18:09 +00:00
Jordan Lee bf8e4594e0 (trunk libT) minor cleanup: improve the function names peerConstructor() and peerDestructor().
These functions actually allocate/free the memory where these peer objects reside, so it's clearer to name them peerNew() and peerDelete().
2011-02-23 06:14:06 +00:00
Jordan Lee f2b4a59eda (trunk libT) #4051 "Use composition for the tr_history fields in tr_peer" -- fixed.
If we use composition on these objects we can save a handful of pointers per peer. This isn't a big deal, but it's an easy/safe change to do.
2011-02-23 06:01:16 +00:00
Jordan Lee 2b9db3c242 (trunk libT) #4048 "use bitsets instead of bitfield in tr_completion" -- done.
Excuse the sprawl. Much of this didn't fit into self-contained commits.
2011-02-23 03:54:04 +00:00
Jordan Lee 094b726316 (trunk libT) remove unused code: tr_bitfieldIsEmpty() 2011-02-21 15:43:41 +00:00
Jordan Lee 32237dbdb0 (trunk libT) remove unused functions: tr_bitsetDifference() tr_bitfieldDifference() 2011-02-21 15:36:07 +00:00
Jordan Lee 6ab918a202 (trunk libT) code cleanup: moving bitset functions to their own .c file. 2011-02-21 01:40:19 +00:00
Jordan Lee 25ad6bbad2 (trunk libT) remove dead code in peer-common.h: the tr_addreq_t enum 2011-02-21 01:15:13 +00:00
Jordan Lee 1ccdb1a797 (trunk libT) web.c: free the unprocessed tasks before exiting the libcurl thread.
This is rare but can happen during shutdown if there are unresponsive trackers. Cleaning up the tasks improves the S/N ratio in valgrind a bit.
2011-02-21 01:13:28 +00:00
Jordan Lee e77a627d3c (trunk libT) mark the two "progress" args to tr_torrentSetLocation() as volatile. 2011-02-19 20:10:05 +00:00
Jordan Lee 05ff024dd8 (trunk libT) #3372 "What happened with closing idle peers?" -- fixed. 2011-02-19 12:32:41 +00:00
Jordan Lee 7a8ab0ddbe (trunk libT) closeBadPeers() part 2 of 2: this function was serving two purposes, which wasn't clear from its name. refactor slightly to make the purpose and name match. 2011-02-19 12:30:18 +00:00
Jordan Lee 1592953439 (trunk libT) closeBadPeers() part 1 of 2: don't bother sorting these peers by activity -- we're closing -all- of them, so sorting them is pointless. 2011-02-19 12:24:00 +00:00
Juliusz Chroboczek 352981ee03 Remove obsolete UNUSED marker. 2011-02-18 21:55:42 +00:00
Jordan Lee e2584b04ff (trunk libT) #4047 "timeChecked for the last piece is not saved to a resume file" -- fixed.
A garden variety off-by-one error. good patch by jusid and revision by me.
2011-02-18 19:31:18 +00:00
Juliusz Chroboczek e7fc697c90 Stub out UTP_Create in non-uTP builds. 2011-02-18 16:01:52 +00:00
Jordan Lee 80d06d4c34 (trunk libT) add a bool to tr_peer_stat and the RPC peer list to denote whether or not a peer's connected via µTP 2011-02-18 04:07:43 +00:00
Jordan Lee b930026c40 (trunk libT) explicitly use the libevent2 header files, instead of the deprecated backwards-compatibility one 2011-02-18 01:25:32 +00:00
Jordan Lee cba90ccace (trunk libT) add stubs for UTP_Drained() and UTP_Write() to remove a few #ifdefs from peer-io.c 2011-02-18 01:18:51 +00:00
Jordan Lee 8e87147c61 (trunk libT) add a stub for UTP_Close() s.t. peer-mgr.c doesn't need the #ifdefs from r11960 2011-02-18 01:06:42 +00:00
Jordan Lee cd04051de8 add configure script switch to enable/disable utp 2011-02-18 00:45:44 +00:00
Juliusz Chroboczek 40463b9d0a Reinstate a variable removed by r11810. 2011-02-18 00:43:54 +00:00
Juliusz Chroboczek 828c9888b0 Don't attempt uTP connexions to peers learned from PEX that didn't signal support. 2011-02-18 00:43:49 +00:00
Juliusz Chroboczek 5af8e26251 Use large kernel buffers for the UDP socket when uTP is enabled.
Since we're using a single UDP socket to implement multiple uTP sockets,
and since we're not always timely in servicing an incoming UDP packet,
it's important to use a large receive buffer.  The send buffer is probably
less critical, we increase it nonetheless.
2011-02-18 00:43:47 +00:00
Juliusz Chroboczek a348c5d421 Don't call tr_utpClose in toggle_utp.
The uTP timer needs to run even when uTP has been disabled, or else the
uTP sockets will never time out.
2011-02-18 00:43:45 +00:00
Juliusz Chroboczek 2729d3c291 Don't mark atoms as non-uTP unless we failed to connect. 2011-02-18 00:43:43 +00:00
Juliusz Chroboczek 55b050f18e Clear utp_failed flag upon seeing an announcement for ut_holepunch. 2011-02-18 00:43:39 +00:00
Juliusz Chroboczek 07addc7d0d Try uTP connections by default. 2011-02-18 00:43:37 +00:00
Juliusz Chroboczek 2ba3305412 When failing to connect over uTP, fall back to TCP. 2011-02-18 00:43:34 +00:00
Juliusz Chroboczek 704f984bdf Implement atom->utp_failed and peerMgrSetUpFailed. 2011-02-18 00:43:31 +00:00
Juliusz Chroboczek 5ba2e40f79 When uTP is disabled, don't call UTP_CheckTimeouts too often. 2011-02-18 00:43:27 +00:00
Juliusz Chroboczek 25b8d08537 When uTP is enabled, open uTP connections to some peers.
Since we don't implement falling back to TCP yet, we're very
conservative: we only use uTP when we have good reasons to believe
the peer speaks uTP.
2011-02-18 00:43:24 +00:00
Juliusz Chroboczek cc96b12bbc Fix typo. 2011-02-18 00:43:21 +00:00
Jordan Lee 004d30337b when sending PEX messages, unset the holepunch flag because we don't support holepunch. 2011-02-18 00:41:32 +00:00
Jordan Lee f00799f80c if we successfully finish a handshake using uTP, mark the peer as supporting uTP 2011-02-18 00:41:06 +00:00
Jordan Lee 75badcd4ab silence compiler warning 2011-02-18 00:40:53 +00:00
Jordan Lee 71486f8c86 call UTP_RBDrained when our read buffer is empty 2011-02-18 00:40:38 +00:00
Jordan Lee e4b4812caa add dbgmsg statements to peer-io's uTP code 2011-02-18 00:40:22 +00:00
Jordan Lee 9626aa4506 uTP peers need tr_peerIoFlush() to work during the handshake phase. 2011-02-18 00:40:01 +00:00
Jordan Lee f6a85cb16b implement bandwidth limiting for uploads to uTP peers 2011-02-18 00:39:33 +00:00
Juliusz Chroboczek 3c56dbea2a Remove more debugging messages. 2011-02-18 00:36:36 +00:00
Juliusz Chroboczek f33a772b00 Call didWriteWrapper in utp_on_write. 2011-02-18 00:36:33 +00:00
Juliusz Chroboczek e35d1aacaf Don't propagate information about ut_holepunch over PEX.
It's not useful, says Greg.
2011-02-18 00:36:31 +00:00
Juliusz Chroboczek c9c2ad7c57 Don't use read_enabled in get_rb_size.
We're no longer maintaining read_enabled, as there are simpler ways of
doing the same.  Additionally, we used RBDrained incorrectly.
2011-02-18 00:36:27 +00:00
Juliusz Chroboczek 77c034122e Revert "Maintain information about enabled/disabled I/O."
This reverts commit 604f8fd10db747e57d8710cc53326c0e114ad32c.
2011-02-18 00:36:24 +00:00
Juliusz Chroboczek c9a7becf87 Remove debugging messages. 2011-02-18 00:36:21 +00:00
Juliusz Chroboczek 88f4eac81f Implement outgoing uTP connections. 2011-02-18 00:36:19 +00:00
Juliusz Chroboczek 456dbdd935 Export uTP send_to callback. 2011-02-18 00:36:16 +00:00
Juliusz Chroboczek 11114a74c0 Fix peerIoReconnect for uTP sockets. 2011-02-18 00:36:12 +00:00
Juliusz Chroboczek dae7db8e10 Implement pacing of reads.
This should cause uTP sockets to respect read bandwidth limits.  I'm not so
sure about the values we return for the read buffer size -- perhaps we
should allow some slack for network latency?
2011-02-18 00:36:09 +00:00