summaryrefslogtreecommitdiff
path: root/cpp
diff options
context:
space:
mode:
authorDwayne Boone <dwayne@zeroc.com>2009-05-01 12:43:38 -0230
committerDwayne Boone <dwayne@zeroc.com>2009-05-01 12:43:38 -0230
commitc80bbef52c82989b48570f4449831b7017917982 (patch)
tree963493c6dafe1ff47310d0f7f58420b2a64ae522 /cpp
parentBug 3459 - add rewind/reset to InputStream/OutputStream (diff)
downloadice-c80bbef52c82989b48570f4449831b7017917982.tar.bz2
ice-c80bbef52c82989b48570f4449831b7017917982.tar.xz
ice-c80bbef52c82989b48570f4449831b7017917982.zip
Bug 3972 - improve server network tracing
Diffstat (limited to 'cpp')
-rw-r--r--cpp/src/Ice/Network.cpp4
-rw-r--r--cpp/src/Ice/Network.h2
-rw-r--r--cpp/src/Ice/ObjectAdapterI.cpp50
-rw-r--r--cpp/src/Ice/TcpAcceptor.cpp18
-rw-r--r--cpp/src/Ice/TcpEndpointI.cpp2
-rw-r--r--cpp/src/Ice/UdpEndpointI.cpp2
-rw-r--r--cpp/src/Ice/UdpTransceiver.cpp19
-rw-r--r--cpp/src/Ice/UdpTransceiver.h2
-rw-r--r--cpp/src/IceSSL/AcceptorI.cpp20
-rw-r--r--cpp/src/IceSSL/EndpointI.cpp2
10 files changed, 97 insertions, 24 deletions
diff --git a/cpp/src/Ice/Network.cpp b/cpp/src/Ice/Network.cpp
index c6fbf1bc6ee..b630cf3e85a 100644
--- a/cpp/src/Ice/Network.cpp
+++ b/cpp/src/Ice/Network.cpp
@@ -1768,7 +1768,7 @@ IceInternal::setPort(struct sockaddr_storage& addr, int port)
}
vector<string>
-IceInternal::getHostsForEndpointExpand(const string& host, ProtocolSupport protocolSupport)
+IceInternal::getHostsForEndpointExpand(const string& host, ProtocolSupport protocolSupport, bool includeLoopback)
{
vector<string> hosts;
if(host.empty() || isWildcard(host, protocolSupport))
@@ -1787,7 +1787,7 @@ IceInternal::getHostsForEndpointExpand(const string& host, ProtocolSupport proto
}
}
- if(hosts.empty())
+ if(hosts.empty() || includeLoopback)
{
if(protocolSupport != EnableIPv6)
{
diff --git a/cpp/src/Ice/Network.h b/cpp/src/Ice/Network.h
index de89c2443fc..a12948e35b5 100644
--- a/cpp/src/Ice/Network.h
+++ b/cpp/src/Ice/Network.h
@@ -123,7 +123,7 @@ ICE_API bool isMulticast(const struct sockaddr_storage&);
ICE_API int getPort(const struct sockaddr_storage&);
ICE_API void setPort(struct sockaddr_storage&, int);
-ICE_API std::vector<std::string> getHostsForEndpointExpand(const std::string&, ProtocolSupport);
+ICE_API std::vector<std::string> getHostsForEndpointExpand(const std::string&, ProtocolSupport, bool);
ICE_API void setTcpBufSize(SOCKET, const Ice::PropertiesPtr&, const Ice::LoggerPtr&);
ICE_API int getSocketErrno();
diff --git a/cpp/src/Ice/ObjectAdapterI.cpp b/cpp/src/Ice/ObjectAdapterI.cpp
index 4c9c9246c1d..a9704afc3e9 100644
--- a/cpp/src/Ice/ObjectAdapterI.cpp
+++ b/cpp/src/Ice/ObjectAdapterI.cpp
@@ -1119,29 +1119,43 @@ ObjectAdapterI::parsePublishedEndpoints()
//
string endpts = _communicator->getProperties()->getProperty(_name + ".PublishedEndpoints");
vector<EndpointIPtr> endpoints = parseEndpoints(endpts, false);
- if(!endpoints.empty())
+ if(endpoints.empty())
{
- return endpoints;
+ //
+ // If the PublishedEndpoints property isn't set, we compute the published enpdoints
+ // from the OA endpoints.
+ //
+ transform(_incomingConnectionFactories.begin(), _incomingConnectionFactories.end(),
+ back_inserter(endpoints), Ice::constMemFun(&IncomingConnectionFactory::endpoint));
+
+ //
+ // Expand any endpoints that may be listening on INADDR_ANY to include actual
+ // addresses in the published endpoints.
+ //
+ vector<EndpointIPtr> expandedEndpoints;
+ for(unsigned int i = 0; i < endpoints.size(); ++i)
+ {
+ vector<EndpointIPtr> endps = endpoints[i]->expand();
+ expandedEndpoints.insert(expandedEndpoints.end(), endps.begin(), endps.end());
+ }
+ endpoints = expandedEndpoints;
}
- //
- // If the PublishedEndpoints property isn't set, we compute the published enpdoints
- // from the OA endpoints.
- //
- transform(_incomingConnectionFactories.begin(), _incomingConnectionFactories.end(),
- back_inserter(endpoints), Ice::constMemFun(&IncomingConnectionFactory::endpoint));
-
- //
- // Expand any endpoints that may be listening on INADDR_ANY to include actual
- // addresses in the published endpoints.
- //
- vector<EndpointIPtr> expandedEndpoints;
- for(unsigned int i = 0; i < endpoints.size(); ++i)
+ if(_instance->traceLevels()->network >= 3)
{
- vector<EndpointIPtr> endps = endpoints[i]->expand();
- expandedEndpoints.insert(expandedEndpoints.end(), endps.begin(), endps.end());
+ Trace out(_instance->initializationData().logger, _instance->traceLevels()->networkCat);
+ out << "published endpoints for object adapter \`" << getName() << "\':\n";
+ for(unsigned int i = 0; i < endpoints.size(); ++i)
+ {
+ if(i > 0)
+ {
+ out << ":";
+ }
+ out << endpoints[i]->toString();
+ }
}
- return expandedEndpoints;
+
+ return endpoints;
}
void
diff --git a/cpp/src/Ice/TcpAcceptor.cpp b/cpp/src/Ice/TcpAcceptor.cpp
index 177cf270339..d2c4778069b 100644
--- a/cpp/src/Ice/TcpAcceptor.cpp
+++ b/cpp/src/Ice/TcpAcceptor.cpp
@@ -57,6 +57,24 @@ IceInternal::TcpAcceptor::listen()
{
Trace out(_logger, _traceLevels->networkCat);
out << "accepting tcp connections at " << toString();
+
+ if(_traceLevels->network >= 3)
+ {
+ vector<string> interfaces =
+ getHostsForEndpointExpand(inetAddrToString(_addr), _instance->protocolSupport(), true);
+ if(!interfaces.empty())
+ {
+ out << "\nlocal interfaces: ";
+ for(unsigned int i = 0; i < interfaces.size(); ++i)
+ {
+ if(i != 0)
+ {
+ out << ", ";
+ }
+ out << interfaces[i];
+ }
+ }
+ }
}
}
diff --git a/cpp/src/Ice/TcpEndpointI.cpp b/cpp/src/Ice/TcpEndpointI.cpp
index f4aecd7a79b..dea212ecde6 100644
--- a/cpp/src/Ice/TcpEndpointI.cpp
+++ b/cpp/src/Ice/TcpEndpointI.cpp
@@ -333,7 +333,7 @@ vector<EndpointIPtr>
IceInternal::TcpEndpointI::expand() const
{
vector<EndpointIPtr> endps;
- vector<string> hosts = getHostsForEndpointExpand(_host, _instance->protocolSupport());
+ vector<string> hosts = getHostsForEndpointExpand(_host, _instance->protocolSupport(), false);
if(hosts.empty())
{
endps.push_back(const_cast<TcpEndpointI*>(this));
diff --git a/cpp/src/Ice/UdpEndpointI.cpp b/cpp/src/Ice/UdpEndpointI.cpp
index 4f25331ac2c..6a9d78ac172 100644
--- a/cpp/src/Ice/UdpEndpointI.cpp
+++ b/cpp/src/Ice/UdpEndpointI.cpp
@@ -535,7 +535,7 @@ vector<EndpointIPtr>
IceInternal::UdpEndpointI::expand() const
{
vector<EndpointIPtr> endps;
- vector<string> hosts = getHostsForEndpointExpand(_host, _instance->protocolSupport());
+ vector<string> hosts = getHostsForEndpointExpand(_host, _instance->protocolSupport(), false);
if(hosts.empty())
{
endps.push_back(const_cast<UdpEndpointI*>(this));
diff --git a/cpp/src/Ice/UdpTransceiver.cpp b/cpp/src/Ice/UdpTransceiver.cpp
index 7df567b654e..79475ff8f71 100644
--- a/cpp/src/Ice/UdpTransceiver.cpp
+++ b/cpp/src/Ice/UdpTransceiver.cpp
@@ -291,6 +291,7 @@ IceInternal::UdpTransceiver::UdpTransceiver(const InstancePtr& instance, const s
_traceLevels(instance->traceLevels()),
_logger(instance->initializationData().logger),
_stats(instance->initializationData().stats),
+ _protocolSupport(instance->protocolSupport()),
_incoming(false),
_addr(addr),
_connect(true),
@@ -334,6 +335,7 @@ IceInternal::UdpTransceiver::UdpTransceiver(const InstancePtr& instance, const s
_traceLevels(instance->traceLevels()),
_logger(instance->initializationData().logger),
_stats(instance->initializationData().stats),
+ _protocolSupport(instance->protocolSupport()),
_incoming(true),
_addr(getAddressForServer(host, port, instance->protocolSupport())),
_connect(connect),
@@ -399,6 +401,23 @@ IceInternal::UdpTransceiver::UdpTransceiver(const InstancePtr& instance, const s
{
Trace out(_logger, _traceLevels->networkCat);
out << "starting to receive udp packets\n" << toString();
+
+ if(_traceLevels->network >= 3)
+ {
+ vector<string> interfaces = getHostsForEndpointExpand(inetAddrToString(_addr), _protocolSupport, true);
+ if(!interfaces.empty())
+ {
+ out << "\nlocal interfaces: ";
+ for(unsigned int i = 0; i < interfaces.size(); ++i)
+ {
+ if(i != 0)
+ {
+ out << ", ";
+ }
+ out << interfaces[i];
+ }
+ }
+ }
}
}
catch(...)
diff --git a/cpp/src/Ice/UdpTransceiver.h b/cpp/src/Ice/UdpTransceiver.h
index 8e546730140..6aa5e5332b9 100644
--- a/cpp/src/Ice/UdpTransceiver.h
+++ b/cpp/src/Ice/UdpTransceiver.h
@@ -19,6 +19,7 @@
#include <Ice/LoggerF.h>
#include <Ice/StatsF.h>
#include <Ice/Transceiver.h>
+#include <Ice/Protocol.h>
#include <IceUtil/Mutex.h>
#ifndef _WIN32
@@ -61,6 +62,7 @@ private:
const TraceLevelsPtr _traceLevels;
const Ice::LoggerPtr _logger;
const Ice::StatsPtr _stats;
+ const ProtocolSupport _protocolSupport;
const bool _incoming;
const struct sockaddr_storage _addr;
struct sockaddr_storage _mcastAddr;
diff --git a/cpp/src/IceSSL/AcceptorI.cpp b/cpp/src/IceSSL/AcceptorI.cpp
index 0b52afd93fe..c939ba626db 100644
--- a/cpp/src/IceSSL/AcceptorI.cpp
+++ b/cpp/src/IceSSL/AcceptorI.cpp
@@ -60,6 +60,26 @@ IceSSL::AcceptorI::listen()
{
Trace out(_logger, _instance->networkTraceCategory());
out << "accepting ssl connections at " << toString();
+
+ if(_instance->networkTraceLevel() >= 3)
+ {
+ vector<string> interfaces =
+ IceInternal::getHostsForEndpointExpand(IceInternal::inetAddrToString(_addr),
+ _instance->protocolSupport(), true);
+ if(!interfaces.empty())
+ {
+ out << "\nlocal interfaces: ";
+ for(unsigned int i = 0; i < interfaces.size(); ++i)
+ {
+ if(i != 0)
+ {
+ out << ", ";
+ }
+ out << interfaces[i];
+ }
+ }
+ }
+
}
}
diff --git a/cpp/src/IceSSL/EndpointI.cpp b/cpp/src/IceSSL/EndpointI.cpp
index fcf37b58515..f136ae91c43 100644
--- a/cpp/src/IceSSL/EndpointI.cpp
+++ b/cpp/src/IceSSL/EndpointI.cpp
@@ -332,7 +332,7 @@ vector<IceInternal::EndpointIPtr>
IceSSL::EndpointI::expand() const
{
vector<IceInternal::EndpointIPtr> endps;
- vector<string> hosts = IceInternal::getHostsForEndpointExpand(_host, _instance->protocolSupport());
+ vector<string> hosts = IceInternal::getHostsForEndpointExpand(_host, _instance->protocolSupport(), false);
if(hosts.empty())
{
endps.push_back(const_cast<EndpointI*>(this));