Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

log errno names instead of values #49

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 5 additions & 4 deletions apps/clicktocall/HttpBase.cxx
Expand Up @@ -15,6 +15,7 @@
#include "HttpConnection.hxx"
#include "WebAdmin.hxx"
#include <rutil/WinLeakCheck.hxx>
#include "rutil/Errdes.hxx"

using namespace clicktocall;
using namespace resip;
Expand Down Expand Up @@ -62,7 +63,7 @@ HttpBase::HttpBase( int port, IpVersion ipVer, const Data& realm ):
if ( mFd == INVALID_SOCKET )
{
int e = getErrno();
ErrLog (<< "Failed to create socket: " << strerror(e));
ErrLog (<< "Failed to create socket: " << strerror(e) <<" error message from Errdes.hxx file: " << errortostringOS(e) );
sane = false;
return;
}
Expand All @@ -78,7 +79,7 @@ HttpBase::HttpBase( int port, IpVersion ipVer, const Data& realm ):
#endif
{
int e = getErrno();
ErrLog (<< "Couldn't set sockoptions SO_REUSEPORT | SO_REUSEADDR: " << strerror(e));
ErrLog (<< "Couldn't set sockoptions SO_REUSEPORT | SO_REUSEADDR: " << strerror(e) <<" error message from Errdes.hxx file: " << errortostringOS(e) );
sane = false;
return;
}
Expand Down Expand Up @@ -116,7 +117,7 @@ HttpBase::HttpBase( int port, IpVersion ipVer, const Data& realm ):
if (e != 0 )
{
int e = getErrno();
InfoLog (<< "Failed listen " << strerror(e));
InfoLog (<< "Failed listen " << strerror(e) <<" error message from Errdes.hxx file: " << errortostringOS(e) );
sane = false;
return;
}
Expand Down Expand Up @@ -155,7 +156,7 @@ HttpBase::process(FdSet& fdset)
case EWOULDBLOCK:
return;
default:
ErrLog(<< "Some error reading from socket: " << e);
ErrLog(<< "Some error reading from socket: "<< e <<", error message: " << errortostringOS(e) );
}
return;
}
Expand Down
9 changes: 5 additions & 4 deletions apps/clicktocall/HttpConnection.cxx
Expand Up @@ -8,6 +8,7 @@
#include <resip/stack/Tuple.hxx>
#include <rutil/DnsUtil.hxx>
#include <rutil/ParseBuffer.hxx>
#include "rutil/Errdes.hxx"

#include "Version.hxx"
#include "AppSubsystem.hxx"
Expand All @@ -30,7 +31,7 @@ HttpConnection::HttpConnection( HttpBase& base, resip::Socket pSock ):
mSock(pSock),
mParsedRequest(false)
{
resip_assert( mSock > 0 );
resip_assert( mSock > 0 );
}


Expand Down Expand Up @@ -235,10 +236,10 @@ HttpConnection::processSomeReads()
InfoLog (<< "buf is outside your accessible address space.");
break;
default:
InfoLog (<< "Some other error");
InfoLog (<< "Some other error: " << e << " error message: " << errortostringOS(e) );
break;
}
InfoLog (<< "Failed read on " << (int)mSock << " " << strerror(e));
InfoLog (<< "Failed read on " << (int)mSock << " " << strerror(e) << " error message from Errdes.hxx file: " << errortostringOS(e) );
return false;
}
else if (bytesRead == 0)
Expand Down Expand Up @@ -347,7 +348,7 @@ HttpConnection::processSomeWrites()
if (bytesWritten == INVALID_SOCKET)
{
int e = getErrno();
InfoLog (<< "HttpConnection failed write on " << mSock << " " << strerror(e));
InfoLog (<< "HttpConnection failed write on " << mSock << " " << strerror(e) << " error message from Errdes.hxx file " << errortostringOS(e) );

return false;
}
Expand Down
7 changes: 4 additions & 3 deletions apps/clicktocall/XmlRpcConnection.cxx
Expand Up @@ -8,6 +8,7 @@
#include <resip/stack/Tuple.hxx>
#include <rutil/DnsUtil.hxx>
#include <rutil/ParseBuffer.hxx>
#include "rutil/Errdes.hxx"

#include "Version.hxx"
#include "AppSubsystem.hxx"
Expand All @@ -30,7 +31,7 @@ XmlRpcConnection::XmlRpcConnection(XmlRpcServerBase& server, resip::Socket sock)
mNextRequestId(1),
mSock(sock)
{
resip_assert(mSock > 0);
resip_assert(mSock > 0);
}


Expand Down Expand Up @@ -107,7 +108,7 @@ XmlRpcConnection::processSomeReads()
{
int e = getErrno();
XmlRpcServerBase::logSocketError(e);
InfoLog (<< "XmlRpcConnection::processSomeReads: Failed read on " << (int)mSock);
InfoLog (<< "XmlRpcConnection::processSomeReads: Failed read on " << (int)mSock << " " << strerror(e) << " error message from Errdes.hxx file : " << errortostringOS(e));
return false;
}
else if(bytesRead == 0)
Expand Down Expand Up @@ -191,7 +192,7 @@ XmlRpcConnection::processSomeWrites()
{
int e = getErrno();
XmlRpcServerBase::logSocketError(e);
InfoLog (<< "XmlRpcConnection::processSomeWrites - failed write on " << mSock << " " << strerror(e));
InfoLog (<< "XmlRpcConnection::processSomeWrites - failed write on " << mSock << " " << strerror(e) << " error message from Errdes.hxx file : " << errortostringOS(e));

return false;
}
Expand Down
27 changes: 14 additions & 13 deletions apps/clicktocall/XmlRpcServerBase.cxx
Expand Up @@ -14,6 +14,7 @@
#include "XmlRpcServerBase.hxx"
#include "XmlRpcConnection.hxx"
#include <rutil/WinLeakCheck.hxx>
#include "rutil/Errdes.hxx"

using namespace clicktocall;
using namespace resip;
Expand All @@ -36,7 +37,7 @@ XmlRpcServerBase::XmlRpcServerBase(int port, IpVersion ipVer) :
{
int e = getErrno();
logSocketError(e);
ErrLog(<< "XmlRpcServerBase::XmlRpcServerBase: Failed to create socket: " << strerror(e));
ErrLog(<< "XmlRpcServerBase::XmlRpcServerBase: Failed to create socket: " << strerror(e) << " error message from Errdes.hxx file: " << errortostringOS(e) );
mSane = false;
return;
}
Expand All @@ -53,7 +54,7 @@ XmlRpcServerBase::XmlRpcServerBase(int port, IpVersion ipVer) :
{
int e = getErrno();
logSocketError(e);
ErrLog(<< "XmlRpcServerBase::XmlRpcServerBase: Couldn't set sockoptions SO_REUSEPORT | SO_REUSEADDR: " << strerror(e));
ErrLog(<< "XmlRpcServerBase::XmlRpcServerBase: Couldn't set sockoptions SO_REUSEPORT | SO_REUSEADDR: " << strerror(e) << " error message from Errdes.hxx file: " << errortostringOS(e) );
mSane = false;
return;
}
Expand Down Expand Up @@ -81,7 +82,7 @@ XmlRpcServerBase::XmlRpcServerBase(int port, IpVersion ipVer) :
{
int e = getErrno();
logSocketError(e);
ErrLog(<< "XmlRpcServerBase::XmlRpcServerBase: Could not make HTTP socket non-blocking " << port);
ErrLog(<< "XmlRpcServerBase::XmlRpcServerBase: Could not make HTTP socket non-blocking " << port << strerror(e) << " error message from Errdes.hxx file: " << errortostringOS(e) );
mSane = false;
return;
}
Expand All @@ -94,7 +95,7 @@ XmlRpcServerBase::XmlRpcServerBase(int port, IpVersion ipVer) :
if (e != 0)
{
int e = getErrno();
InfoLog(<< "XmlRpcServerBase::XmlRpcServerBase: Failed listen " << strerror(e));
InfoLog(<< "XmlRpcServerBase::XmlRpcServerBase: Failed listen " << strerror(e) << " error message from Errdes.hxx file: " << errortostringOS(e) );
mSane = false;
return;
}
Expand Down Expand Up @@ -164,7 +165,7 @@ XmlRpcServerBase::process(FdSet& fdset)
return;
default:
logSocketError(e);
ErrLog(<< "XmlRpcServerBase::process: Some error reading from socket: " << e);
ErrLog(<< "XmlRpcServerBase::process: Some error reading from socket: " << e << " error message from Errdes.hxx file: " << errortostringOS(e) );
}
return;
}
Expand Down Expand Up @@ -240,22 +241,22 @@ XmlRpcServerBase::logSocketError(int e)
switch (e)
{
case EAGAIN:
InfoLog (<< "No data ready to read" << strerror(e));
InfoLog (<< "No data ready to read : " << errortostringOS(e) );
break;
case EINTR:
InfoLog (<< "The call was interrupted by a signal before any data was read : " << strerror(e));
InfoLog (<< "The call was interrupted by a signal before any data was read : " << errortostringOS(e) );
break;
case EIO:
InfoLog (<< "I/O error : " << strerror(e));
InfoLog (<< "I/O error : " << errortostringOS(e) );
break;
case EBADF:
InfoLog (<< "fd is not a valid file descriptor or is not open for reading : " << strerror(e));
InfoLog (<< "fd is not a valid file descriptor or is not open for reading : " << errortostringOS(e) );
break;
case EINVAL:
InfoLog (<< "fd is attached to an object which is unsuitable for reading : " << strerror(e));
InfoLog (<< "fd is attached to an object which is unsuitable for reading : " << errortostringOS(e) );
break;
case EFAULT:
InfoLog (<< "buf is outside your accessible address space : " << strerror(e));
InfoLog (<< "buf is outside your accessible address space : " << errortostringOS(e) );
break;

#if defined(WIN32)
Expand Down Expand Up @@ -309,7 +310,7 @@ XmlRpcServerBase::logSocketError(int e)
InfoLog (<<"Connection reset ");
break;

case WSAEWOULDBLOCK:
case WSAEWOULDBLOCK:
DebugLog (<<"Would Block ");
break;

Expand Down Expand Up @@ -353,7 +354,7 @@ XmlRpcServerBase::logSocketError(int e)
#endif

default:
InfoLog (<< "Some other error (" << e << "): " << strerror(e));
InfoLog (<< "Some other error (" << e << "): " << errortostringOS(e) );
break;
}
}
Expand Down
11 changes: 6 additions & 5 deletions apps/ichat-gw/MediaRelay.cxx
Expand Up @@ -15,6 +15,7 @@
#include "AppSubsystem.hxx"
#include "MediaRelay.hxx"
#include <rutil/WinLeakCheck.hxx>
#include "rutil/Errdes.hxx"

using namespace gateway;
using namespace resip;
Expand All @@ -31,7 +32,7 @@ using namespace std;
typedef struct
{
unsigned short versionExtPayloadTypeAndMarker;
unsigned short sequenceNumber;
unsigned short sequenceNumber;
unsigned int timestamp;
unsigned int ssrc;
} RtpHeader;
Expand Down Expand Up @@ -171,7 +172,7 @@ MediaRelay::createRelaySocket(resip::Tuple& tuple)
if ( fd == INVALID_SOCKET )
{
int e = getErrno();
ErrLog (<< "MediaRelay::createRelaySocket - Failed to create socket: " << strerror(e));
ErrLog (<< "MediaRelay::createRelaySocket - Failed to create socket: " << strerror(e) << " error message from Errdes.hxx file: " << errortostringOS(e) );
return INVALID_SOCKET;
}

Expand All @@ -188,7 +189,7 @@ MediaRelay::createRelaySocket(resip::Tuple& tuple)
}
else
{
ErrLog (<< "MediaRelay::createRelaySocket - Could not bind to " << tuple << ", error=" << e);
ErrLog (<< "MediaRelay::createRelaySocket - Could not bind to " << tuple << ", error = " << e << " error message from Errdes.hxx file: " << errortostringOS(e) );
}
return INVALID_SOCKET;
}
Expand All @@ -200,7 +201,7 @@ MediaRelay::createRelaySocket(resip::Tuple& tuple)
if(::getsockname(fd, &tuple.getMutableSockaddr(), &len) == SOCKET_ERROR)
{
int e = getErrno();
ErrLog (<<"MediaRelay::createRelaySocket - getsockname failed, error=" << e);
ErrLog (<<"MediaRelay::createRelaySocket - getsockname failed, error=" << e << " error message from Errdes.hxx file: " << errortostringOS(e) );
return INVALID_SOCKET;
}
}
Expand Down Expand Up @@ -518,7 +519,7 @@ MediaRelay::processReads(FdSet& fdset, MediaRelayPort* relayPort)
int err = getErrno();
if ( err != EWOULDBLOCK )
{
ErrLog (<< "MediaRelay::processReads: port=" << relayPort->mLocalV4Tuple.getPort() << ", Error calling recvfrom: " << err);
ErrLog (<< "MediaRelay::processReads: port=" << relayPort->mLocalV4Tuple.getPort() << ", Error calling recvfrom: " << err << " error message: " << errortostringOS(err) );
}
buffer.reset();
}
Expand Down
12 changes: 6 additions & 6 deletions repro/HttpBase.cxx
Expand Up @@ -18,7 +18,7 @@
#include "repro/HttpConnection.hxx"
#include "repro/WebAdmin.hxx"
#include "rutil/WinLeakCheck.hxx"

#include "rutil/Errdes.hxx"

using namespace resip;
using namespace repro;
Expand Down Expand Up @@ -69,7 +69,7 @@ HttpBase::HttpBase( int port, IpVersion ipVer, const Data& realm, const resip::D
if ( mFd == INVALID_SOCKET )
{
int e = getErrno();
ErrLog (<< "Failed to create socket: " << strerror(e));
ErrLog (<< "Failed to create socket: errno " << e << " error message : "<< errortostringOS(e));
sane = false;
return;
}
Expand All @@ -85,7 +85,7 @@ HttpBase::HttpBase( int port, IpVersion ipVer, const Data& realm, const resip::D
#endif
{
int e = getErrno();
ErrLog (<< "Couldn't set sockoptions SO_REUSEPORT | SO_REUSEADDR: " << strerror(e));
ErrLog (<< "Couldn't set sockoptions SO_REUSEPORT | SO_REUSEADDR: errno " << e << " error message : "<< errortostringOS(e));
sane = false;
return;
}
Expand All @@ -97,7 +97,7 @@ HttpBase::HttpBase( int port, IpVersion ipVer, const Data& realm, const resip::D
if ( ::setsockopt(mFd, IPPROTO_IPV6, IPV6_V6ONLY, &on, sizeof(on)) )
{
int e = getErrno();
ErrLog(<< "HttpBase::HttpBase: Couldn't set sockoptions IPV6_V6ONLY: " << strerror(e));
ErrLog(<< "HttpBase::HttpBase: Couldn't set sockoptions IPV6_V6ONLY: errno " << e << " error message : "<< errortostringOS(e));
sane = false;
return;
}
Expand Down Expand Up @@ -138,7 +138,7 @@ HttpBase::HttpBase( int port, IpVersion ipVer, const Data& realm, const resip::D
if (e != 0 )
{
int e = getErrno();
InfoLog (<< "Failed listen " << strerror(e));
InfoLog (<< "Failed listen : errno " << e << " error message : "<< errortostringOS(e));
sane = false;
return;
}
Expand Down Expand Up @@ -181,7 +181,7 @@ HttpBase::process(FdSet& fdset)
// !jf! this can not be ready in some cases
return;
default:
ErrLog(<< "Some error reading from socket: " << e);
ErrLog(<< "Some error reading from socket: errno " << e << " error message : "<< errortostringOS(e));
// .bwc. This is almost certainly a bad assert that a nefarious
// endpoint could hit.
// assert(0); // Transport::error(e);
Expand Down
7 changes: 4 additions & 3 deletions repro/HttpConnection.cxx
Expand Up @@ -8,6 +8,7 @@
#include "resip/stack/Tuple.hxx"
#include "rutil/DnsUtil.hxx"
#include "rutil/ParseBuffer.hxx"
#include "rutil/Errdes.hxx"

#include "repro/ReproVersion.hxx"
#include "repro/HttpBase.hxx"
Expand All @@ -31,7 +32,7 @@ HttpConnection::HttpConnection( HttpBase& base, Socket pSock ):
mSock(pSock),
mParsedRequest(false)
{
resip_assert( mSock > 0 );
resip_assert( mSock > 0 );
}


Expand Down Expand Up @@ -248,7 +249,7 @@ HttpConnection::processSomeReads()
InfoLog (<< "Some other error");
break;
}
InfoLog (<< "Failed read on " << (int)mSock << " " << strerror(e));
InfoLog (<< "Failed read on " << (int)mSock << " " << errortostringOS(e));
return false;
}
else if (bytesRead == 0)
Expand Down Expand Up @@ -366,7 +367,7 @@ HttpConnection::processSomeWrites()
if (bytesWritten == INVALID_SOCKET)
{
int e = getErrno();
InfoLog (<< "HttpConnection failed write on " << mSock << " " << strerror(e));
InfoLog (<< "HttpConnection failed write on " << mSock << " " << strerror(e) << " error message from Errdes.hxx file : " << errortostringOS(e) );

return false;
}
Expand Down