diff --git a/fairmq/Socket.h b/fairmq/Socket.h index 3989d02b..b115c835 100644 --- a/fairmq/Socket.h +++ b/fairmq/Socket.h @@ -57,9 +57,6 @@ struct Socket virtual int64_t Send(Parts& parts, int timeout = -1) { return Send(parts.fParts, timeout); } virtual int64_t Receive(Parts& parts, int timeout = -1) { return Receive(parts.fParts, timeout); } - [[deprecated("Use Socket::~Socket() instead.")]] - virtual void Close() = 0; - virtual void SetOption(const std::string& option, const void* value, size_t valueSize) = 0; virtual void GetOption(const std::string& option, void* value, size_t* valueSize) = 0; diff --git a/fairmq/shmem/Socket.h b/fairmq/shmem/Socket.h index 639fb670..392cbc3f 100644 --- a/fairmq/shmem/Socket.h +++ b/fairmq/shmem/Socket.h @@ -319,23 +319,6 @@ class Socket final : public fair::mq::Socket void* GetSocket() const { return fSocket; } - void Close() override - { - // LOG(debug) << "Closing socket " << fId; - - if (fSocket && zmq_close(fSocket) != 0) { - LOG(error) << "Failed closing data socket " << fId - << ", reason: " << zmq_strerror(errno); - } - fSocket = nullptr; - - if (fMonitorSocket && zmq_close(fMonitorSocket) != 0) { - LOG(error) << "Failed closing monitor socket " << fId - << ", reason: " << zmq_strerror(errno); - } - fMonitorSocket = nullptr; - } - void SetOption(const std::string& option, const void* value, size_t valueSize) override { if (zmq_setsockopt(fSocket, zmq::getConstant(option), value, valueSize) < 0) { @@ -452,7 +435,23 @@ class Socket final : public fair::mq::Socket unsigned long GetMessagesTx() const override { return fMessagesTx; } unsigned long GetMessagesRx() const override { return fMessagesRx; } - ~Socket() override { Close(); } + ~Socket() override + { + // LOG(debug) << "Closing socket " << fId; + + if (fSocket && zmq_close(fSocket) != 0) { + LOG(error) << "Failed closing data socket " << fId + << ", reason: " << zmq_strerror(errno); + } + fSocket = nullptr; + + if (fMonitorSocket && zmq_close(fMonitorSocket) != 0) { + LOG(error) << "Failed closing monitor socket " << fId + << ", reason: " << zmq_strerror(errno); + } + fMonitorSocket = nullptr; + } + private: Manager& fManager; diff --git a/fairmq/zeromq/Socket.h b/fairmq/zeromq/Socket.h index 5c6136f1..ce9dad88 100644 --- a/fairmq/zeromq/Socket.h +++ b/fairmq/zeromq/Socket.h @@ -257,23 +257,6 @@ class Socket final : public fair::mq::Socket void* GetSocket() const { return fSocket; } - void Close() override - { - // LOG(debug) << "Closing socket " << fId; - - if (fSocket && zmq_close(fSocket) != 0) { - LOG(error) << "Failed closing data socket " << fId - << ", reason: " << zmq_strerror(errno); - } - fSocket = nullptr; - - if (fMonitorSocket && zmq_close(fMonitorSocket) != 0) { - LOG(error) << "Failed closing monitor socket " << fId - << ", reason: " << zmq_strerror(errno); - } - fMonitorSocket = nullptr; - } - void SetOption(const std::string& option, const void* value, size_t valueSize) override { if (zmq_setsockopt(fSocket, getConstant(option), value, valueSize) < 0) { @@ -390,7 +373,23 @@ class Socket final : public fair::mq::Socket unsigned long GetMessagesTx() const override { return fMessagesTx; } unsigned long GetMessagesRx() const override { return fMessagesRx; } - ~Socket() override { Close(); } + ~Socket() override + { + // LOG(debug) << "Closing socket " << fId; + + if (fSocket && zmq_close(fSocket) != 0) { + LOG(error) << "Failed closing data socket " << fId + << ", reason: " << zmq_strerror(errno); + } + fSocket = nullptr; + + if (fMonitorSocket && zmq_close(fMonitorSocket) != 0) { + LOG(error) << "Failed closing monitor socket " << fId + << ", reason: " << zmq_strerror(errno); + } + fMonitorSocket = nullptr; + } + private: Context& fCtx;