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.

48 lines
1.2 KiB

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. #include "IM_ClientHandler.h"
  2. #include "../../lib/alg/generic/md5.h"
  3. #include "../../lib/data/json/json_tool.h"
  4. #define LOG( X ) m_pLog->Log( "NCH", this, X )
  5. #ifdef DEBUG
  6. #define LOG_ERROR( X ) {\
  7. char _tBfrErrMSG234[256];\
  8. sprintf( _tBfrErrMSG234, "In file %s[%d] in func:%s %s",__FILE__, __LINE__, __func__, X );\
  9. m_pLog->Log( "NCH", this, _LOG_ERROR, _tBfrErrMSG234 );\
  10. }
  11. #else
  12. #define LOG_ERROR( X ) m_pLog->Log( "NCH", this, _LOG_ERROR, X );
  13. #endif
  14. // Constructor implementation
  15. IM_ClientHandler::IM_ClientHandler( int SOCKET ) : networkClientHandler( SOCKET ), IM_ClientProtocol(){
  16. m_pLog = basicLogCollection::getInstance();
  17. if( m_pPort != NULL ){
  18. //LOG("server port is OK");
  19. if( create() ){
  20. setTransport( m_pPort );
  21. setConnectionStatus( CS_INIT );
  22. m_pPort->addRecipient(( protocolParser *)this );
  23. } else {
  24. LOG_ERROR( "Protocol Parser Creation Failed!");
  25. };
  26. };
  27. };
  28. // Destructor implementation
  29. inline IM_ClientHandler::~IM_ClientHandler(){
  30. };
  31. bool IM_ClientHandler::getStatus( void ){
  32. if( m_pPort!= NULL ) {
  33. return m_pPort->getStatus();
  34. };
  35. return false;
  36. };
  37. #undef LOG
  38. #undef LOG_ERROR