Commit 646859a5 authored by legoc's avatar legoc
Browse files

Added cerr to understand null sockets

parent d5f50f31
...@@ -29,12 +29,16 @@ namespace cameo { ...@@ -29,12 +29,16 @@ namespace cameo {
RequestSocketImpl::RequestSocketImpl(ServicesImpl * services, const std::string& endpoint, int timeout) : RequestSocketImpl::RequestSocketImpl(ServicesImpl * services, const std::string& endpoint, int timeout) :
m_services(services), m_endpoint(endpoint) { m_services(services), m_endpoint(endpoint) {
cerr << this << " new RequestSocketImpl" << endl;
init(); init();
setTimeout(timeout); setTimeout(timeout);
} }
RequestSocketImpl::~RequestSocketImpl() { RequestSocketImpl::~RequestSocketImpl() {
cerr << this << " ~RequestSocketImpl" << endl;
} }
void RequestSocketImpl::setTimeout(int timeout) { void RequestSocketImpl::setTimeout(int timeout) {
...@@ -62,6 +66,10 @@ void RequestSocketImpl::init() { ...@@ -62,6 +66,10 @@ void RequestSocketImpl::init() {
if (m_socket.get() == nullptr) { if (m_socket.get() == nullptr) {
m_socket.reset(m_services->createRequestSocket(m_endpoint)); m_socket.reset(m_services->createRequestSocket(m_endpoint));
if (m_socket.get() == nullptr) {
cerr << this << " RequestSocketImpl::init null" << endl;
}
// Apply the linger to the socket. // Apply the linger to the socket.
setSocketLinger(); setSocketLinger();
} }
...@@ -69,6 +77,8 @@ void RequestSocketImpl::init() { ...@@ -69,6 +77,8 @@ void RequestSocketImpl::init() {
void RequestSocketImpl::reset() { void RequestSocketImpl::reset() {
m_socket.reset(); m_socket.reset();
cerr << this << " RequestSocketImpl::reset" << endl;
} }
std::unique_ptr<zmq::message_t> RequestSocketImpl::request(const std::string& requestTypePart, const std::string& requestDataPart, int overrideTimeout) { std::unique_ptr<zmq::message_t> RequestSocketImpl::request(const std::string& requestTypePart, const std::string& requestDataPart, int overrideTimeout) {
......
...@@ -255,13 +255,22 @@ zmq::socket_t * ServicesImpl::createRequestSocket(const std::string& endpoint) { ...@@ -255,13 +255,22 @@ zmq::socket_t * ServicesImpl::createRequestSocket(const std::string& endpoint) {
zmq::socket_t* socket = new zmq::socket_t(m_context, ZMQ_REQ); zmq::socket_t* socket = new zmq::socket_t(m_context, ZMQ_REQ);
if (socket == nullptr) {
cerr << "createRequestSocket null" << endl;
}
try { try {
// Connect to the endpoint. // Connect to the endpoint.
socket->connect(endpoint.c_str()); socket->connect(endpoint.c_str());
} }
catch (exception const & e) { catch (exception const & e) {
cerr << "createRequestSocket exception : " << e.what() << endl;
throw SocketException(e.what()); throw SocketException(e.what());
} }
catch (...) {
cerr << "createRequestSocket unexpected exception" << endl;
throw;
}
return socket; return socket;
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment