diff --git a/source/ProgrammingSchedule.xls b/source/ProgrammingSchedule.xls index cd2a0b3999..15452bae22 100755 Binary files a/source/ProgrammingSchedule.xls and b/source/ProgrammingSchedule.xls differ diff --git a/source/ps/Network/SocketBase.cpp b/source/ps/Network/SocketBase.cpp index 6c975c0c0a..a052077db8 100755 --- a/source/ps/Network/SocketBase.cpp +++ b/source/ps/Network/SocketBase.cpp @@ -9,6 +9,9 @@ #include "lib.h" #include "CStr.h" +// ERROR is defined by some windows header. Undef it +#undef ERROR +#include "CLogger.h" #include @@ -41,6 +44,9 @@ PS_RESULT GetPS_RESULT(int error) case ECONNREFUSED: return CONNECT_REFUSED; default: + char buf[256]; + Network_GetErrorString(error, buf, sizeof(buf)); + LOG(ERROR, LOG_CAT_NET, "SocketBase.cpp::GetPS_RESULT(): Untranslated error %s[%d]", buf, error); return PS_FAIL; } } @@ -414,7 +420,7 @@ PS_RESULT CSocketBase::Bind(const CSocketAddress &address) break; default: Network_GetErrorString(err, errBuf, sizeof(errBuf)); - printf("CServerSocket::Bind(): bind: %s [%d]\n", errBuf, err); + LOG(ERROR, LOG_CAT_NET, "CServerSocket::Bind(): bind: %s [%d] => PS_FAIL", errBuf, err); } m_State=SS_UNCONNECTED; m_Error=ret; @@ -426,7 +432,7 @@ PS_RESULT CSocketBase::Bind(const CSocketAddress &address) { int err=Network_LastError; Network_GetErrorString(err, errBuf, sizeof(errBuf)); - printf("CServerSocket::Bind(): listen: %s [%d]\n", errBuf, err); + LOG(ERROR, LOG_CAT_NET, "CServerSocket::Bind(): listen: %s [%d] => PS_FAIL", errBuf, err); m_State=SS_UNCONNECTED; return PS_FAIL; } @@ -445,7 +451,7 @@ PS_RESULT CSocketBase::PreAccept(CSocketAddress &addr) if (fd != -1) return PS_OK; else - return PS_FAIL; + return GetPS_RESULT(Network_LastError); } CSocketInternal *CSocketBase::Accept() diff --git a/source/ps/Network/SocketBase.h b/source/ps/Network/SocketBase.h index c5411f9d1c..a1ffd36639 100755 --- a/source/ps/Network/SocketBase.h +++ b/source/ps/Network/SocketBase.h @@ -342,7 +342,7 @@ public: * connection by calling Accept or Reject * * @param addr A pointer to a SocketAddress - * @return PS_OK or PS_FAIL + * @return PS_OK or an error code * * @see Accept(SocketAddress&) * @see Reject() diff --git a/source/ps/Network/StreamSocket.cpp b/source/ps/Network/StreamSocket.cpp index 1e2c93eb9c..edd861c79e 100755 --- a/source/ps/Network/StreamSocket.cpp +++ b/source/ps/Network/StreamSocket.cpp @@ -3,6 +3,8 @@ #include "Network.h" #include "StreamSocket.h" +#include + CStreamSocket::CStreamSocket() {} @@ -21,11 +23,14 @@ void *CStreamSocket_ConnectThread(void *data) CSocketAddress addr; res=CSocketAddress::Resolve(pSock->m_pConnectHost, pSock->m_ConnectPort, addr); + LOG(NORMAL, LOG_CAT_NET, "CStreamSocket_ConnectThread: Resolve: %s -> %s", res, addr.GetString().c_str()); if (res == PS_OK) { pSock->Initialize(); pSock->SetNonBlocking(false); res=pSock->Connect(addr); + if (res != PS_OK) + LOG(ERROR, LOG_CAT_NET, "CStreamSocket_ConnectThread: Connect: %s", res); } if (res == PS_OK)