bad bad static_cast removed, clean read thread shutdown

This commit is contained in:
Matej Sekoranja
2014-03-26 10:54:16 +01:00
parent d925e0ccfb
commit 3e514c819a
2 changed files with 19 additions and 12 deletions
+18 -11
View File
@@ -199,16 +199,17 @@ namespace epics {
{
// handle response
processApplicationMessage();
postProcess = false;
if (!isOpen())
return;
postProcess = false;
postProcessApplicationMessage();
}
catch(...) //finally
catch(...)
{
if (postProcess)
{
if (!isOpen())
return;
postProcessApplicationMessage();
}
@@ -230,9 +231,6 @@ namespace epics {
void AbstractCodec::postProcessApplicationMessage()
{
if (!isOpen())
return;
// can be closed by now
// isOpen() should be efficiently implemented
while (true)
@@ -1200,7 +1198,7 @@ namespace epics {
BlockingAbstractCodec *bac = static_cast<BlockingAbstractCodec *>(param);
Transport::shared_pointer ptr = bac->shared_from_this();
bac->setSenderThread();
while (bac->isOpen())
@@ -1232,7 +1230,7 @@ namespace epics {
"YYYYYYYYYYYYYYYYYYYYYYYYYYYY (threadId: %u)",
epicsThreadGetIdSelf());
LOG(logLevelTrace,
LOG(logLevelTrace,
"BlockingAbstractCodec::sendThread EXIIIIT (threadId: %u)",
epicsThreadGetIdSelf());
@@ -1429,7 +1427,10 @@ namespace epics {
int bytesRead = recv(_channel,
(char*)(dst->getArray()+pos), remaining, 0);
// NOTE: do not log here, you might override SOCKERRNO relevant to recv() operation above
/*
LOG(logLevelTrace,
"BlockingSocketAbstractCodec::read after recv, read: %d",
bytesRead," (threadId: %u)",
@@ -1440,6 +1441,7 @@ namespace epics {
hexDump(std::string("READ"),
(const int8 *)(dst->getArray()+pos), bytesRead);
}
*/
if(unlikely(bytesRead<=0)) {
@@ -1447,6 +1449,11 @@ namespace epics {
{
int socketError = SOCKERRNO;
LOG(logLevelTrace,
"BlockingSocketAbstractCodec::read SOCKERRNO %d", socketError,
" (threadId: %u)",
epicsThreadGetIdSelf());
// interrupted or timeout
if (socketError == EINTR ||
socketError == EAGAIN ||
@@ -4117,7 +4117,7 @@ TODO
auto_ptr<ResponseHandler> handler(new ClientResponseHandler(shared_from_this()));
Transport::shared_pointer t = m_connector->connect(client, handler, *serverAddress, minorRevision, priority);
// TODO !!!
static_pointer_cast<BlockingTCPTransport>(t)->setFlushStrategy(m_flushStrategy);
//static_pointer_cast<BlockingTCPTransport>(t)->setFlushStrategy(m_flushStrategy);
return t;
}
catch (...)