consolidate ServerChannel and ServerChannelImpl

"interface" with a single implementation.
combine and de-virtualize.
This commit is contained in:
Michael Davidsaver
2017-11-06 15:14:41 -06:00
parent 46df4c07ca
commit 073c77b1ef
11 changed files with 78 additions and 95 deletions
+1 -1
View File
@@ -162,7 +162,7 @@ void providerRegInit(void*)
{
providerRegGbl = new providerRegGbl_t;
registerRefCounter("ServerContextImpl", &ServerContextImpl::num_instances);
registerRefCounter("ServerChannelImpl", &ServerChannelImpl::num_instances);
registerRefCounter("ServerChannel", &ServerChannel::num_instances);
registerRefCounter("BlockingTCPTransportCodec", &detail::BlockingTCPTransportCodec::num_instances);
registerRefCounter("ChannelProvider (ABC)", &ChannelProvider::num_instances);
registerRefCounter("Channel (ABC)", &Channel::num_instances);
+1
View File
@@ -39,6 +39,7 @@
#include <pv/likely.h>
#include <pv/codec.h>
#include <pv/serializationHelper.h>
#include <pv/serverChannelImpl.h>
using namespace std;
using namespace epics::pvData;
+7 -4
View File
@@ -67,6 +67,9 @@
namespace epics {
namespace pvAccess {
class ServerChannel;
namespace detail {
#ifdef PVA_CODEC_USE_ATOMIC
@@ -540,13 +543,13 @@ public:
void registerChannel(
pvAccessID sid,
ServerChannel::shared_pointer const & channel);
std::tr1::shared_ptr<ServerChannel> const & channel);
void unregisterChannel(pvAccessID sid);
ServerChannel::shared_pointer getChannel(pvAccessID sid);
std::tr1::shared_ptr<ServerChannel> getChannel(pvAccessID sid);
void getChannels(std::vector<ServerChannel::shared_pointer>& channels) const;
void getChannels(std::vector<std::tr1::shared_ptr<ServerChannel> >& channels) const;
size_t getChannelCount() const;
@@ -596,7 +599,7 @@ private:
*/
pvAccessID _lastChannelSID;
typedef std::map<pvAccessID, ServerChannel::shared_pointer> _channels_t;
typedef std::map<pvAccessID, std::tr1::shared_ptr<ServerChannel> > _channels_t;
/**
* Channel table (SID -> channel mapping).
*/
-18
View File
@@ -435,24 +435,6 @@ public:
};
class ServerChannel {
public:
POINTER_DEFINITIONS(ServerChannel);
virtual ~ServerChannel() {}
/**
* Get channel SID.
* @return channel SID.
*/
virtual pvAccessID getSID() const = 0;
/**
* Destroy server channel.
* This method MUST BE called if overriden.
*/
virtual void destroy() = 0;
};
/**
* A request that expects an response.
* Responses identified by its I/O ID.
+1 -1
View File
@@ -26,7 +26,7 @@ const int32 BaseChannelRequester::NULL_REQUEST = -1;
BaseChannelRequester::BaseChannelRequester(
ServerContextImpl::shared_pointer const & context,
ServerChannelImpl::shared_pointer const & channel,
ServerChannel::shared_pointer const & channel,
const pvAccessID ioid,
Transport::shared_pointer const & transport) :
_ioid(ioid),
+4 -2
View File
@@ -15,10 +15,12 @@
namespace epics {
namespace pvAccess {
class ServerChannel;
class BaseChannelRequester : virtual public epics::pvData::Requester, public Destroyable
{
public:
BaseChannelRequester(ServerContextImpl::shared_pointer const & context, ServerChannelImpl::shared_pointer const & channel,
BaseChannelRequester(ServerContextImpl::shared_pointer const & context, std::tr1::shared_ptr<ServerChannel> const & channel,
const pvAccessID ioid, Transport::shared_pointer const & transport);
virtual ~BaseChannelRequester() {};
@@ -41,7 +43,7 @@ public:
protected:
const pvAccessID _ioid;
Transport::shared_pointer _transport;
ServerChannelImpl::shared_pointer _channel;
std::tr1::shared_ptr<ServerChannel> _channel;
epics::pvData::Mutex _mutex;
private:
ServerContextImpl::shared_pointer _context;
+15 -15
View File
@@ -293,12 +293,12 @@ public:
typedef std::tr1::shared_ptr<const ServerChannelGetRequesterImpl> const_shared_pointer;
protected:
ServerChannelGetRequesterImpl(ServerContextImpl::shared_pointer const & context,
ServerChannelImpl::shared_pointer const & channel, const pvAccessID ioid,
std::tr1::shared_ptr<ServerChannel> const & channel, const pvAccessID ioid,
Transport::shared_pointer const & transport);
void activate(epics::pvData::PVStructure::shared_pointer const & pvRequest);
public:
static ChannelGetRequester::shared_pointer create(ServerContextImpl::shared_pointer const & context,
ServerChannelImpl::shared_pointer const & channel, const pvAccessID ioid,
std::tr1::shared_ptr<ServerChannel> const & channel, const pvAccessID ioid,
Transport::shared_pointer const & transport,
epics::pvData::PVStructure::shared_pointer const & pvRequest);
virtual ~ServerChannelGetRequesterImpl() {}
@@ -349,12 +349,12 @@ public:
typedef std::tr1::shared_ptr<const ServerChannelPutRequesterImpl> const_shared_pointer;
protected:
ServerChannelPutRequesterImpl(ServerContextImpl::shared_pointer const & context,
ServerChannelImpl::shared_pointer const & channel, const pvAccessID ioid,
std::tr1::shared_ptr<ServerChannel> const & channel, const pvAccessID ioid,
Transport::shared_pointer const & transport);
void activate(epics::pvData::PVStructure::shared_pointer const & pvRequest);
public:
static ChannelPutRequester::shared_pointer create(ServerContextImpl::shared_pointer const & context,
ServerChannelImpl::shared_pointer const & channel, const pvAccessID ioid,
std::tr1::shared_ptr<ServerChannel> const & channel, const pvAccessID ioid,
Transport::shared_pointer const & transport,epics::pvData::PVStructure::shared_pointer const & pvRequest);
virtual ~ServerChannelPutRequesterImpl() {}
@@ -403,12 +403,12 @@ public:
typedef std::tr1::shared_ptr<const ServerChannelPutGetRequesterImpl> const_shared_pointer;
protected:
ServerChannelPutGetRequesterImpl(ServerContextImpl::shared_pointer const & context,
ServerChannelImpl::shared_pointer const & channel, const pvAccessID ioid,
std::tr1::shared_ptr<ServerChannel> const & channel, const pvAccessID ioid,
Transport::shared_pointer const & transport);
void activate(epics::pvData::PVStructure::shared_pointer const & pvRequest);
public:
static ChannelPutGetRequester::shared_pointer create(ServerContextImpl::shared_pointer const & context,
ServerChannelImpl::shared_pointer const & channel, const pvAccessID ioid,
std::tr1::shared_ptr<ServerChannel> const & channel, const pvAccessID ioid,
Transport::shared_pointer const & transport,epics::pvData::PVStructure::shared_pointer const & pvRequest);
virtual ~ServerChannelPutGetRequesterImpl() {}
@@ -472,12 +472,12 @@ public:
typedef std::tr1::shared_ptr<const ServerMonitorRequesterImpl> const_shared_pointer;
protected:
ServerMonitorRequesterImpl(ServerContextImpl::shared_pointer const & context,
ServerChannelImpl::shared_pointer const & channel, const pvAccessID ioid,
std::tr1::shared_ptr<ServerChannel> const & channel, const pvAccessID ioid,
Transport::shared_pointer const & transport);
void activate(epics::pvData::PVStructure::shared_pointer const & pvRequest);
public:
static MonitorRequester::shared_pointer create(ServerContextImpl::shared_pointer const & context,
ServerChannelImpl::shared_pointer const & channel, const pvAccessID ioid,
std::tr1::shared_ptr<ServerChannel> const & channel, const pvAccessID ioid,
Transport::shared_pointer const & transport,epics::pvData::PVStructure::shared_pointer const & pvRequest);
virtual ~ServerMonitorRequesterImpl() {}
@@ -525,12 +525,12 @@ public:
typedef std::tr1::shared_ptr<const ServerChannelArrayRequesterImpl> const_shared_pointer;
protected:
ServerChannelArrayRequesterImpl(ServerContextImpl::shared_pointer const & context,
ServerChannelImpl::shared_pointer const & channel, const pvAccessID ioid,
std::tr1::shared_ptr<ServerChannel> const & channel, const pvAccessID ioid,
Transport::shared_pointer const & transport);
void activate(epics::pvData::PVStructure::shared_pointer const & pvRequest);
public:
static ChannelArrayRequester::shared_pointer create(ServerContextImpl::shared_pointer const & context,
ServerChannelImpl::shared_pointer const & channel, const pvAccessID ioid,
std::tr1::shared_ptr<ServerChannel> const & channel, const pvAccessID ioid,
Transport::shared_pointer const & transport,epics::pvData::PVStructure::shared_pointer const & pvRequest);
virtual ~ServerChannelArrayRequesterImpl() {}
@@ -627,12 +627,12 @@ public:
typedef std::tr1::shared_ptr<const ServerChannelProcessRequesterImpl> const_shared_pointer;
protected:
ServerChannelProcessRequesterImpl(ServerContextImpl::shared_pointer const & context,
ServerChannelImpl::shared_pointer const & channel, const pvAccessID ioid,
std::tr1::shared_ptr<ServerChannel> const & channel, const pvAccessID ioid,
Transport::shared_pointer const & transport);
void activate(epics::pvData::PVStructure::shared_pointer const & pvRequest);
public:
static ChannelProcessRequester::shared_pointer create(ServerContextImpl::shared_pointer const & context,
ServerChannelImpl::shared_pointer const & channel, const pvAccessID ioid,
std::tr1::shared_ptr<ServerChannel> const & channel, const pvAccessID ioid,
Transport::shared_pointer const & transport, epics::pvData::PVStructure::shared_pointer const & pvRequest);
virtual ~ServerChannelProcessRequesterImpl() {}
@@ -679,7 +679,7 @@ public:
typedef std::tr1::shared_ptr<const ServerGetFieldRequesterImpl> const_shared_pointer;
ServerGetFieldRequesterImpl(ServerContextImpl::shared_pointer const & context,
ServerChannelImpl::shared_pointer const & channel, const pvAccessID ioid,
std::tr1::shared_ptr<ServerChannel> const & channel, const pvAccessID ioid,
Transport::shared_pointer const & transport);
virtual ~ServerGetFieldRequesterImpl() {}
@@ -741,12 +741,12 @@ public:
typedef std::tr1::shared_ptr<const ServerChannelRPCRequesterImpl> const_shared_pointer;
protected:
ServerChannelRPCRequesterImpl(ServerContextImpl::shared_pointer const & context,
ServerChannelImpl::shared_pointer const & channel, const pvAccessID ioid,
std::tr1::shared_ptr<ServerChannel> const & channel, const pvAccessID ioid,
Transport::shared_pointer const & transport);
void activate(epics::pvData::PVStructure::shared_pointer const & pvRequest);
public:
static ChannelRPCRequester::shared_pointer create(ServerContextImpl::shared_pointer const & context,
ServerChannelImpl::shared_pointer const & channel, const pvAccessID ioid,
std::tr1::shared_ptr<ServerChannel> const & channel, const pvAccessID ioid,
Transport::shared_pointer const & transport,epics::pvData::PVStructure::shared_pointer const & pvRequest);
virtual ~ServerChannelRPCRequesterImpl() {}
+6 -6
View File
@@ -14,10 +14,10 @@
namespace epics {
namespace pvAccess {
class ServerChannelImpl : public ServerChannel
class ServerChannel
{
public:
POINTER_DEFINITIONS(ServerChannelImpl);
POINTER_DEFINITIONS(ServerChannel);
static size_t num_instances;
@@ -28,17 +28,17 @@ public:
* @param sid channel SID.
* @param css channel security session.
*/
ServerChannelImpl(Channel::shared_pointer const & channel,
ServerChannel(Channel::shared_pointer const & channel,
const ChannelRequester::shared_pointer& requester,
pvAccessID cid, pvAccessID sid,
ChannelSecuritySession::shared_pointer const & css);
virtual ~ServerChannelImpl();
~ServerChannel();
const Channel::shared_pointer& getChannel() const { return _channel; }
pvAccessID getCID() const { return _cid; }
virtual pvAccessID getSID() const OVERRIDE FINAL;
pvAccessID getSID() const { return _sid; }
ChannelSecuritySession::shared_pointer getChannelSecuritySession() const
{ return _channelSecuritySession; }
@@ -50,7 +50,7 @@ public:
//! may return NULL
Destroyable::shared_pointer getRequest(pvAccessID id);
virtual void destroy() OVERRIDE FINAL;
void destroy();
void printInfo() const;
+30 -30
View File
@@ -813,7 +813,7 @@ void ServerChannelRequesterImpl::channelCreated(const Status& status, Channel::s
pvAccessID sid = transport->preallocateChannelSID();
try
{
serverChannel.reset(new ServerChannelImpl(channel, shared_from_this(), _cid, sid, _css));
serverChannel.reset(new ServerChannel(channel, shared_from_this(), _cid, sid, _css));
// ack allocation and register
transport->registerChannel(sid, serverChannel);
@@ -877,10 +877,10 @@ void ServerChannelRequesterImpl::channelStateChange(Channel::shared_pointer cons
if(detail::BlockingServerTCPTransportCodec::shared_pointer transport = _transport.lock())
{
ServerChannelImpl::shared_pointer channel;
ServerChannel::shared_pointer channel;
{
Lock guard(_mutex);
channel= dynamic_pointer_cast<ServerChannelImpl>(_serverChannel.lock());
channel= dynamic_pointer_cast<ServerChannel>(_serverChannel.lock());
}
if (!channel)
@@ -938,7 +938,7 @@ void ServerChannelRequesterImpl::send(ByteBuffer* buffer, TransportSendControl*
// OK
else
{
ServerChannelImpl::shared_pointer serverChannelImpl = dynamic_pointer_cast<ServerChannelImpl>(serverChannel);
ServerChannel::shared_pointer serverChannelImpl = dynamic_pointer_cast<ServerChannel>(serverChannel);
control->startMessage((int8)CMD_CREATE_CHANNEL, 2*sizeof(int32)/sizeof(int8));
buffer->putInt(serverChannelImpl->getCID());
buffer->putInt(serverChannelImpl->getSID());
@@ -965,7 +965,7 @@ void ServerDestroyChannelHandler::handleResponse(osiSockAddr* responseFrom,
const pvAccessID cid = payloadBuffer->getInt();
// get channel by SID
ServerChannelImpl::shared_pointer channel = static_pointer_cast<ServerChannelImpl>(casTransport->getChannel(sid));
ServerChannel::shared_pointer channel = static_pointer_cast<ServerChannel>(casTransport->getChannel(sid));
if (channel.get() == NULL)
{
if (!transport->isClosed())
@@ -1007,7 +1007,7 @@ void ServerGetHandler::handleResponse(osiSockAddr* responseFrom,
// mode
const int8 qosCode = payloadBuffer->getByte();
ServerChannelImpl::shared_pointer channel = static_pointer_cast<ServerChannelImpl>(casTransport->getChannel(sid));
ServerChannel::shared_pointer channel = static_pointer_cast<ServerChannel>(casTransport->getChannel(sid));
if (channel.get() == NULL)
{
BaseChannelRequester::sendFailureMessage((int8)CMD_GET, transport, ioid, qosCode, BaseChannelRequester::badCIDStatus);
@@ -1095,13 +1095,13 @@ void ServerGetHandler::handleResponse(osiSockAddr* responseFrom,
throw; \
}
ServerChannelGetRequesterImpl::ServerChannelGetRequesterImpl(ServerContextImpl::shared_pointer const & context, ServerChannelImpl::shared_pointer const & channel, const pvAccessID ioid, Transport::shared_pointer const & transport) :
ServerChannelGetRequesterImpl::ServerChannelGetRequesterImpl(ServerContextImpl::shared_pointer const & context, ServerChannel::shared_pointer const & channel, const pvAccessID ioid, Transport::shared_pointer const & transport) :
BaseChannelRequester(context, channel, ioid, transport)
{
}
ChannelGetRequester::shared_pointer ServerChannelGetRequesterImpl::create(ServerContextImpl::shared_pointer const & context, ServerChannelImpl::shared_pointer const & channel, const pvAccessID ioid, Transport::shared_pointer const & transport,
ChannelGetRequester::shared_pointer ServerChannelGetRequesterImpl::create(ServerContextImpl::shared_pointer const & context, ServerChannel::shared_pointer const & channel, const pvAccessID ioid, Transport::shared_pointer const & transport,
PVStructure::shared_pointer const & pvRequest)
{
// TODO use std::make_shared
@@ -1262,7 +1262,7 @@ void ServerPutHandler::handleResponse(osiSockAddr* responseFrom,
// mode
const int8 qosCode = payloadBuffer->getByte();
ServerChannelImpl::shared_pointer channel = static_pointer_cast<ServerChannelImpl>(casTransport->getChannel(sid));
ServerChannel::shared_pointer channel = static_pointer_cast<ServerChannel>(casTransport->getChannel(sid));
if (!channel.get())
{
BaseChannelRequester::sendFailureMessage((int8)CMD_PUT, transport, ioid, qosCode, BaseChannelRequester::badCIDStatus);
@@ -1355,13 +1355,13 @@ void ServerPutHandler::handleResponse(osiSockAddr* responseFrom,
}
}
ServerChannelPutRequesterImpl::ServerChannelPutRequesterImpl(ServerContextImpl::shared_pointer const & context, ServerChannelImpl::shared_pointer const & channel,
ServerChannelPutRequesterImpl::ServerChannelPutRequesterImpl(ServerContextImpl::shared_pointer const & context, ServerChannel::shared_pointer const & channel,
const pvAccessID ioid, Transport::shared_pointer const & transport):
BaseChannelRequester(context, channel, ioid, transport)
{
}
ChannelPutRequester::shared_pointer ServerChannelPutRequesterImpl::create(ServerContextImpl::shared_pointer const & context, ServerChannelImpl::shared_pointer const & channel,
ChannelPutRequester::shared_pointer ServerChannelPutRequesterImpl::create(ServerContextImpl::shared_pointer const & context, ServerChannel::shared_pointer const & channel,
const pvAccessID ioid, Transport::shared_pointer const & transport, PVStructure::shared_pointer const & pvRequest)
{
// TODO use std::make_shared
@@ -1532,7 +1532,7 @@ void ServerPutGetHandler::handleResponse(osiSockAddr* responseFrom,
// mode
const int8 qosCode = payloadBuffer->getByte();
ServerChannelImpl::shared_pointer channel = static_pointer_cast<ServerChannelImpl>(casTransport->getChannel(sid));
ServerChannel::shared_pointer channel = static_pointer_cast<ServerChannel>(casTransport->getChannel(sid));
if (!channel.get())
{
BaseChannelRequester::sendFailureMessage((int8)CMD_PUT_GET, transport, ioid, qosCode, BaseChannelRequester::badCIDStatus);
@@ -1638,13 +1638,13 @@ void ServerPutGetHandler::handleResponse(osiSockAddr* responseFrom,
}
}
ServerChannelPutGetRequesterImpl::ServerChannelPutGetRequesterImpl(ServerContextImpl::shared_pointer const & context, ServerChannelImpl::shared_pointer const & channel,
ServerChannelPutGetRequesterImpl::ServerChannelPutGetRequesterImpl(ServerContextImpl::shared_pointer const & context, ServerChannel::shared_pointer const & channel,
const pvAccessID ioid, Transport::shared_pointer const & transport):
BaseChannelRequester(context, channel, ioid, transport), _channelPutGet(), _pvPutStructure(), _pvGetStructure()
{
}
ChannelPutGetRequester::shared_pointer ServerChannelPutGetRequesterImpl::create(ServerContextImpl::shared_pointer const & context, ServerChannelImpl::shared_pointer const & channel,
ChannelPutGetRequester::shared_pointer ServerChannelPutGetRequesterImpl::create(ServerContextImpl::shared_pointer const & context, ServerChannel::shared_pointer const & channel,
const pvAccessID ioid, Transport::shared_pointer const & transport,PVStructure::shared_pointer const & pvRequest)
{
// TODO use std::make_shared
@@ -1856,7 +1856,7 @@ void ServerMonitorHandler::handleResponse(osiSockAddr* responseFrom,
// mode
const int8 qosCode = payloadBuffer->getByte();
ServerChannelImpl::shared_pointer channel = static_pointer_cast<ServerChannelImpl>(casTransport->getChannel(sid));
ServerChannel::shared_pointer channel = static_pointer_cast<ServerChannel>(casTransport->getChannel(sid));
if (!channel.get())
{
BaseChannelRequester::sendFailureMessage((int8)CMD_MONITOR, transport, ioid, qosCode, BaseChannelRequester::badCIDStatus);
@@ -1953,14 +1953,14 @@ void ServerMonitorHandler::handleResponse(osiSockAddr* responseFrom,
}
ServerMonitorRequesterImpl::ServerMonitorRequesterImpl(
ServerContextImpl::shared_pointer const & context, ServerChannelImpl::shared_pointer const & channel,
ServerContextImpl::shared_pointer const & context, ServerChannel::shared_pointer const & channel,
const pvAccessID ioid, Transport::shared_pointer const & transport):
BaseChannelRequester(context, channel, ioid, transport), _channelMonitor(), _structure(), _unlisten(false)
{
}
MonitorRequester::shared_pointer ServerMonitorRequesterImpl::create(
ServerContextImpl::shared_pointer const & context, ServerChannelImpl::shared_pointer const & channel,
ServerContextImpl::shared_pointer const & context, ServerChannel::shared_pointer const & channel,
const pvAccessID ioid, Transport::shared_pointer const & transport,PVStructure::shared_pointer const & pvRequest)
{
// TODO use std::make_shared
@@ -2150,7 +2150,7 @@ void ServerArrayHandler::handleResponse(osiSockAddr* responseFrom,
// mode
const int8 qosCode = payloadBuffer->getByte();
ServerChannelImpl::shared_pointer channel = static_pointer_cast<ServerChannelImpl>(casTransport->getChannel(sid));
ServerChannel::shared_pointer channel = static_pointer_cast<ServerChannel>(casTransport->getChannel(sid));
if (!channel.get())
{
BaseChannelRequester::sendFailureMessage((int8)CMD_ARRAY, transport, ioid, qosCode, BaseChannelRequester::badCIDStatus);
@@ -2278,14 +2278,14 @@ void ServerArrayHandler::handleResponse(osiSockAddr* responseFrom,
}
ServerChannelArrayRequesterImpl::ServerChannelArrayRequesterImpl(
ServerContextImpl::shared_pointer const & context, ServerChannelImpl::shared_pointer const & channel,
ServerContextImpl::shared_pointer const & context, ServerChannel::shared_pointer const & channel,
const pvAccessID ioid, Transport::shared_pointer const & transport):
BaseChannelRequester(context, channel, ioid, transport)
{
}
ChannelArrayRequester::shared_pointer ServerChannelArrayRequesterImpl::create(
ServerContextImpl::shared_pointer const & context, ServerChannelImpl::shared_pointer const & channel,
ServerContextImpl::shared_pointer const & context, ServerChannel::shared_pointer const & channel,
const pvAccessID ioid, Transport::shared_pointer const & transport,PVStructure::shared_pointer const & pvRequest)
{
// TODO use std::make_shared
@@ -2479,7 +2479,7 @@ void ServerDestroyRequestHandler::handleResponse(osiSockAddr* responseFrom,
const pvAccessID sid = payloadBuffer->getInt();
const pvAccessID ioid = payloadBuffer->getInt();
ServerChannelImpl::shared_pointer channel = static_pointer_cast<ServerChannelImpl>(casTransport->getChannel(sid));
ServerChannel::shared_pointer channel = static_pointer_cast<ServerChannel>(casTransport->getChannel(sid));
if (!channel.get())
{
failureResponse(transport, ioid, BaseChannelRequester::badCIDStatus);
@@ -2519,7 +2519,7 @@ void ServerCancelRequestHandler::handleResponse(osiSockAddr* responseFrom,
const pvAccessID sid = payloadBuffer->getInt();
const pvAccessID ioid = payloadBuffer->getInt();
ServerChannelImpl::shared_pointer channel = static_pointer_cast<ServerChannelImpl>(casTransport->getChannel(sid));
ServerChannel::shared_pointer channel = static_pointer_cast<ServerChannel>(casTransport->getChannel(sid));
if (!channel.get())
{
failureResponse(transport, ioid, BaseChannelRequester::badCIDStatus);
@@ -2567,7 +2567,7 @@ void ServerProcessHandler::handleResponse(osiSockAddr* responseFrom,
// mode
const int8 qosCode = payloadBuffer->getByte();
ServerChannelImpl::shared_pointer channel = static_pointer_cast<ServerChannelImpl>(casTransport->getChannel(sid));
ServerChannel::shared_pointer channel = static_pointer_cast<ServerChannel>(casTransport->getChannel(sid));
if (!channel.get())
{
BaseChannelRequester::sendFailureMessage((int8)CMD_PROCESS, transport, ioid, qosCode, BaseChannelRequester::badCIDStatus);
@@ -2626,14 +2626,14 @@ void ServerProcessHandler::handleResponse(osiSockAddr* responseFrom,
}
ServerChannelProcessRequesterImpl::ServerChannelProcessRequesterImpl(
ServerContextImpl::shared_pointer const & context, ServerChannelImpl::shared_pointer const & channel,
ServerContextImpl::shared_pointer const & context, ServerChannel::shared_pointer const & channel,
const pvAccessID ioid, Transport::shared_pointer const & transport):
BaseChannelRequester(context, channel, ioid, transport), _channelProcess()
{
}
ChannelProcessRequester::shared_pointer ServerChannelProcessRequesterImpl::create(
ServerContextImpl::shared_pointer const & context, ServerChannelImpl::shared_pointer const & channel,
ServerContextImpl::shared_pointer const & context, ServerChannel::shared_pointer const & channel,
const pvAccessID ioid, Transport::shared_pointer const & transport,PVStructure::shared_pointer const & pvRequest)
{
// TODO use std::make_shared
@@ -2744,7 +2744,7 @@ void ServerGetFieldHandler::handleResponse(osiSockAddr* responseFrom,
const pvAccessID sid = payloadBuffer->getInt();
const pvAccessID ioid = payloadBuffer->getInt();
ServerChannelImpl::shared_pointer channel = static_pointer_cast<ServerChannelImpl>(casTransport->getChannel(sid));
ServerChannel::shared_pointer channel = static_pointer_cast<ServerChannel>(casTransport->getChannel(sid));
if (!channel.get())
{
getFieldFailureResponse(transport, ioid, BaseChannelRequester::badCIDStatus);
@@ -2777,7 +2777,7 @@ void ServerGetFieldHandler::getFieldFailureResponse(Transport::shared_pointer co
}
ServerGetFieldRequesterImpl::ServerGetFieldRequesterImpl(
ServerContextImpl::shared_pointer const & context, ServerChannelImpl::shared_pointer const & channel,
ServerContextImpl::shared_pointer const & context, ServerChannel::shared_pointer const & channel,
const pvAccessID ioid, Transport::shared_pointer const & transport) :
BaseChannelRequester(context, channel, ioid, transport), _field()
{
@@ -2827,7 +2827,7 @@ void ServerRPCHandler::handleResponse(osiSockAddr* responseFrom,
// mode
const int8 qosCode = payloadBuffer->getByte();
ServerChannelImpl::shared_pointer channel = static_pointer_cast<ServerChannelImpl>(casTransport->getChannel(sid));
ServerChannel::shared_pointer channel = static_pointer_cast<ServerChannel>(casTransport->getChannel(sid));
if (!channel.get())
{
BaseChannelRequester::sendFailureMessage((int8)CMD_RPC, transport, ioid, qosCode, BaseChannelRequester::badCIDStatus);
@@ -2895,7 +2895,7 @@ void ServerRPCHandler::handleResponse(osiSockAddr* responseFrom,
}
ServerChannelRPCRequesterImpl::ServerChannelRPCRequesterImpl(
ServerContextImpl::shared_pointer const & context, ServerChannelImpl::shared_pointer const & channel,
ServerContextImpl::shared_pointer const & context, ServerChannel::shared_pointer const & channel,
const pvAccessID ioid, Transport::shared_pointer const & transport):
BaseChannelRequester(context, channel, ioid, transport),
_channelRPC(), _pvResponse()
@@ -2904,7 +2904,7 @@ ServerChannelRPCRequesterImpl::ServerChannelRPCRequesterImpl(
}
ChannelRPCRequester::shared_pointer ServerChannelRPCRequesterImpl::create(
ServerContextImpl::shared_pointer const & context, ServerChannelImpl::shared_pointer const & channel,
ServerContextImpl::shared_pointer const & context, ServerChannel::shared_pointer const & channel,
const pvAccessID ioid, Transport::shared_pointer const & transport, PVStructure::shared_pointer const & pvRequest)
{
// TODO use std::make_shared
+12 -17
View File
@@ -14,12 +14,12 @@ using namespace epics::pvData;
namespace epics {
namespace pvAccess {
size_t ServerChannelImpl::num_instances;
size_t ServerChannel::num_instances;
ServerChannelImpl::ServerChannelImpl(Channel::shared_pointer const & channel,
const ChannelRequester::shared_pointer &requester,
pvAccessID cid, pvAccessID sid,
ChannelSecuritySession::shared_pointer const & css):
ServerChannel::ServerChannel(Channel::shared_pointer const & channel,
const ChannelRequester::shared_pointer &requester,
pvAccessID cid, pvAccessID sid,
ChannelSecuritySession::shared_pointer const & css):
_channel(channel),
_requester(requester),
_cid(cid),
@@ -34,19 +34,14 @@ ServerChannelImpl::ServerChannelImpl(Channel::shared_pointer const & channel,
}
}
pvAccessID ServerChannelImpl::getSID() const
{
return _sid;
}
void ServerChannelImpl::registerRequest(const pvAccessID id, Destroyable::shared_pointer const & request)
void ServerChannel::registerRequest(const pvAccessID id, Destroyable::shared_pointer const & request)
{
Lock guard(_mutex);
if(_destroyed) throw std::logic_error("Can't registerRequest() for destory'd server channel");
_requests[id] = request;
}
void ServerChannelImpl::unregisterRequest(const pvAccessID id)
void ServerChannel::unregisterRequest(const pvAccessID id)
{
Lock guard(_mutex);
_requests_t::iterator iter = _requests.find(id);
@@ -56,7 +51,7 @@ void ServerChannelImpl::unregisterRequest(const pvAccessID id)
}
}
Destroyable::shared_pointer ServerChannelImpl::getRequest(const pvAccessID id)
Destroyable::shared_pointer ServerChannel::getRequest(const pvAccessID id)
{
Lock guard(_mutex);
_requests_t::iterator iter = _requests.find(id);
@@ -67,7 +62,7 @@ Destroyable::shared_pointer ServerChannelImpl::getRequest(const pvAccessID id)
return Destroyable::shared_pointer();
}
void ServerChannelImpl::destroy()
void ServerChannel::destroy()
{
Lock guard(_mutex);
@@ -96,18 +91,18 @@ void ServerChannelImpl::destroy()
_channel->destroy();
}
ServerChannelImpl::~ServerChannelImpl()
ServerChannel::~ServerChannel()
{
destroy();
REFTRACE_DECREMENT(num_instances);
}
void ServerChannelImpl::printInfo() const
void ServerChannel::printInfo() const
{
printInfo(stdout);
}
void ServerChannelImpl::printInfo(FILE *fd) const
void ServerChannel::printInfo(FILE *fd) const
{
fprintf(fd,"CLASS : %s\n", typeid(*this).name());
fprintf(fd,"CHANNEL : %s\n", typeid(*_channel).name());
+1 -1
View File
@@ -465,7 +465,7 @@ void ServerContextImpl::printInfo(ostream& str, int lvl)
for(channels_t::const_iterator it(channels.begin()), end(channels.end()); it!=end; ++it)
{
const ServerChannelImpl *channel(static_cast<const ServerChannelImpl*>(it->get()));
const ServerChannel *channel(static_cast<const ServerChannel*>(it->get()));
const Channel::shared_pointer& providerChan(channel->getChannel());
if(!providerChan)
continue;