1 |
loki_val 08/06/28 11:34:23 |
2 |
|
3 |
Added: libtorrent-0.12.2-fix_pex_leak.patch |
4 |
libtorrent-0.12.2-fix_write_datagram.patch |
5 |
libtorrent-0.12.2-fix_have_timer.patch |
6 |
Log: |
7 |
Revision bump to update patchset with newest fixes from Josef Drexler. Also fixes bug #227391 |
8 |
(Portage version: 2.2_rc1/cvs/Linux 2.6.25.8 i686) |
9 |
|
10 |
Revision Changes Path |
11 |
1.1 net-libs/libtorrent/files/libtorrent-0.12.2-fix_pex_leak.patch |
12 |
|
13 |
file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/net-libs/libtorrent/files/libtorrent-0.12.2-fix_pex_leak.patch?rev=1.1&view=markup |
14 |
plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/net-libs/libtorrent/files/libtorrent-0.12.2-fix_pex_leak.patch?rev=1.1&content-type=text/plain |
15 |
|
16 |
Index: libtorrent-0.12.2-fix_pex_leak.patch |
17 |
=================================================================== |
18 |
Index: libtorrent/src/net/data_buffer.h |
19 |
=================================================================== |
20 |
--- libtorrent/src/net/data_buffer.h (revision 1026) |
21 |
+++ libtorrent/src/net/data_buffer.h (working copy) |
22 |
@@ -44,26 +44,28 @@ |
23 |
|
24 |
// Recipient must call clear() when done with the buffer. |
25 |
struct DataBuffer { |
26 |
- DataBuffer() : m_data(NULL), m_end(NULL), m_copied(false) {} |
27 |
- DataBuffer(char* data, char* end) : m_data(data), m_end(end), m_copied(false) {} |
28 |
+ DataBuffer() : m_data(NULL), m_end(NULL), m_owned(true) {} |
29 |
+ DataBuffer(char* data, char* end) : m_data(data), m_end(end), m_owned(true) {} |
30 |
|
31 |
+ DataBuffer clone() const { DataBuffer d = *this; d.m_owned = false; return d; } |
32 |
+ |
33 |
char* data() const { return m_data; } |
34 |
char* end() const { return m_end; } |
35 |
|
36 |
- bool copied() const { return m_copied; } |
37 |
+ bool owned() const { return m_owned; } |
38 |
bool empty() const { return m_data == NULL; } |
39 |
size_t length() const { return m_end - m_data; } |
40 |
|
41 |
void clear(); |
42 |
- void set(char* data, char* end, bool copied); |
43 |
+ void set(char* data, char* end, bool owned); |
44 |
|
45 |
private: |
46 |
char* m_data; |
47 |
char* m_end; |
48 |
|
49 |
- // Used to indicate if buffer held by PCB is copied and needs to be |
50 |
- // deleted after transmission. |
51 |
- bool m_copied; |
52 |
+ // Used to indicate if buffer held by PCB is its own and needs to be |
53 |
+ // deleted after transmission (false if shared with other connections). |
54 |
+ bool m_owned; |
55 |
}; |
56 |
|
57 |
inline void |
58 |
@@ -72,14 +74,14 @@ |
59 |
delete[] m_data; |
60 |
|
61 |
m_data = m_end = NULL; |
62 |
- m_copied = false; |
63 |
+ m_owned = false; |
64 |
} |
65 |
|
66 |
inline void |
67 |
-DataBuffer::set(char* data, char* end, bool copied) { |
68 |
+DataBuffer::set(char* data, char* end, bool owned) { |
69 |
m_data = data; |
70 |
m_end = end; |
71 |
- m_copied = copied; |
72 |
+ m_owned = owned; |
73 |
} |
74 |
|
75 |
} |
76 |
Index: libtorrent/src/protocol/peer_connection_base.cc |
77 |
=================================================================== |
78 |
--- libtorrent/src/protocol/peer_connection_base.cc (revision 1026) |
79 |
+++ libtorrent/src/protocol/peer_connection_base.cc (working copy) |
80 |
@@ -92,7 +92,7 @@ |
81 |
if (m_extensions != NULL && !m_extensions->is_default()) |
82 |
delete m_extensions; |
83 |
|
84 |
- if (m_extensionMessage.copied()) |
85 |
+ if (m_extensionMessage.owned()) |
86 |
m_extensionMessage.clear(); |
87 |
} |
88 |
|
89 |
@@ -665,7 +665,7 @@ |
90 |
bool |
91 |
PeerConnectionBase::up_extension() { |
92 |
if (m_extensionOffset == extension_must_encrypt) { |
93 |
- if (m_extensionMessage.copied()) { |
94 |
+ if (m_extensionMessage.owned()) { |
95 |
m_encryption.encrypt(m_extensionMessage.data(), m_extensionMessage.length()); |
96 |
|
97 |
} else { |
98 |
@@ -690,7 +690,7 @@ |
99 |
|
100 |
// clear() deletes the buffer, only do that if we made a copy, |
101 |
// otherwise the buffer is shared among all connections. |
102 |
- if (m_extensionMessage.copied()) |
103 |
+ if (m_extensionMessage.owned()) |
104 |
m_extensionMessage.clear(); |
105 |
else |
106 |
m_extensionMessage.set(NULL, NULL, false); |
107 |
Index: libtorrent/src/download/download_main.h |
108 |
=================================================================== |
109 |
--- libtorrent/src/download/download_main.h (revision 1026) |
110 |
+++ libtorrent/src/download/download_main.h (working copy) |
111 |
@@ -105,7 +105,7 @@ |
112 |
ThrottleList* download_throttle() { return m_downloadThrottle; } |
113 |
void set_download_throttle(ThrottleList* t) { m_downloadThrottle = t; } |
114 |
|
115 |
- DataBuffer get_ut_pex(bool initial) { return initial ? m_ut_pex_initial : m_ut_pex_delta; } |
116 |
+ DataBuffer get_ut_pex(bool initial) { return (initial ? m_ut_pex_initial : m_ut_pex_delta).clone(); } |
117 |
|
118 |
bool want_pex_msg() { return m_info->is_pex_active() && m_peerList.available_list()->want_more(); }; |
119 |
|
120 |
|
121 |
|
122 |
|
123 |
1.1 net-libs/libtorrent/files/libtorrent-0.12.2-fix_write_datagram.patch |
124 |
|
125 |
file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/net-libs/libtorrent/files/libtorrent-0.12.2-fix_write_datagram.patch?rev=1.1&view=markup |
126 |
plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/net-libs/libtorrent/files/libtorrent-0.12.2-fix_write_datagram.patch?rev=1.1&content-type=text/plain |
127 |
|
128 |
Index: libtorrent-0.12.2-fix_write_datagram.patch |
129 |
=================================================================== |
130 |
Index: libtorrent/src/net/socket_datagram.cc |
131 |
=================================================================== |
132 |
--- libtorrent/src/net/socket_datagram.cc (revision 1060) |
133 |
+++ libtorrent/src/net/socket_datagram.cc (working copy) |
134 |
@@ -73,7 +73,7 @@ |
135 |
int r; |
136 |
|
137 |
if (sa != NULL) { |
138 |
- r = ::sendto(m_fileDesc, buffer, length, 0, sa->c_sockaddr(), sizeof(rak::socket_address)); |
139 |
+ r = ::sendto(m_fileDesc, buffer, length, 0, sa->sa_inet()->c_sockaddr(), sizeof(rak::socket_address_inet)); |
140 |
} else { |
141 |
r = ::send(m_fileDesc, buffer, length, 0); |
142 |
} |
143 |
|
144 |
|
145 |
|
146 |
1.1 net-libs/libtorrent/files/libtorrent-0.12.2-fix_have_timer.patch |
147 |
|
148 |
file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/net-libs/libtorrent/files/libtorrent-0.12.2-fix_have_timer.patch?rev=1.1&view=markup |
149 |
plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/net-libs/libtorrent/files/libtorrent-0.12.2-fix_have_timer.patch?rev=1.1&content-type=text/plain |
150 |
|
151 |
Index: libtorrent-0.12.2-fix_have_timer.patch |
152 |
=================================================================== |
153 |
Index: libtorrent/src/protocol/handshake_manager.cc |
154 |
=================================================================== |
155 |
--- libtorrent/src/protocol/handshake_manager.cc (revision 1060) |
156 |
+++ libtorrent/src/protocol/handshake_manager.cc (working copy) |
157 |
@@ -208,13 +208,13 @@ |
158 |
e_none, |
159 |
&download->info()->hash()); |
160 |
|
161 |
+ pcb->peer_chunks()->set_have_timer(handshake->initialized_time()); |
162 |
+ |
163 |
if (handshake->unread_size() != 0) { |
164 |
if (handshake->unread_size() > PeerConnectionBase::ProtocolRead::buffer_size) |
165 |
throw internal_error("HandshakeManager::receive_succeeded(...) Unread data won't fit PCB's read buffer."); |
166 |
|
167 |
pcb->push_unread(handshake->unread_data(), handshake->unread_size()); |
168 |
- pcb->peer_chunks()->set_have_timer(handshake->initialized_time()); |
169 |
- |
170 |
pcb->event_read(); |
171 |
} |
172 |
|
173 |
Index: libtorrent/src/protocol/handshake.cc |
174 |
=================================================================== |
175 |
--- libtorrent/src/protocol/handshake.cc (revision 1060) |
176 |
+++ libtorrent/src/protocol/handshake.cc (working copy) |
177 |
@@ -86,8 +86,6 @@ |
178 |
m_uploadThrottle(manager->upload_throttle()->throttle_list()), |
179 |
m_downloadThrottle(manager->download_throttle()->throttle_list()), |
180 |
|
181 |
- m_initializedTime(cachedTime), |
182 |
- |
183 |
m_readDone(false), |
184 |
m_writeDone(false), |
185 |
|
186 |
@@ -524,6 +522,13 @@ |
187 |
if (m_peerInfo->supports_extensions()) |
188 |
write_extension_handshake(); |
189 |
|
190 |
+ // Replay HAVE messages we receive after starting to send the bitfield. |
191 |
+ // This avoids replaying HAVEs for pieces received between starting the |
192 |
+ // handshake and now (e.g. when connecting takes longer). Ideally we |
193 |
+ // should make a snapshot of the bitfield here in case it changes while |
194 |
+ // we're sending it (if it can't be sent in one write() call). |
195 |
+ m_initializedTime = cachedTime; |
196 |
+ |
197 |
// The download is just starting so we're not sending any |
198 |
// bitfield. Pretend we wrote it already. |
199 |
if (m_download->file_list()->bitfield()->is_all_unset() || m_download->initial_seeding() != NULL) { |
200 |
|
201 |
|
202 |
|
203 |
-- |
204 |
gentoo-commits@l.g.o mailing list |