Browse Source

fixed race condition

pull/102/head
orignal 10 years ago
parent
commit
a0a0234d29
  1. 3
      SAM.cpp
  2. 2
      SAM.h

3
SAM.cpp

@ -59,6 +59,7 @@ namespace stream
default: default:
; ;
} }
m_Socket.close ();
delete this; delete this;
} }
@ -447,7 +448,7 @@ namespace stream
{ {
LogPrint ("SAM stream read error: ", ecode.message ()); LogPrint ("SAM stream read error: ", ecode.message ());
if (ecode != boost::asio::error::operation_aborted) if (ecode != boost::asio::error::operation_aborted)
Terminate (); m_Socket.get_io_service ().post (boost::bind (&SAMSocket::Terminate, this));
} }
else else
{ {

2
SAM.h

@ -21,7 +21,7 @@ namespace stream
const int SAM_CONNECT_TIMEOUT = 5; // in seconds const int SAM_CONNECT_TIMEOUT = 5; // in seconds
const int SAM_NAMING_LOOKUP_TIMEOUT = 5; // in seconds const int SAM_NAMING_LOOKUP_TIMEOUT = 5; // in seconds
const char SAM_HANDSHAKE[] = "HELLO VERSION"; const char SAM_HANDSHAKE[] = "HELLO VERSION";
const char SAM_HANDSHAKE_REPLY[] = "HELLO REPLY RESULT=OK VERSION=3.1\n"; const char SAM_HANDSHAKE_REPLY[] = "HELLO REPLY RESULT=OK VERSION=3.0\n";
const char SAM_SESSION_CREATE[] = "SESSION CREATE"; const char SAM_SESSION_CREATE[] = "SESSION CREATE";
const char SAM_SESSION_CREATE_REPLY_OK[] = "SESSION STATUS RESULT=OK DESTINATION=%s\n"; const char SAM_SESSION_CREATE_REPLY_OK[] = "SESSION STATUS RESULT=OK DESTINATION=%s\n";
const char SAM_SESSION_CREATE_DUPLICATED_ID[] = "SESSION STATUS RESULT=DUPLICATED_ID\n"; const char SAM_SESSION_CREATE_DUPLICATED_ID[] = "SESSION STATUS RESULT=DUPLICATED_ID\n";

Loading…
Cancel
Save