diff options
| author | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2008-06-08 10:27:57 +0000 |
|---|---|---|
| committer | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2008-06-08 10:27:57 +0000 |
| commit | 725f68b0c6bc5eb47d3a647ae6365a8a5eca4261 (patch) | |
| tree | 98aaf46426184416a40417901142e0ec5d4a688c /src/DefaultBtInteractive.cc | |
| parent | 249194ba8da62a1846af9746f6d6e9d20c62e27e (diff) | |
2008-06-08 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Drop connection if the incoming peer ID is the same with
localhost's
one. The previous implementation drops connection when incoming
peer's
IP address is the same with localhost's one.
* src/PeerListenCommand.cc
* src/DefaultBtInteractive.cc
Diffstat (limited to 'src/DefaultBtInteractive.cc')
| -rw-r--r-- | src/DefaultBtInteractive.cc | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/DefaultBtInteractive.cc b/src/DefaultBtInteractive.cc index 5efb6ba1..a1b45c47 100644 --- a/src/DefaultBtInteractive.cc +++ b/src/DefaultBtInteractive.cc @@ -65,6 +65,7 @@ #include "Logger.h" #include "LogFactory.h" #include "StringFormat.h" +#include <cstring> namespace aria2 { @@ -97,6 +98,10 @@ BtMessageHandle DefaultBtInteractive::receiveHandshake(bool quickReply) { if(message.isNull()) { return SharedHandle<BtMessage>(); } + if(memcmp(message->getPeerId(), btContext->getPeerId(), PEER_ID_LENGTH) == 0) { + throw DlAbortEx(StringFormat("CUID#%d - Drop connection from the same Peer ID", cuid).str()); + } + peer->setPeerId(message->getPeerId()); if(message->isFastExtensionSupported()) { |
