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

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  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. if( SocketFD || ptr ) ptr = m_pEngine;
  19. /* Init of Port goes to Top Level Parser!!
  20. m_pPort = new serverPort( SocketFD );
  21. #ifdef DEBUG
  22. if( m_pPort ) {
  23. LOG("Client Port Created OK!");
  24. };
  25. #endif
  26. */
  27. }
  28. networkClientHandler::~networkClientHandler()
  29. {
  30. #ifdef DEBUG_EXTRA
  31. LOG("Destructor Start");
  32. #endif
  33. m_pEngine = NULL;
  34. /*
  35. if( m_pPort != NULL ){
  36. # ifdef DEBUG
  37. LOG("Destruct Server Port");
  38. # endif
  39. delete( m_pPort );
  40. # ifdef DEBUG
  41. LOG("Destruct Server Port Done");
  42. # endif
  43. };
  44. */
  45. #ifdef DEBUG_EXTRA
  46. LOG("Destructor Finished");
  47. #endif
  48. }
  49. bool networkClientHandler::attachEngine(networkServiceEngine * ptr)
  50. {
  51. if (ptr == NULL)
  52. {
  53. return false;
  54. }
  55. m_pEngine = ptr;
  56. return true;
  57. }
  58. #undef LOG
  59. #undef LOG_ERROR