|
|
@ -15,6 +15,7 @@ protocolParser::protocolParser() : |
|
|
m_pLog = basicLogCollection::getInstance(); |
|
|
m_pLog = basicLogCollection::getInstance(); |
|
|
m_eConnectionStatus = CS_UNKNOWN; |
|
|
m_eConnectionStatus = CS_UNKNOWN; |
|
|
m_oDataTransport = NULL; |
|
|
m_oDataTransport = NULL; |
|
|
|
|
|
m_bTransportRecipient = false; |
|
|
m_pParserBuffer = (U8 *) malloc(PROTOCOL_PARSER_BUFFER_SIZE); |
|
|
m_pParserBuffer = (U8 *) malloc(PROTOCOL_PARSER_BUFFER_SIZE); |
|
|
if (m_pParserBuffer) |
|
|
if (m_pParserBuffer) |
|
|
{ |
|
|
{ |
|
|
@ -40,6 +41,14 @@ protocolParser::~protocolParser() |
|
|
LOG("Destructor Begin"); |
|
|
LOG("Destructor Begin"); |
|
|
#endif
|
|
|
#endif
|
|
|
m_mBufferProtectorMutex.unlock(); |
|
|
m_mBufferProtectorMutex.unlock(); |
|
|
|
|
|
// Leave the transport's recipient list: it would call setConnectionStatus() / deliver data to
|
|
|
|
|
|
// a deleted parser (only when added by setTransport(): other paths set the pointer only)
|
|
|
|
|
|
if (m_bTransportRecipient && m_oDataTransport != NULL) |
|
|
|
|
|
{ |
|
|
|
|
|
m_oDataTransport->removeRecipient(this); |
|
|
|
|
|
}; |
|
|
|
|
|
m_oDataTransport = NULL; |
|
|
|
|
|
m_bTransportRecipient = false; |
|
|
/*
|
|
|
/*
|
|
|
#ifdef PROTOCOL_PARSER_IN_THREAD
|
|
|
#ifdef PROTOCOL_PARSER_IN_THREAD
|
|
|
if (m_bParserThreadStatus > TH_ARMED ) { |
|
|
if (m_bParserThreadStatus > TH_ARMED ) { |
|
|
@ -137,17 +146,19 @@ bool protocolParser::setTransport(basicTransport * Transport, bool CAE) |
|
|
}; |
|
|
}; |
|
|
} |
|
|
} |
|
|
else |
|
|
else |
|
|
{ // Danger -> If transport Object is deleted the pointer is wrong!
|
|
|
|
|
|
if (m_oDataTransport != NULL) |
|
|
|
|
|
|
|
|
{ // A deleted transport calls transportDestroyed(): the pointer is NULL then
|
|
|
|
|
|
if (m_oDataTransport != NULL && m_bTransportRecipient) |
|
|
{ |
|
|
{ |
|
|
m_oDataTransport->removeRecipient(this); |
|
|
m_oDataTransport->removeRecipient(this); |
|
|
}; |
|
|
}; |
|
|
}; |
|
|
}; |
|
|
m_oDataTransport = Transport; |
|
|
|
|
|
|
|
|
m_oDataTransport = Transport; |
|
|
|
|
|
m_bTransportRecipient = false; |
|
|
if (Transport != NULL) |
|
|
if (Transport != NULL) |
|
|
{ |
|
|
{ |
|
|
setConnectionStatus(CS_CONNECTED); |
|
|
setConnectionStatus(CS_CONNECTED); |
|
|
return m_oDataTransport->addRecipient(this); |
|
|
|
|
|
|
|
|
m_bTransportRecipient = m_oDataTransport->addRecipient(this); |
|
|
|
|
|
return m_bTransportRecipient; |
|
|
} |
|
|
} |
|
|
else |
|
|
else |
|
|
{ |
|
|
{ |
|
|
@ -156,6 +167,16 @@ bool protocolParser::setTransport(basicTransport * Transport, bool CAE) |
|
|
return true; |
|
|
return true; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void protocolParser::transportDestroyed(basicTransport * Transport) |
|
|
|
|
|
{ |
|
|
|
|
|
if (Transport != NULL && m_oDataTransport == Transport) |
|
|
|
|
|
{ |
|
|
|
|
|
m_oDataTransport = NULL; |
|
|
|
|
|
m_bTransportRecipient = false; |
|
|
|
|
|
setConnectionStatus(CS_DISCONNECTED); |
|
|
|
|
|
}; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
basicTransport * protocolParser::getCurrentTransport(void) |
|
|
basicTransport * protocolParser::getCurrentTransport(void) |
|
|
{ |
|
|
{ |
|
|
LOG("Get Transport Req"); |
|
|
LOG("Get Transport Req"); |
|
|
|