Changeset 1062
- Timestamp:
- 07/05/08 08:13:12 (4 years ago)
- Location:
- trunk
- Files:
-
- 9 modified
-
libtorrent/configure.ac (modified) (1 diff)
-
libtorrent/src/download/download_main.h (modified) (1 diff)
-
libtorrent/src/net/data_buffer.h (modified) (3 diffs)
-
libtorrent/src/net/socket_datagram.cc (modified) (1 diff)
-
libtorrent/src/protocol/handshake.cc (modified) (2 diffs)
-
libtorrent/src/protocol/handshake_manager.cc (modified) (2 diffs)
-
libtorrent/src/protocol/peer_connection_base.cc (modified) (3 diffs)
-
libtorrent/src/tracker/tracker_manager.cc (modified) (1 diff)
-
rtorrent/src/main.cc (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/libtorrent/configure.ac
r1060 r1062 6 6 7 7 LIBTORRENT_CURRENT=11 8 LIBTORRENT_REVISION= 09 LIBTORRENT_AGE= 28 LIBTORRENT_REVISION=2 9 LIBTORRENT_AGE=0 10 10 11 11 LIBTORRENT_INTERFACE_VERSION_INFO=$LIBTORRENT_CURRENT:$LIBTORRENT_REVISION:$LIBTORRENT_AGE -
trunk/libtorrent/src/download/download_main.h
r1058 r1062 111 111 void set_download_throttle(ThrottleList* t) { m_downloadThrottle = t; } 112 112 113 DataBuffer get_ut_pex(bool initial) { return initial ? m_ut_pex_initial : m_ut_pex_delta; }113 DataBuffer get_ut_pex(bool initial) { return (initial ? m_ut_pex_initial : m_ut_pex_delta).clone(); } 114 114 115 115 bool want_pex_msg() { return m_info->is_pex_active() && m_peerList.available_list()->want_more(); }; -
trunk/libtorrent/src/net/data_buffer.h
r980 r1062 45 45 // Recipient must call clear() when done with the buffer. 46 46 struct DataBuffer { 47 DataBuffer() : m_data(NULL), m_end(NULL), m_copied(false) {} 48 DataBuffer(char* data, char* end) : m_data(data), m_end(end), m_copied(false) {} 47 DataBuffer() : m_data(NULL), m_end(NULL), m_owned(true) {} 48 DataBuffer(char* data, char* end) : m_data(data), m_end(end), m_owned(true) {} 49 50 DataBuffer clone() const { DataBuffer d = *this; d.m_owned = false; return d; } 49 51 50 52 char* data() const { return m_data; } 51 53 char* end() const { return m_end; } 52 54 53 bool copied() const { return m_copied; }55 bool owned() const { return m_owned; } 54 56 bool empty() const { return m_data == NULL; } 55 57 size_t length() const { return m_end - m_data; } 56 58 57 59 void clear(); 58 void set(char* data, char* end, bool copied);60 void set(char* data, char* end, bool owned); 59 61 60 62 private: … … 62 64 char* m_end; 63 65 64 // Used to indicate if buffer held by PCB is copiedand needs to be65 // deleted after transmission .66 bool m_ copied;66 // Used to indicate if buffer held by PCB is its own and needs to be 67 // deleted after transmission (false if shared with other connections). 68 bool m_owned; 67 69 }; 68 70 … … 73 75 74 76 m_data = m_end = NULL; 75 m_ copied = false;77 m_owned = false; 76 78 } 77 79 78 80 inline void 79 DataBuffer::set(char* data, char* end, bool copied) {81 DataBuffer::set(char* data, char* end, bool owned) { 80 82 m_data = data; 81 83 m_end = end; 82 m_ copied = copied;84 m_owned = owned; 83 85 } 84 86 -
trunk/libtorrent/src/net/socket_datagram.cc
r939 r1062 74 74 75 75 if (sa != NULL) { 76 r = ::sendto(m_fileDesc, buffer, length, 0, sa-> c_sockaddr(), sizeof(rak::socket_address));76 r = ::sendto(m_fileDesc, buffer, length, 0, sa->sa_inet()->c_sockaddr(), sizeof(rak::socket_address_inet)); 77 77 } else { 78 78 r = ::send(m_fileDesc, buffer, length, 0); -
trunk/libtorrent/src/protocol/handshake.cc
r1058 r1062 87 87 m_downloadThrottle(manager->download_throttle()->throttle_list()), 88 88 89 m_initializedTime(cachedTime),90 91 89 m_readDone(false), 92 90 m_writeDone(false), … … 525 523 write_extension_handshake(); 526 524 525 // Replay HAVE messages we receive after starting to send the bitfield. 526 // This avoids replaying HAVEs for pieces received between starting the 527 // handshake and now (e.g. when connecting takes longer). Ideally we 528 // should make a snapshot of the bitfield here in case it changes while 529 // we're sending it (if it can't be sent in one write() call). 530 m_initializedTime = cachedTime; 531 527 532 // The download is just starting so we're not sending any 528 533 // bitfield. Pretend we wrote it already. -
trunk/libtorrent/src/protocol/handshake_manager.cc
r1058 r1062 209 209 &download->info()->hash()); 210 210 211 pcb->peer_chunks()->set_have_timer(handshake->initialized_time()); 212 211 213 if (handshake->unread_size() != 0) { 212 214 if (handshake->unread_size() > PeerConnectionBase::ProtocolRead::buffer_size) … … 214 216 215 217 pcb->push_unread(handshake->unread_data(), handshake->unread_size()); 216 pcb->peer_chunks()->set_have_timer(handshake->initialized_time());217 218 218 pcb->event_read(); 219 219 } -
trunk/libtorrent/src/protocol/peer_connection_base.cc
r1032 r1062 93 93 delete m_extensions; 94 94 95 if (m_extensionMessage. copied())95 if (m_extensionMessage.owned()) 96 96 m_extensionMessage.clear(); 97 97 } … … 666 666 PeerConnectionBase::up_extension() { 667 667 if (m_extensionOffset == extension_must_encrypt) { 668 if (m_extensionMessage. copied()) {668 if (m_extensionMessage.owned()) { 669 669 m_encryption.encrypt(m_extensionMessage.data(), m_extensionMessage.length()); 670 670 … … 691 691 // clear() deletes the buffer, only do that if we made a copy, 692 692 // otherwise the buffer is shared among all connections. 693 if (m_extensionMessage. copied())693 if (m_extensionMessage.owned()) 694 694 m_extensionMessage.clear(); 695 695 else -
trunk/libtorrent/src/tracker/tracker_manager.cc
r1030 r1062 115 115 throw internal_error("TrackerManager::send_later() m_control->set() == DownloadInfo::STOPPED."); 116 116 117 rak::timer t(std::max(cachedTime + rak::timer::from_seconds(2), 118 rak::timer::from_seconds(m_control->time_last_connection() + m_control->focus_min_interval()))); 119 117 120 priority_queue_erase(&taskScheduler, &m_taskTimeout); 118 priority_queue_insert(&taskScheduler, &m_taskTimeout, rak::timer::from_seconds(m_control->time_last_connection() + m_control->focus_min_interval()));121 priority_queue_insert(&taskScheduler, &m_taskTimeout, t); 119 122 } 120 123 -
trunk/rtorrent/src/main.cc
r1051 r1062 188 188 189 189 "view_add = started\n" 190 "view_filter = started, false=\n"190 "view_filter = started,d.get_state=\n" 191 191 "view.event_added = started,scheduler.simple.added=\n" 192 192 "view.event_removed = started,scheduler.simple.removed=\n" 193 193 194 194 "view_add = stopped\n" 195 "view_filter = stopped, false=\n"195 "view_filter = stopped,not=$d.get_state=\n" 196 196 197 197 "view_add = complete\n"
