From cf94994f8e3b34bc871e2c3b2558f8301146810c Mon Sep 17 00:00:00 2001 From: faketruth Date: Sun, 23 Oct 2011 00:18:44 +0000 Subject: Abstracted sockets some more to ensure the same behavior over the entire program and on multiple platforms. MCSocket.h should soon be deprecated and deleted Do a full rebuild (mine bugged out when I didn't) git-svn-id: http://mc-server.googlecode.com/svn/trunk@8 0a769ca7-a7f5-676a-18bf-c427514a06d6 --- source/cClientHandle.cpp | 22 +++------------------- 1 file changed, 3 insertions(+), 19 deletions(-) (limited to 'source/cClientHandle.cpp') diff --git a/source/cClientHandle.cpp b/source/cClientHandle.cpp index 68a70715e..d2d71a9e5 100644 --- a/source/cClientHandle.cpp +++ b/source/cClientHandle.cpp @@ -1,11 +1,3 @@ -#ifndef _WIN32 -#include -#include -#include -#endif - -#include "MCSocket.h" - #include "cClientHandle.h" #include "cServer.h" #include "cWorld.h" @@ -1023,7 +1015,7 @@ void cClientHandle::ReceiveThread( void *lpParam ) while( self->m_bKeepThreadGoing ) { - iStat = recv(socket, &temp, 1, 0); + iStat = socket.Receive( &temp, 1, 0 ); if( cSocket::IsSocketError(iStat) || iStat == 0 ) { LOG("CLIENT DISCONNECTED (%i bytes):%s", iStat, GetWSAError().c_str() ); @@ -1041,11 +1033,7 @@ void cClientHandle::ReceiveThread( void *lpParam ) } else { -#ifndef _WIN32 - LOGERROR("Something went wrong during PacketID 0x%02x (%i)", temp, errno ); -#else - LOGERROR("Something went wrong during PacketID 0x%02x (%s)", temp, GetWSAError().c_str() ); -#endif + LOGERROR("Something went wrong during PacketID 0x%02x (%s)", temp, cSocket::GetLastErrorString() ); LOG("CLIENT %s DISCONNECTED", self->GetUsername() ); break; } @@ -1056,11 +1044,7 @@ void cClientHandle::ReceiveThread( void *lpParam ) char c_Str[128]; -#ifdef _WIN32 - sprintf_s( c_Str, "[C->S] Unknown PacketID: 0x%2x", (unsigned char)temp ); -#else - sprintf( c_Str, "[C->S] Unknown PacketID: 0x%2x", (unsigned char)temp ); -#endif + sprintf_s( c_Str, 128, "[C->S] Unknown PacketID: 0x%2x", (unsigned char)temp ); cPacket_Disconnect DC(c_Str); DC.Send( socket ); -- cgit v1.2.3