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