reftrack BlockingUDPTransport

This commit is contained in:
Michael Davidsaver
2018-04-04 18:31:12 -07:00
parent a8e26123c7
commit 54bb30fd86
3 changed files with 10 additions and 0 deletions
+2
View File
@@ -24,6 +24,7 @@
#include "pv/codec.h"
#include <pv/serverContextImpl.h>
#include <pv/serverChannelImpl.h>
#include <pv/blockingUDP.h>
using namespace epics::pvData;
using std::string;
@@ -173,6 +174,7 @@ void providerRegInit(void*)
registerRefCounter("ServerChannel", &ServerChannel::num_instances);
registerRefCounter("Transport (ABC)", &Transport::num_instances);
registerRefCounter("BlockingTCPTransportCodec", &detail::BlockingTCPTransportCodec::num_instances);
registerRefCounter("BlockingUDPTransport", &BlockingUDPTransport::num_instances);
registerRefCounter("ChannelProvider (ABC)", &ChannelProvider::num_instances);
registerRefCounter("Channel (ABC)", &Channel::num_instances);
registerRefCounter("ChannelRequester (ABC)", &ChannelRequester::num_instances);
+6
View File
@@ -17,6 +17,7 @@
#include <pv/lock.h>
#include <pv/byteBuffer.h>
#include <pv/reftrack.h>
#define epicsExportSharedSymbols
#include <pv/blockingUDP.h>
@@ -42,6 +43,8 @@ inline int sendto(int s, const char *buf, size_t len, int flags, const struct so
// reserve some space for CMD_ORIGIN_TAG message
#define RECEIVE_BUFFER_PRE_RESERVE (PVA_MESSAGE_HEADER_SIZE + 16)
size_t BlockingUDPTransport::num_instances;
BlockingUDPTransport::BlockingUDPTransport(bool serverFlag,
ResponseHandler::shared_pointer const & responseHandler, SOCKET channel,
osiSockAddr& bindAddress,
@@ -79,9 +82,12 @@ BlockingUDPTransport::BlockingUDPTransport(bool serverFlag,
sockAddrToDottedIP(&_remoteAddress.sa, strBuffer, sizeof(strBuffer));
_remoteName = strBuffer;
}
REFTRACE_INCREMENT(num_instances);
}
BlockingUDPTransport::~BlockingUDPTransport() {
REFTRACE_DECREMENT(num_instances);
close(true); // close the socket and stop the thread.
}
+2
View File
@@ -49,6 +49,8 @@ class BlockingUDPTransport : public epics::pvData::NoDefaultMethods,
public:
POINTER_DEFINITIONS(BlockingUDPTransport);
static size_t num_instances;
private:
std::tr1::weak_ptr<BlockingUDPTransport> internal_this;
friend class BlockingUDPConnector;