summaryrefslogtreecommitdiff
path: root/cpp/src/Ice/TcpConnector.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/src/Ice/TcpConnector.cpp')
-rw-r--r--cpp/src/Ice/TcpConnector.cpp28
1 files changed, 20 insertions, 8 deletions
diff --git a/cpp/src/Ice/TcpConnector.cpp b/cpp/src/Ice/TcpConnector.cpp
index eadb705f8e8..956907ad2c6 100644
--- a/cpp/src/Ice/TcpConnector.cpp
+++ b/cpp/src/Ice/TcpConnector.cpp
@@ -29,19 +29,31 @@ IceInternal::TcpConnector::connect(int timeout)
out << "trying to establish tcp connection to " << toString();
}
- SOCKET fd = createSocket(false, _addr.ss_family);
- setBlock(fd, false);
- setTcpBufSize(fd, _instance->initializationData().properties, _logger);
- bool connected = doConnect(fd, _addr, timeout);
- if(connected)
+ try
{
- if(_traceLevels->network >= 1)
+ SOCKET fd = createSocket(false, _addr.ss_family);
+ setBlock(fd, false);
+ setTcpBufSize(fd, _instance->initializationData().properties, _logger);
+ bool connected = doConnect(fd, _addr, timeout);
+ if(connected)
+ {
+ if(_traceLevels->network >= 1)
+ {
+ Trace out(_logger, _traceLevels->networkCat);
+ out << "tcp connection established\n" << fdToString(fd);
+ }
+ }
+ return new TcpTransceiver(_instance, fd, connected);
+ }
+ catch(const Ice::LocalException& ex)
+ {
+ if(_traceLevels->network >= 2)
{
Trace out(_logger, _traceLevels->networkCat);
- out << "tcp connection established\n" << fdToString(fd);
+ out << "failed to establish tcp connection to " << toString() << "\n" << ex;
}
+ throw;
}
- return new TcpTransceiver(_instance, fd, connected);
}
Short