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:
Michael Davidsaver
2018-04-02 10:40:50 -07:00
parent 38965bb847
commit da85d39c0c
2 changed files with 2 additions and 4 deletions

View File

@@ -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();

View File

@@ -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: