You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
64 lines
1.5 KiB
64 lines
1.5 KiB
#include "netClientHandler.h"
|
|
|
|
#define LOG(X) m_pLog->Log("NCH", this, X)
|
|
#ifdef DEBUG
|
|
#define LOG_ERROR(X) \
|
|
{ \
|
|
char _tBfrErrMSG234[256]; \
|
|
sprintf(_tBfrErrMSG234, "In file %s[%d] in func:%s %s", __FILE__, __LINE__, __func__, X); \
|
|
m_pLog->Log("NCH", this, _LOG_ERROR, _tBfrErrMSG234); \
|
|
}
|
|
#else
|
|
#define LOG_ERROR(X) m_pLog->Log("NCH", this, _LOG_ERROR, X);
|
|
#endif
|
|
|
|
networkClientHandler::networkClientHandler(int SocketFD, networkServiceEngine * ptr) :
|
|
basicEventHandler()
|
|
{
|
|
m_pLog = basicLogCollection::getInstance();
|
|
m_pEngine = ptr;
|
|
if( SocketFD || ptr ) ptr = m_pEngine;
|
|
/* Init of Port goes to Top Level Parser!!
|
|
m_pPort = new serverPort( SocketFD );
|
|
#ifdef DEBUG
|
|
if( m_pPort ) {
|
|
LOG("Client Port Created OK!");
|
|
};
|
|
#endif
|
|
*/
|
|
}
|
|
|
|
networkClientHandler::~networkClientHandler()
|
|
{
|
|
#ifdef DEBUG_EXTRA
|
|
LOG("Destructor Start");
|
|
#endif
|
|
m_pEngine = NULL;
|
|
/*
|
|
if( m_pPort != NULL ){
|
|
# ifdef DEBUG
|
|
LOG("Destruct Server Port");
|
|
# endif
|
|
delete( m_pPort );
|
|
# ifdef DEBUG
|
|
LOG("Destruct Server Port Done");
|
|
# endif
|
|
};
|
|
*/
|
|
#ifdef DEBUG_EXTRA
|
|
LOG("Destructor Finished");
|
|
#endif
|
|
}
|
|
|
|
bool networkClientHandler::attachEngine(networkServiceEngine * ptr)
|
|
{
|
|
if (ptr == NULL)
|
|
{
|
|
return false;
|
|
}
|
|
m_pEngine = ptr;
|
|
return true;
|
|
}
|
|
|
|
#undef LOG
|
|
#undef LOG_ERROR
|