diff --git a/fairmq/FairMQSocket.h b/fairmq/FairMQSocket.h index f2b2f33ef..2fe013dc1 100644 --- a/fairmq/FairMQSocket.h +++ b/fairmq/FairMQSocket.h @@ -48,11 +48,6 @@ class FairMQSocket virtual unsigned long GetMessagesTx() const = 0; virtual unsigned long GetMessagesRx() const = 0; - virtual bool SetSendTimeout(const int timeout, const std::string& address, const std::string& method) = 0; - virtual int GetSendTimeout() const = 0; - virtual bool SetReceiveTimeout(const int timeout, const std::string& address, const std::string& method) = 0; - virtual int GetReceiveTimeout() const = 0; - virtual ~FairMQSocket() {}; }; diff --git a/fairmq/nanomsg/FairMQSocketNN.cxx b/fairmq/nanomsg/FairMQSocketNN.cxx index 3a5a92c1a..451ff5040 100644 --- a/fairmq/nanomsg/FairMQSocketNN.cxx +++ b/fairmq/nanomsg/FairMQSocketNN.cxx @@ -492,40 +492,6 @@ unsigned long FairMQSocketNN::GetMessagesRx() const return fMessagesRx; } -bool FairMQSocketNN::SetSendTimeout(const int timeout, const string& /*address*/, const string& /*method*/) -{ - fSndTimeout = timeout; - if (nn_setsockopt(fSocket, NN_SOL_SOCKET, NN_SNDTIMEO, &fSndTimeout, sizeof(fSndTimeout)) != 0) - { - LOG(error) << "Failed setting option 'send timeout' on socket " << fId << ", reason: " << nn_strerror(errno); - return false; - } - - return true; -} - -int FairMQSocketNN::GetSendTimeout() const -{ - return fSndTimeout; -} - -bool FairMQSocketNN::SetReceiveTimeout(const int timeout, const string& /*address*/, const string& /*method*/) -{ - fRcvTimeout = timeout; - if (nn_setsockopt(fSocket, NN_SOL_SOCKET, NN_RCVTIMEO, &fRcvTimeout, sizeof(fRcvTimeout)) != 0) - { - LOG(error) << "Failed setting option 'receive timeout' on socket " << fId << ", reason: " << nn_strerror(errno); - return false; - } - - return true; -} - -int FairMQSocketNN::GetReceiveTimeout() const -{ - return fRcvTimeout; -} - int FairMQSocketNN::GetConstant(const string& constant) { if (constant == "") diff --git a/fairmq/nanomsg/FairMQSocketNN.h b/fairmq/nanomsg/FairMQSocketNN.h index 632cf460a..06e0bff37 100644 --- a/fairmq/nanomsg/FairMQSocketNN.h +++ b/fairmq/nanomsg/FairMQSocketNN.h @@ -53,11 +53,6 @@ class FairMQSocketNN : 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); ~FairMQSocketNN() override; diff --git a/fairmq/ofi/Socket.cxx b/fairmq/ofi/Socket.cxx index da029e20b..5405319dd 100644 --- a/fairmq/ofi/Socket.cxx +++ b/fairmq/ofi/Socket.cxx @@ -619,116 +619,6 @@ auto Socket::GetOption(const string& option, void* value, size_t* valueSize) -> } } -auto Socket::SetSendTimeout(const int timeout, const string& address, const string& method) -> bool -{ - throw SocketError{"Not yet implemented."}; - // 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; -} - -auto Socket::GetSendTimeout() const -> int -{ - throw SocketError{"Not yet implemented."}; - // return fSndTimeout; -} - -auto Socket::SetReceiveTimeout(const int timeout, const string& address, const string& method) -> bool -{ - throw SocketError{"Not yet implemented."}; - // 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; -} - -auto Socket::GetReceiveTimeout() const -> int -{ - throw SocketError{"Not yet implemented."}; - // return fRcvTimeout; -} - auto Socket::GetConstant(const string& constant) -> int { if (constant == "") diff --git a/fairmq/ofi/Socket.h b/fairmq/ofi/Socket.h index 156175318..3952a5062 100644 --- a/fairmq/ofi/Socket.h +++ b/fairmq/ofi/Socket.h @@ -67,11 +67,6 @@ class Socket : public fair::mq::Socket auto GetMessagesTx() const -> unsigned long override { return fMessagesTx; } auto GetMessagesRx() const -> unsigned long override { return fMessagesRx; } - auto SetSendTimeout(const int timeout, const std::string& address, const std::string& method) -> bool override; - auto GetSendTimeout() const -> int override; - auto SetReceiveTimeout(const int timeout, const std::string& address, const std::string& method) -> bool override; - auto GetReceiveTimeout() const -> int override; - static auto GetConstant(const std::string& constant) -> int; ~Socket() override; diff --git a/fairmq/shmem/FairMQSocketSHM.cxx b/fairmq/shmem/FairMQSocketSHM.cxx index 2c24a27b7..bb80b79ae 100644 --- a/fairmq/shmem/FairMQSocketSHM.cxx +++ b/fairmq/shmem/FairMQSocketSHM.cxx @@ -497,112 +497,6 @@ unsigned long FairMQSocketSHM::GetMessagesRx() const return fMessagesRx; } -bool FairMQSocketSHM::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 FairMQSocketSHM::GetSendTimeout() const -{ - return fSndTimeout; -} - -bool FairMQSocketSHM::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 FairMQSocketSHM::GetReceiveTimeout() const -{ - return fRcvTimeout; -} - int FairMQSocketSHM::GetConstant(const string& constant) { if (constant == "") return 0; diff --git a/fairmq/shmem/FairMQSocketSHM.h b/fairmq/shmem/FairMQSocketSHM.h index 5e6a888c5..68742cda2 100644 --- a/fairmq/shmem/FairMQSocketSHM.h +++ b/fairmq/shmem/FairMQSocketSHM.h @@ -54,11 +54,6 @@ class FairMQSocketSHM : 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); ~FairMQSocketSHM() override; diff --git a/fairmq/zeromq/FairMQSocketZMQ.cxx b/fairmq/zeromq/FairMQSocketZMQ.cxx index 121a12cf1..6a0d92093 100644 --- a/fairmq/zeromq/FairMQSocketZMQ.cxx +++ b/fairmq/zeromq/FairMQSocketZMQ.cxx @@ -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; diff --git a/fairmq/zeromq/FairMQSocketZMQ.h b/fairmq/zeromq/FairMQSocketZMQ.h index 66ad24d1e..0a1be10cf 100644 --- a/fairmq/zeromq/FairMQSocketZMQ.h +++ b/fairmq/zeromq/FairMQSocketZMQ.h @@ -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;