Browse Source

change bittorrent protocol string

miguelfreitas
Miguel Freitas 11 years ago
parent
commit
07e0f50945
  1. 2
      libtorrent/examples/connection_tester.cpp
  2. 6
      libtorrent/src/bt_peer_connection.cpp
  3. 4
      libtorrent/test/test_fast_extension.cpp

2
libtorrent/examples/connection_tester.cpp

@ -173,7 +173,7 @@ struct peer_conn
return; return;
} }
char handshake[] = "\x13" "BitTorrent protocol\0\0\0\0\0\0\0\x04" char handshake[] = "\x13" "twister protocollll\0\0\0\0\0\0\0\x04"
" " // space for info-hash " " // space for info-hash
"aaaaaaaaaaaaaaaaaaaa" // peer-id "aaaaaaaaaaaaaaaaaaaa" // peer-id
"\0\0\0\x01\x02"; // interested "\0\0\0\x01\x02"; // interested

6
libtorrent/src/bt_peer_connection.cpp

@ -701,7 +701,7 @@ namespace libtorrent
TORRENT_ASSERT(t); TORRENT_ASSERT(t);
// add handshake to the send buffer // add handshake to the send buffer
const char version_string[] = "BitTorrent protocol"; const char version_string[] = "twister protocollll";
const int string_len = sizeof(version_string)-1; const int string_len = sizeof(version_string)-1;
char handshake[1 + string_len + 8 + 20 + 20]; char handshake[1 + string_len + 8 + 20 + 20];
@ -2888,7 +2888,7 @@ namespace libtorrent
recv_buffer = receive_buffer(); recv_buffer = receive_buffer();
int packet_size = recv_buffer[0]; int packet_size = recv_buffer[0];
const char protocol_string[] = "\x13" "BitTorrent protocol"; const char protocol_string[] = "\x13" "twister protocollll";
if (packet_size != 19 || if (packet_size != 19 ||
memcmp(recv_buffer.begin, protocol_string, 20) != 0) memcmp(recv_buffer.begin, protocol_string, 20) != 0)
@ -2954,7 +2954,7 @@ namespace libtorrent
#endif #endif
#ifdef TORRENT_VERBOSE_LOGGING #ifdef TORRENT_VERBOSE_LOGGING
peer_log("<== BitTorrent protocol"); peer_log("<== twister protocollll");
#endif #endif
} }

4
libtorrent/test/test_fast_extension.cpp

@ -189,7 +189,7 @@ void send_bitfield(stream_socket& s, char const* bits)
void do_handshake(stream_socket& s, sha1_hash const& ih, char* buffer) void do_handshake(stream_socket& s, sha1_hash const& ih, char* buffer)
{ {
char handshake[] = "\x13" "BitTorrent protocol\0\0\0\0\0\0\0\x04" char handshake[] = "\x13" "twister protocollll\0\0\0\0\0\0\0\x04"
" " // space for info-hash " " // space for info-hash
"aaaaaaaaaaaaaaaaaaaa"; // peer-id "aaaaaaaaaaaaaaaaaaaa"; // peer-id
std::cout << time_now_string() << " ==> handshake" << std::endl; std::cout << time_now_string() << " ==> handshake" << std::endl;
@ -209,7 +209,7 @@ void do_handshake(stream_socket& s, sha1_hash const& ih, char* buffer)
std::cout << time_now_string() << " <== handshake" << std::endl; std::cout << time_now_string() << " <== handshake" << std::endl;
TEST_CHECK(buffer[0] == 19); TEST_CHECK(buffer[0] == 19);
TEST_CHECK(std::memcmp(buffer + 1, "BitTorrent protocol", 19) == 0); TEST_CHECK(std::memcmp(buffer + 1, "twister protocollll", 19) == 0);
char* extensions = buffer + 20; char* extensions = buffer + 20;
// check for fast extension support // check for fast extension support

Loading…
Cancel
Save