From c82c636d8c9ac24c1e73740c35b3a93525783a3d Mon Sep 17 00:00:00 2001 From: "madmaxoft@gmail.com" Date: Wed, 8 Feb 2012 10:02:46 +0000 Subject: cSocketThreads plugged in for cClientHandle reading. Sending still kept the old way. Please help me test this commit thoroughly, this is a change that can break on subtleties. git-svn-id: http://mc-server.googlecode.com/svn/trunk@244 0a769ca7-a7f5-676a-18bf-c427514a06d6 --- source/cSocket.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'source/cSocket.cpp') diff --git a/source/cSocket.cpp b/source/cSocket.cpp index 42cc298a7..00f10154b 100644 --- a/source/cSocket.cpp +++ b/source/cSocket.cpp @@ -27,6 +27,7 @@ cSocket::cSocket(xSocket a_Socket) cSocket::~cSocket() { + // Do NOT close the socket; this class is an API wrapper, not a RAII! } @@ -100,6 +101,10 @@ AString cSocket::GetErrorString( int a_ErrNo ) FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, NULL, a_ErrNo, 0, buffer, ARRAYCOUNT(buffer), NULL); Printf(Out, "%d: %s", a_ErrNo, buffer); + if (!Out.empty() && (Out[Out.length() - 1] == '\n')) + { + Out.erase(Out.length() - 2); + } return Out; #else // _WIN32 @@ -312,7 +317,7 @@ unsigned short cSocket::GetPort(void) const { return 0; } - return Addr.sin_port; + return ntohs(Addr.sin_port); } -- cgit v1.2.3