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.

63 lines
1.5 KiB

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