Transport::getRemoteAddress() return reference
make it clear that result is always !NULL
This commit is contained in:
@ -585,7 +585,7 @@ void initializeUDPTransports(bool serverFlag,
|
||||
// to allow automatic assignment of listen port (for testing)
|
||||
if (listenPort == 0)
|
||||
{
|
||||
listenPort = ntohs(sendTransport->getRemoteAddress()->ia.sin_port);
|
||||
listenPort = ntohs(sendTransport->getRemoteAddress().ia.sin_port);
|
||||
LOG(logLevelDebug, "Dynamic listen UDP port set to %u.", (unsigned)listenPort);
|
||||
}
|
||||
|
||||
@ -699,7 +699,7 @@ void initializeUDPTransports(bool serverFlag,
|
||||
PVA_DEFAULT_PRIORITY);
|
||||
if (!transport)
|
||||
continue;
|
||||
listenLocalAddress = *transport->getRemoteAddress();
|
||||
listenLocalAddress = transport->getRemoteAddress();
|
||||
|
||||
transport->setIgnoredAddresses(ignoreAddressVector);
|
||||
|
||||
|
@ -64,8 +64,8 @@ public:
|
||||
return _closed.get();
|
||||
}
|
||||
|
||||
virtual const osiSockAddr* getRemoteAddress() const OVERRIDE FINAL {
|
||||
return &_remoteAddress;
|
||||
virtual const osiSockAddr& getRemoteAddress() const OVERRIDE FINAL {
|
||||
return _remoteAddress;
|
||||
}
|
||||
|
||||
virtual const std::string& getRemoteName() const OVERRIDE FINAL {
|
||||
|
@ -356,8 +356,8 @@ public:
|
||||
}
|
||||
|
||||
|
||||
virtual const osiSockAddr* getRemoteAddress() const OVERRIDE FINAL {
|
||||
return &_socketAddress;
|
||||
virtual const osiSockAddr& getRemoteAddress() const OVERRIDE FINAL {
|
||||
return _socketAddress;
|
||||
}
|
||||
|
||||
virtual const std::string& getRemoteName() const OVERRIDE FINAL {
|
||||
|
@ -187,11 +187,7 @@ public:
|
||||
*/
|
||||
virtual std::string getType() const = 0;
|
||||
|
||||
/**
|
||||
* Get remote address.
|
||||
* @return remote address, can never be null.
|
||||
*/
|
||||
virtual const osiSockAddr* getRemoteAddress() const = 0;
|
||||
virtual const osiSockAddr& getRemoteAddress() const = 0;
|
||||
|
||||
virtual const std::string& getRemoteName() const = 0;
|
||||
|
||||
|
@ -50,7 +50,7 @@ SimpleChannelSearchManagerImpl::create(Context::shared_pointer const & context)
|
||||
|
||||
SimpleChannelSearchManagerImpl::SimpleChannelSearchManagerImpl(Context::shared_pointer const & context) :
|
||||
m_context(context),
|
||||
m_responseAddress(*context->getSearchTransport()->getRemoteAddress()),
|
||||
m_responseAddress(context->getSearchTransport()->getRemoteAddress()),
|
||||
m_canceled(),
|
||||
m_sequenceNumber(0),
|
||||
m_sendBuffer(MAX_UDP_UNFRAGMENTED_SEND),
|
||||
|
@ -112,7 +112,7 @@ Transport::shared_pointer TransportRegistry::get(const osiSockAddr& address, epi
|
||||
|
||||
void TransportRegistry::install(const Transport::shared_pointer& ptr)
|
||||
{
|
||||
const Key key(*ptr->getRemoteAddress(), ptr->getPriority());
|
||||
const Key key(ptr->getRemoteAddress(), ptr->getPriority());
|
||||
|
||||
pvd::Lock G(_mutex);
|
||||
|
||||
|
@ -3663,11 +3663,11 @@ public:
|
||||
{
|
||||
// GUID check case: same server listening on different NIF
|
||||
|
||||
if (!sockAddrAreIdentical(transport->getRemoteAddress(), serverAddress) &&
|
||||
if (!sockAddrAreIdentical(&transport->getRemoteAddress(), serverAddress) &&
|
||||
!std::equal(guid.value, guid.value + 12, m_guid.value))
|
||||
{
|
||||
EXCEPTION_GUARD3(m_requester, req, req->message("More than one channel with name '" + m_name +
|
||||
"' detected, connected to: " + inetAddressToString(*transport->getRemoteAddress()) + ", ignored: " + inetAddressToString(*serverAddress), warningMessage));
|
||||
"' detected, connected to: " + inetAddressToString(transport->getRemoteAddress()) + ", ignored: " + inetAddressToString(*serverAddress), warningMessage));
|
||||
}
|
||||
|
||||
// do not pass (create transports) with we already have one
|
||||
|
@ -719,7 +719,7 @@ void ServerCreateChannelHandler::handleResponse(osiSockAddr* responseFrom,
|
||||
{
|
||||
|
||||
char host[100];
|
||||
sockAddrToDottedIP(&transport->getRemoteAddress()->sa,host,100);
|
||||
sockAddrToDottedIP(&transport->getRemoteAddress().sa,host,100);
|
||||
LOG(logLevelDebug,"Zero length channel name, disconnecting client: %s", host);
|
||||
disconnect(transport);
|
||||
return;
|
||||
@ -727,7 +727,7 @@ void ServerCreateChannelHandler::handleResponse(osiSockAddr* responseFrom,
|
||||
else if (channelName.size() > MAX_CHANNEL_NAME_LENGTH)
|
||||
{
|
||||
char host[100];
|
||||
sockAddrToDottedIP(&transport->getRemoteAddress()->sa,host,100);
|
||||
sockAddrToDottedIP(&transport->getRemoteAddress().sa,host,100);
|
||||
LOG(logLevelDebug,"Unreasonable channel name length, disconnecting client: %s", host);
|
||||
disconnect(transport);
|
||||
return;
|
||||
|
@ -355,8 +355,8 @@ public:
|
||||
return std::string("TCP");
|
||||
}
|
||||
|
||||
const osiSockAddr* getRemoteAddress() const {
|
||||
return &dummyAddr;
|
||||
const osiSockAddr& getRemoteAddress() const {
|
||||
return dummyAddr;
|
||||
}
|
||||
std::string dummyRemoteName;
|
||||
const std::string& getRemoteName() const {
|
||||
|
Reference in New Issue
Block a user