Skip to content
This repository has been archived by the owner on Sep 21, 2020. It is now read-only.

Commit

Permalink
TCPAcceptor: Include port number in error messages. (#166)
Browse files Browse the repository at this point in the history
  • Loading branch information
PeterJohnson authored Dec 24, 2016
1 parent 9435970 commit 459cc65
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions wpiutil/src/tcpsockets/TCPAcceptor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,13 +100,15 @@ int TCPAcceptor::start() {

int result = bind(m_lsd, (struct sockaddr*)&address, sizeof(address));
if (result != 0) {
WPI_ERROR(m_logger, "bind() failed: " << SocketStrerror());
WPI_ERROR(m_logger, "bind() to port " << m_port
<< " failed: " << SocketStrerror());
return result;
}

result = listen(m_lsd, 5);
if (result != 0) {
WPI_ERROR(m_logger, "listen() failed: " << SocketStrerror());
WPI_ERROR(m_logger, "listen() on port " << m_port
<< " failed: " << SocketStrerror());
return result;
}
m_listening = true;
Expand Down Expand Up @@ -174,7 +176,8 @@ std::unique_ptr<NetworkStream> TCPAcceptor::accept() {
int sd = ::accept(m_lsd, (struct sockaddr*)&address, &len);
if (sd < 0) {
if (!m_shutdown)
WPI_ERROR(m_logger, "accept() failed: " << SocketStrerror());
WPI_ERROR(m_logger, "accept() on port "
<< m_port << " failed: " << SocketStrerror());
return nullptr;
}
if (m_shutdown) {
Expand Down

0 comments on commit 459cc65

Please sign in to comment.