mirror of https://github.com/aria2/aria2
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.ccpull/1/head
parent
249194ba8d
commit
725f68b0c6
|
@ -1,3 +1,11 @@
|
|||
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
|
||||
|
||||
2008-06-08 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
|
||||
|
||||
Returns cached data without checking whether socket is readable
|
||||
|
|
|
@ -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()) {
|
||||
|
|
|
@ -96,12 +96,7 @@ bool PeerListenCommand::execute() {
|
|||
peerSocket.reset(socket->acceptConnection());
|
||||
std::pair<std::string, uint16_t> peerInfo;
|
||||
peerSocket->getPeerInfo(peerInfo);
|
||||
std::pair<std::string, uint16_t> localInfo;
|
||||
peerSocket->getAddrInfo(localInfo);
|
||||
|
||||
if(peerInfo.first == localInfo.first) {
|
||||
continue;
|
||||
}
|
||||
// Since peerSocket may be in non-blocking mode, make it blocking mode
|
||||
// here.
|
||||
peerSocket->setBlockingMode();
|
||||
|
|
Loading…
Reference in New Issue