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.

53 lines
1.3 KiB

7 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
7 years ago
​
​
​
​
​
7 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. #include "netClientHandler.h"
  2. #define LOG( X ) m_pLog->Log( "networkClientHandler", this, X )
  3. #ifdef DEBUG
  4. #define LOG_ERROR( X ) {\
  5. char _tBfrErrMSG234[256];\
  6. sprintf( _tBfrErrMSG234, "In file %s[%d] in func:%s %s",__FILE__, __LINE__, __func__, X );\
  7. m_pLog->Log( "networkClientHandler", this, _LOG_ERROR, _tBfrErrMSG234 );\
  8. }
  9. #else
  10. #define LOG_ERROR( X ) m_pLog->Log( "networkClientHandler", this, _LOG_ERROR, X );
  11. #endif
  12. networkClientHandler::networkClientHandler( int SocketFD, basicEngine *ptr ): basicEventHandler(){
  13. m_pEngine = ptr;
  14. m_pLog = basicLogCollection::getInstance();
  15. m_pPort = new serverPort( SocketFD );
  16. #ifdef DEBUG
  17. if( m_pPort ) {
  18. LOG("Client Port Created OK!");
  19. };
  20. #endif
  21. };
  22. networkClientHandler::~networkClientHandler(){
  23. # ifdef DEBUG
  24. LOG("Destructor Start");
  25. # endif
  26. m_pEngine = NULL;
  27. if( m_pPort != NULL ){
  28. # ifdef DEBUG
  29. LOG("Destruct Server Port");
  30. # endif
  31. delete( m_pPort );
  32. # ifdef DEBUG
  33. LOG("Destruct Server Port Done");
  34. # endif
  35. };
  36. # ifdef DEBUG
  37. LOG("Destructor Finished");
  38. # endif
  39. };
  40. bool networkClientHandler::attachEngine( basicEngine *ptr ){
  41. if( ptr == NULL ) return false;
  42. m_pEngine = ptr;
  43. return true;
  44. };
  45. #undef LOG
  46. #undef LOG_ERROR