Merge branch 'master' of github.com:EQEmu/Server

This commit is contained in:
KimLS 2016-05-24 23:49:36 -07:00
commit 290bcc5720
2 changed files with 2 additions and 28 deletions

View File

@ -288,10 +288,8 @@ void EQStream::ProcessPacket(EQProtocolPacket *p)
} }
break; break;
case OP_KeepAlive: { case OP_KeepAlive: {
#ifndef COLLECTOR
NonSequencedPush(new EQProtocolPacket(p->opcode,p->pBuffer,p->size)); NonSequencedPush(new EQProtocolPacket(p->opcode,p->pBuffer,p->size));
Log.Out(Logs::Detail, Logs::Netcode, _L "Received and queued reply to keep alive" __L); Log.Out(Logs::Detail, Logs::Netcode, _L "Received and queued reply to keep alive" __L);
#endif
} }
break; break;
case OP_Ack: { case OP_Ack: {
@ -300,14 +298,12 @@ void EQStream::ProcessPacket(EQProtocolPacket *p)
Log.Out(Logs::Detail, Logs::Netcode, _L "Received OP_Ack that was of malformed size" __L); Log.Out(Logs::Detail, Logs::Netcode, _L "Received OP_Ack that was of malformed size" __L);
break; break;
} }
#ifndef COLLECTOR
uint16 seq=ntohs(*(uint16 *)(p->pBuffer)); uint16 seq=ntohs(*(uint16 *)(p->pBuffer));
AckPackets(seq); AckPackets(seq);
if(GetExecutablePlatform() == ExePlatformWorld || GetExecutablePlatform() == ExePlatformZone) { if(GetExecutablePlatform() == ExePlatformWorld || GetExecutablePlatform() == ExePlatformZone) {
retransmittimer = Timer::GetCurrentTime(); retransmittimer = Timer::GetCurrentTime();
} }
#endif
} }
break; break;
case OP_SessionRequest: { case OP_SessionRequest: {
@ -316,7 +312,6 @@ void EQStream::ProcessPacket(EQProtocolPacket *p)
Log.Out(Logs::Detail, Logs::Netcode, _L "Received OP_SessionRequest that was of malformed size" __L); Log.Out(Logs::Detail, Logs::Netcode, _L "Received OP_SessionRequest that was of malformed size" __L);
break; break;
} }
#ifndef COLLECTOR
if (GetState()==ESTABLISHED) { if (GetState()==ESTABLISHED) {
Log.Out(Logs::Detail, Logs::Netcode, _L "Received OP_SessionRequest in ESTABLISHED state (%d) streamactive (%i) attempt (%i)" __L, GetState(),streamactive,sessionAttempts); Log.Out(Logs::Detail, Logs::Netcode, _L "Received OP_SessionRequest in ESTABLISHED state (%d) streamactive (%i) attempt (%i)" __L, GetState(),streamactive,sessionAttempts);
@ -329,7 +324,6 @@ void EQStream::ProcessPacket(EQProtocolPacket *p)
break; break;
} }
} }
#endif
sessionAttempts++; sessionAttempts++;
// we set established below, so statistics will not be reset for session attempts/stream active. // we set established below, so statistics will not be reset for session attempts/stream active.
init(GetState()!=ESTABLISHED); init(GetState()!=ESTABLISHED);
@ -339,10 +333,8 @@ void EQStream::ProcessPacket(EQProtocolPacket *p)
SetMaxLen(ntohl(Request->MaxLength)); SetMaxLen(ntohl(Request->MaxLength));
Log.Out(Logs::Detail, Logs::Netcode, _L "Received OP_SessionRequest: session %lu, maxlen %d" __L, (unsigned long)Session, MaxLen); Log.Out(Logs::Detail, Logs::Netcode, _L "Received OP_SessionRequest: session %lu, maxlen %d" __L, (unsigned long)Session, MaxLen);
SetState(ESTABLISHED); SetState(ESTABLISHED);
#ifndef COLLECTOR
Key=0x11223344; Key=0x11223344;
SendSessionResponse(); SendSessionResponse();
#endif
} }
break; break;
case OP_SessionResponse: { case OP_SessionResponse: {
@ -408,7 +400,6 @@ void EQStream::ProcessPacket(EQProtocolPacket *p)
Log.Out(Logs::Detail, Logs::Netcode, _L "Received OP_OutOfOrderAck that was of malformed size" __L); Log.Out(Logs::Detail, Logs::Netcode, _L "Received OP_OutOfOrderAck that was of malformed size" __L);
break; break;
} }
#ifndef COLLECTOR
uint16 seq=ntohs(*(uint16 *)(p->pBuffer)); uint16 seq=ntohs(*(uint16 *)(p->pBuffer));
MOutboundQueue.lock(); MOutboundQueue.lock();
@ -449,7 +440,6 @@ void EQStream::ProcessPacket(EQProtocolPacket *p)
} }
MOutboundQueue.unlock(); MOutboundQueue.unlock();
#endif
} }
break; break;
case OP_SessionStatRequest: { case OP_SessionStatRequest: {
@ -458,7 +448,6 @@ void EQStream::ProcessPacket(EQProtocolPacket *p)
Log.Out(Logs::Detail, Logs::Netcode, _L "Received OP_SessionStatRequest that was of malformed size" __L); Log.Out(Logs::Detail, Logs::Netcode, _L "Received OP_SessionStatRequest that was of malformed size" __L);
break; break;
} }
#ifndef COLLECTOR
ClientSessionStats *ClientStats=(ClientSessionStats *)p->pBuffer; ClientSessionStats *ClientStats=(ClientSessionStats *)p->pBuffer;
Log.Out(Logs::Detail, Logs::Netcode, _L "Received Stats: %lu packets received, %lu packets sent, Deltas: local %lu, (%lu <- %lu -> %lu) remote %lu" __L, Log.Out(Logs::Detail, Logs::Netcode, _L "Received Stats: %lu packets received, %lu packets sent, Deltas: local %lu, (%lu <- %lu -> %lu) remote %lu" __L,
(unsigned long)ntohl(ClientStats->packets_received), (unsigned long)ntohl(ClientStats->packets_sent), (unsigned long)ntohl(ClientStats->last_local_delta), (unsigned long)ntohl(ClientStats->packets_received), (unsigned long)ntohl(ClientStats->packets_sent), (unsigned long)ntohl(ClientStats->last_local_delta),
@ -493,7 +482,6 @@ void EQStream::ProcessPacket(EQProtocolPacket *p)
ServerStats->packets_received = htonll(GetPacketsReceived()); ServerStats->packets_received = htonll(GetPacketsReceived());
NonSequencedPush(new EQProtocolPacket(OP_SessionStatResponse, p->pBuffer, p->size)); NonSequencedPush(new EQProtocolPacket(OP_SessionStatResponse, p->pBuffer, p->size));
#endif
} }
break; break;
case OP_SessionStatResponse: { case OP_SessionStatResponse: {
@ -612,9 +600,6 @@ void EQStream::SendPacket(uint16 opcode, EQApplicationPacket *p)
void EQStream::SequencedPush(EQProtocolPacket *p) void EQStream::SequencedPush(EQProtocolPacket *p)
{ {
#ifdef COLLECTOR
delete p;
#else
MOutboundQueue.lock(); MOutboundQueue.lock();
if (uint16(SequencedBase + SequencedQueue.size()) != NextOutSeq) { if (uint16(SequencedBase + SequencedQueue.size()) != NextOutSeq) {
Log.Out(Logs::Detail, Logs::Netcode, _L "Pre-Push Invalid Sequenced queue: BS %d + SQ %d != NOS %d" __L, Log.Out(Logs::Detail, Logs::Netcode, _L "Pre-Push Invalid Sequenced queue: BS %d + SQ %d != NOS %d" __L,
@ -633,19 +618,14 @@ void EQStream::SequencedPush(EQProtocolPacket *p)
} }
MOutboundQueue.unlock(); MOutboundQueue.unlock();
#endif
} }
void EQStream::NonSequencedPush(EQProtocolPacket *p) void EQStream::NonSequencedPush(EQProtocolPacket *p)
{ {
#ifdef COLLECTOR
delete p;
#else
MOutboundQueue.lock(); MOutboundQueue.lock();
Log.Out(Logs::Detail, Logs::Netcode, _L "Pushing non-sequenced packet of length %d" __L, p->size); Log.Out(Logs::Detail, Logs::Netcode, _L "Pushing non-sequenced packet of length %d" __L, p->size);
NonSequencedQueue.push(p); NonSequencedQueue.push(p);
MOutboundQueue.unlock(); MOutboundQueue.unlock();
#endif
} }
void EQStream::SendAck(uint16 seq) void EQStream::SendAck(uint16 seq)

View File

@ -16,6 +16,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/ */
// WHY IS THIS UP HERE
#if defined(_DEBUG) && defined(WIN32) #if defined(_DEBUG) && defined(WIN32)
#ifndef _CRTDBG_MAP_ALLOC #ifndef _CRTDBG_MAP_ALLOC
#include <stdlib.h> #include <stdlib.h>
@ -26,16 +27,9 @@
#ifndef EQDEBUG_H #ifndef EQDEBUG_H
#define EQDEBUG_H #define EQDEBUG_H
#define _WINSOCKAPI_ //stupid windows, trying to fix the winsock2 vs. winsock issues
#if defined(WIN32) && ( defined(PACKETCOLLECTOR) || defined(COLLECTOR) )
// Packet Collector on win32 requires winsock.h due to latest pcap.h
// winsock.h must come before windows.h
#include <winsock.h>
#endif
#ifdef _WINDOWS #ifdef _WINDOWS
#include <windows.h>
#include <winsock2.h> #include <winsock2.h>
#include <windows.h>
#endif #endif
#endif #endif