mirror of https://github.com/aria2/aria2
Made socket non-blocking mode in SocketCore::beginListen()
parent
438f95abae
commit
e781e6eac1
|
@ -206,7 +206,6 @@ SharedHandle<SocketCore> FtpConnection::createServerSocket()
|
|||
SharedHandle<SocketCore> serverSocket(new SocketCore());
|
||||
serverSocket->bind(addrinfo.first.c_str(), 0, AF_UNSPEC);
|
||||
serverSocket->beginListen();
|
||||
serverSocket->setNonBlockingMode();
|
||||
return serverSocket;
|
||||
}
|
||||
|
||||
|
|
|
@ -106,7 +106,6 @@ bool HttpListenCommand::bindPort(uint16_t port)
|
|||
}
|
||||
serverSocket_->bind(0, port, family_, flags);
|
||||
serverSocket_->beginListen();
|
||||
serverSocket_->setNonBlockingMode();
|
||||
A2_LOG_INFO(fmt(MSG_LISTENING_PORT,
|
||||
getCuid(), port));
|
||||
e_->addSocketForReadCheck(serverSocket_, this);
|
||||
|
|
|
@ -79,7 +79,6 @@ bool PeerListenCommand::bindPort(uint16_t& port, SegList<int>& sgl)
|
|||
try {
|
||||
socket_->bind(0, port, family_);
|
||||
socket_->beginListen();
|
||||
socket_->setNonBlockingMode();
|
||||
A2_LOG_NOTICE(fmt(_("IPv%d BitTorrent: listening to port %u"),
|
||||
ipv, port));
|
||||
return true;
|
||||
|
|
|
@ -353,6 +353,7 @@ void SocketCore::beginListen()
|
|||
int errNum = SOCKET_ERRNO;
|
||||
throw DL_ABORT_EX(fmt(EX_SOCKET_LISTEN, errorMsg(errNum).c_str()));
|
||||
}
|
||||
setNonBlockingMode();
|
||||
}
|
||||
|
||||
SharedHandle<SocketCore> SocketCore::acceptConnection() const
|
||||
|
|
|
@ -52,6 +52,7 @@ public:
|
|||
SharedHandle<SocketCore> listenSocket(new SocketCore());
|
||||
listenSocket->bind(0);
|
||||
listenSocket->beginListen();
|
||||
listenSocket->setBlockingMode();
|
||||
std::pair<std::string, uint16_t> addrinfo;
|
||||
listenSocket->getAddrInfo(addrinfo);
|
||||
listenPort_ = addrinfo.second;
|
||||
|
|
|
@ -53,6 +53,7 @@ createSocketPair()
|
|||
SocketCore receiverServerSock;
|
||||
receiverServerSock.bind(0);
|
||||
receiverServerSock.beginListen();
|
||||
receiverServerSock.setBlockingMode();
|
||||
|
||||
std::pair<std::string, uint16_t> receiverAddrInfo;
|
||||
receiverServerSock.getAddrInfo(receiverAddrInfo);
|
||||
|
|
Loading…
Reference in New Issue