Commit 56796d2f authored by legoc's avatar legoc
Browse files

More traces

parent 646859a5
...@@ -61,7 +61,7 @@ Server::Server(const std::string& endpoint, int timeoutMs) : ...@@ -61,7 +61,7 @@ Server::Server(const std::string& endpoint, int timeoutMs) :
m_eventThread->start(); m_eventThread->start();
} }
catch (...) { catch (...) {
// ... cerr << "Error while opening event stream" << endl;
} }
} }
......
...@@ -49,6 +49,9 @@ void RequestSocketImpl::setTimeout(int timeout) { ...@@ -49,6 +49,9 @@ void RequestSocketImpl::setTimeout(int timeout) {
} }
void RequestSocketImpl::setSocketLinger() { void RequestSocketImpl::setSocketLinger() {
cerr << this << " RequestSocketImpl::setSocketLinger " << m_socket.get() << endl;
// Set the linger in case of timeout. // Set the linger in case of timeout.
// If not, the context can block indefinitely. // If not, the context can block indefinitely.
// Does the value 100 can lead to a side-effect? A too small value like 1 has some side-effect. // Does the value 100 can lead to a side-effect? A too small value like 1 has some side-effect.
...@@ -62,27 +65,37 @@ void RequestSocketImpl::setSocketLinger() { ...@@ -62,27 +65,37 @@ void RequestSocketImpl::setSocketLinger() {
void RequestSocketImpl::init() { void RequestSocketImpl::init() {
cerr << this << " RequestSocketImpl::init" << endl;
// Reset if the socket is null. // Reset if the socket is null.
if (m_socket.get() == nullptr) { if (m_socket.get() == nullptr) {
cerr << this << " RequestSocketImpl::init null" << endl;
m_socket.reset(m_services->createRequestSocket(m_endpoint)); m_socket.reset(m_services->createRequestSocket(m_endpoint));
if (m_socket.get() == nullptr) { if (m_socket.get() == nullptr) {
cerr << this << " RequestSocketImpl::init null" << endl; cerr << this << " RequestSocketImpl::init still null" << endl;
} }
// Apply the linger to the socket. // Apply the linger to the socket.
setSocketLinger(); setSocketLinger();
} }
else {
cerr << this << " RequestSocketImpl::init already done" << endl;
}
} }
void RequestSocketImpl::reset() { void RequestSocketImpl::reset() {
m_socket.reset(); m_socket.reset();
cerr << this << " RequestSocketImpl::reset" << endl; cerr << this << " RequestSocketImpl::reset " << m_socket.get() << 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) {
cerr << this << " RequestSocketImpl::request" << endl;
// Init if not already done or if a timeout occurred. // Init if not already done or if a timeout occurred.
init(); init();
...@@ -117,6 +130,9 @@ std::unique_ptr<zmq::message_t> RequestSocketImpl::request(const std::string& re ...@@ -117,6 +130,9 @@ std::unique_ptr<zmq::message_t> RequestSocketImpl::request(const std::string& re
int rc = zmq::poll(items, 1, timeout); int rc = zmq::poll(items, 1, timeout);
if (rc == 0) { if (rc == 0) {
cerr << this << " RequestSocketImpl::request timeout" << endl;
// Reset the socket. It is necessary if a new request is done. // Reset the socket. It is necessary if a new request is done.
reset(); reset();
......
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