Skip to content

Commit

Permalink
* Some small cosmetics in netcode patch.
Browse files Browse the repository at this point in the history
git-svn-id: http://mangos.svn.sourceforge.net/svnroot/mangos@6767 26674162-90ff-0310-a85b-b64107c8dee9
  • Loading branch information
mr_derex committed Oct 13, 2008
1 parent d1ad38a commit f37e66e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 25 deletions.
28 changes: 12 additions & 16 deletions trunk/src/game/WorldSocket.cpp
Expand Up @@ -51,14 +51,14 @@

struct ServerPktHeader
{
ACE_UINT16 size;
ACE_UINT16 cmd;
uint16 size;
uint16 cmd;
};

struct ClientPktHeader
{
ACE_UINT16 size;
ACE_UINT32 cmd;
uint16 size;
uint32 cmd;
};

#if defined( __GNUC__ )
Expand Down Expand Up @@ -260,28 +260,28 @@ int WorldSocket::handle_input (ACE_HANDLE)
if ((errno == EWOULDBLOCK) ||
(errno == EAGAIN))
{
//return 0;
return this->Update (); // interesting line ,isnt it ?
}

DEBUG_LOG ("WorldSocket::handle_input: Peer error closing connection errno = %s", ACE_OS::strerror (errno));

errno = ECONNRESET;
return -1;
}
case 0:
{
DEBUG_LOG ("WorldSocket::handle_input: Peer has closed connection\n");

errno = ECONNRESET;

return -1;
}
case 1:
return 1;
default:
return this->Update (); // another interesting line ;)
}

//return 0;
return this->Update (); // another interesting line ;)
ACE_NOTREACHED(return -1);
}

int WorldSocket::handle_output (ACE_HANDLE)
Expand Down Expand Up @@ -370,12 +370,7 @@ int WorldSocket::handle_input_header (void)
{
ACE_ASSERT (m_RecvWPct == NULL);

if (m_Header.length () != sizeof (ClientPktHeader))
{
sLog.outError ("WorldSocket::handle_input_header: internal error: invalid header");
errno = EINVAL;
return -1;
}
ACE_ASSERT (m_Header.length () == sizeof (ClientPktHeader));

m_Crypt.DecryptRecv ((ACE_UINT8*) m_Header.rd_ptr (), sizeof (ClientPktHeader));

Expand All @@ -389,10 +384,10 @@ int WorldSocket::handle_input_header (void)

if ((header.size < 4) ||
(header.size > 10240) ||
(header.cmd <= 0) ||
(header.cmd < 0) ||
(header.cmd > 10240)
)
{
{
sLog.outError ("WorldSocket::handle_input_header: client sent mailformed packet size = %d , cmd = %d",
header.size,
header.cmd);
Expand Down Expand Up @@ -646,6 +641,7 @@ int WorldSocket::ProcessIncoming (WorldPacket* new_pct)

int WorldSocket::HandleAuthSession (WorldPacket& recvPacket)
{
// NOTE: ATM the socket is singlethreaded, have this in mind ...
uint8 digest[20];
uint32 clientSeed;
uint32 unk2;
Expand Down
9 changes: 0 additions & 9 deletions trunk/src/shared/Common.h
Expand Up @@ -20,12 +20,7 @@
#define MANGOSSERVER_COMMON_H

// config.h needs to be included 1st
// TODO this thingy looks like hack ,but its not, need to
// make separate header however, because It makes mess here.
#ifdef HAVE_CONFIG_H
// Remove Some things that we will define
// This is in case including another config.h
// before trinity config.h
#ifdef PACKAGE
#undef PACKAGE
#endif //PACKAGE
Expand Down Expand Up @@ -84,10 +79,6 @@
// must be the first thing to include for it to work
#include "MemoryLeaks.h"

#ifdef HAVE_CONFIG_H
# include <config.h>
#endif

#include "Utilities/HashMap.h"
#include <stdio.h>
#include <stdlib.h>
Expand Down

0 comments on commit f37e66e

Please sign in to comment.