Fixed core dumps. Transport client now finishes successfully.
This commit is contained in:
@@ -24,7 +24,6 @@
|
||||
#include <poll.h>
|
||||
|
||||
using std::ostringstream;
|
||||
using std::set;
|
||||
|
||||
namespace epics {
|
||||
namespace pvAccess {
|
||||
@@ -33,9 +32,7 @@ namespace epics {
|
||||
int receiveBufferSize) :
|
||||
_context(context), _bindAddress(NULL), _serverSocketChannel(
|
||||
INVALID_SOCKET), _receiveBufferSize(receiveBufferSize),
|
||||
_destroyed(false), _threadId(NULL), _connectedClients(
|
||||
new set<BlockingServerTCPTransport*> ()),
|
||||
_connectedClientsMutex(new Mutex()) {
|
||||
_destroyed(false), _threadId(NULL) {
|
||||
initialize(port);
|
||||
}
|
||||
|
||||
@@ -43,22 +40,6 @@ namespace epics {
|
||||
destroy();
|
||||
|
||||
if(_bindAddress!=NULL) delete _bindAddress;
|
||||
|
||||
_connectedClientsMutex->lock();
|
||||
// go through all the connected clients, close them, and destroy
|
||||
set<BlockingServerTCPTransport*>::iterator it =
|
||||
_connectedClients->begin();
|
||||
while(it!=_connectedClients->end()) {
|
||||
BlockingServerTCPTransport* client = *it;
|
||||
it++;
|
||||
client->close(true);
|
||||
delete client;
|
||||
}
|
||||
_connectedClients->clear();
|
||||
delete _connectedClients;
|
||||
_connectedClientsMutex->unlock();
|
||||
|
||||
delete _connectedClientsMutex;
|
||||
}
|
||||
|
||||
int BlockingTCPAcceptor::initialize(in_port_t port) {
|
||||
@@ -254,16 +235,9 @@ namespace epics {
|
||||
errlogInfo,
|
||||
"Connection to CA client %s failed to be validated, closing it.",
|
||||
ipAddrStr);
|
||||
delete transport;
|
||||
return;
|
||||
}
|
||||
|
||||
// store the new connected client
|
||||
_connectedClientsMutex->lock();
|
||||
_connectedClients->insert(transport);
|
||||
transport->addCloseNotification(this);
|
||||
_connectedClientsMutex->unlock();
|
||||
|
||||
errlogSevPrintf(errlogInfo,
|
||||
"Serving to CA client: %s", ipAddrStr);
|
||||
|
||||
@@ -307,16 +281,5 @@ namespace epics {
|
||||
}
|
||||
}
|
||||
|
||||
void BlockingTCPAcceptor::transportClosed(
|
||||
BlockingServerTCPTransport* transport) {
|
||||
Lock lock(_connectedClientsMutex);
|
||||
|
||||
// remove the closed client from the list of connected clients
|
||||
_connectedClients->erase(transport);
|
||||
|
||||
// release the memory
|
||||
delete transport;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user