codec: const-ify socket
Avoid possible data race of changing _channel before worker threads are joined. Was just using this as a boolean flag for a method which is already guarded in BlockingTCPTransportCodec::close() from being called twice.
This commit is contained in:
@@ -1060,7 +1060,7 @@ void BlockingTCPTransportCodec::waitJoin()
|
||||
|
||||
void BlockingTCPTransportCodec::internalClose(bool /*force*/)
|
||||
{
|
||||
if(_channel != INVALID_SOCKET) {
|
||||
{
|
||||
|
||||
epicsSocketSystemCallInterruptMechanismQueryInfo info =
|
||||
epicsSocketSystemCallInterruptMechanismQuery ();
|
||||
@@ -1090,8 +1090,6 @@ void BlockingTCPTransportCodec::internalClose(bool /*force*/)
|
||||
default:
|
||||
epicsSocketDestroy(_channel);
|
||||
}
|
||||
|
||||
_channel = INVALID_SOCKET; //TODO: mutex to guard _channel
|
||||
}
|
||||
|
||||
Transport::shared_pointer thisSharedPtr = this->shared_from_this();
|
||||
|
||||
@@ -466,8 +466,8 @@ private:
|
||||
AtomicValue<bool> _isOpen;
|
||||
epics::pvData::Thread _readThread, _sendThread;
|
||||
epics::pvData::Event _shutdownEvent;
|
||||
const SOCKET _channel;
|
||||
protected:
|
||||
SOCKET _channel;
|
||||
osiSockAddr _socketAddress;
|
||||
std::string _socketName;
|
||||
protected:
|
||||
|
||||
Reference in New Issue
Block a user