mirror of
https://github.com/FairRootGroup/FairMQ.git
synced 2025-10-17 10:31:46 +00:00
Remove set/get timeout from general socket interface
This commit is contained in:
committed by
Dennis Klein
parent
e090967645
commit
cfb727181f
@@ -423,112 +423,6 @@ unsigned long FairMQSocketZMQ::GetMessagesRx() const
|
||||
return fMessagesRx;
|
||||
}
|
||||
|
||||
bool FairMQSocketZMQ::SetSendTimeout(const int timeout, const string& address, const string& method)
|
||||
{
|
||||
fSndTimeout = timeout;
|
||||
if (method == "bind")
|
||||
{
|
||||
if (zmq_unbind(fSocket, address.c_str()) != 0)
|
||||
{
|
||||
LOG(error) << "Failed unbinding socket " << fId << ", reason: " << zmq_strerror(errno);
|
||||
return false;
|
||||
}
|
||||
if (zmq_setsockopt(fSocket, ZMQ_SNDTIMEO, &fSndTimeout, sizeof(fSndTimeout)) != 0)
|
||||
{
|
||||
LOG(error) << "Failed setting option on socket " << fId << ", reason: " << zmq_strerror(errno);
|
||||
return false;
|
||||
}
|
||||
if (zmq_bind(fSocket, address.c_str()) != 0)
|
||||
{
|
||||
LOG(error) << "Failed binding socket " << fId << ", reason: " << zmq_strerror(errno);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if (method == "connect")
|
||||
{
|
||||
if (zmq_disconnect(fSocket, address.c_str()) != 0)
|
||||
{
|
||||
LOG(error) << "Failed disconnecting socket " << fId << ", reason: " << zmq_strerror(errno);
|
||||
return false;
|
||||
}
|
||||
if (zmq_setsockopt(fSocket, ZMQ_SNDTIMEO, &fSndTimeout, sizeof(fSndTimeout)) != 0)
|
||||
{
|
||||
LOG(error) << "Failed setting option on socket " << fId << ", reason: " << zmq_strerror(errno);
|
||||
return false;
|
||||
}
|
||||
if (zmq_connect(fSocket, address.c_str()) != 0)
|
||||
{
|
||||
LOG(error) << "Failed connecting socket " << fId << ", reason: " << zmq_strerror(errno);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG(error) << "timeout failed - unknown method provided!";
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
int FairMQSocketZMQ::GetSendTimeout() const
|
||||
{
|
||||
return fSndTimeout;
|
||||
}
|
||||
|
||||
bool FairMQSocketZMQ::SetReceiveTimeout(const int timeout, const string& address, const string& method)
|
||||
{
|
||||
fRcvTimeout = timeout;
|
||||
if (method == "bind")
|
||||
{
|
||||
if (zmq_unbind(fSocket, address.c_str()) != 0)
|
||||
{
|
||||
LOG(error) << "Failed unbinding socket " << fId << ", reason: " << zmq_strerror(errno);
|
||||
return false;
|
||||
}
|
||||
if (zmq_setsockopt(fSocket, ZMQ_RCVTIMEO, &fRcvTimeout, sizeof(fRcvTimeout)) != 0)
|
||||
{
|
||||
LOG(error) << "Failed setting option on socket " << fId << ", reason: " << zmq_strerror(errno);
|
||||
return false;
|
||||
}
|
||||
if (zmq_bind(fSocket, address.c_str()) != 0)
|
||||
{
|
||||
LOG(error) << "Failed binding socket " << fId << ", reason: " << zmq_strerror(errno);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if (method == "connect")
|
||||
{
|
||||
if (zmq_disconnect(fSocket, address.c_str()) != 0)
|
||||
{
|
||||
LOG(error) << "Failed disconnecting socket " << fId << ", reason: " << zmq_strerror(errno);
|
||||
return false;
|
||||
}
|
||||
if (zmq_setsockopt(fSocket, ZMQ_RCVTIMEO, &fRcvTimeout, sizeof(fRcvTimeout)) != 0)
|
||||
{
|
||||
LOG(error) << "Failed setting option on socket " << fId << ", reason: " << zmq_strerror(errno);
|
||||
return false;
|
||||
}
|
||||
if (zmq_connect(fSocket, address.c_str()) != 0)
|
||||
{
|
||||
LOG(error) << "Failed connecting socket " << fId << ", reason: " << zmq_strerror(errno);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG(error) << "timeout failed - unknown method provided!";
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
int FairMQSocketZMQ::GetReceiveTimeout() const
|
||||
{
|
||||
return fRcvTimeout;
|
||||
}
|
||||
|
||||
int FairMQSocketZMQ::GetConstant(const string& constant)
|
||||
{
|
||||
if (constant == "") return 0;
|
||||
|
@@ -54,11 +54,6 @@ class FairMQSocketZMQ : public FairMQSocket
|
||||
unsigned long GetMessagesTx() const override;
|
||||
unsigned long GetMessagesRx() const override;
|
||||
|
||||
bool SetSendTimeout(const int timeout, const std::string& address, const std::string& method) override;
|
||||
int GetSendTimeout() const override;
|
||||
bool SetReceiveTimeout(const int timeout, const std::string& address, const std::string& method) override;
|
||||
int GetReceiveTimeout() const override;
|
||||
|
||||
static int GetConstant(const std::string& constant);
|
||||
|
||||
~FairMQSocketZMQ() override;
|
||||
|
Reference in New Issue
Block a user