mirror of
https://github.com/FairRootGroup/FairMQ.git
synced 2025-10-14 09:06:47 +00:00
feat!: Remove deprecated Socket::Close()
BREAKING CHANGE
This commit is contained in:
parent
600624c884
commit
55f9991bab
|
@ -57,9 +57,6 @@ struct Socket
|
||||||
virtual int64_t Send(Parts& parts, int timeout = -1) { return Send(parts.fParts, timeout); }
|
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); }
|
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 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;
|
virtual void GetOption(const std::string& option, void* value, size_t* valueSize) = 0;
|
||||||
|
|
||||||
|
|
|
@ -319,23 +319,6 @@ class Socket final : public fair::mq::Socket
|
||||||
|
|
||||||
void* GetSocket() const { return fSocket; }
|
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
|
void SetOption(const std::string& option, const void* value, size_t valueSize) override
|
||||||
{
|
{
|
||||||
if (zmq_setsockopt(fSocket, zmq::getConstant(option), value, valueSize) < 0) {
|
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 GetMessagesTx() const override { return fMessagesTx; }
|
||||||
unsigned long GetMessagesRx() const override { return fMessagesRx; }
|
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:
|
private:
|
||||||
Manager& fManager;
|
Manager& fManager;
|
||||||
|
|
|
@ -257,23 +257,6 @@ class Socket final : public fair::mq::Socket
|
||||||
|
|
||||||
void* GetSocket() const { return fSocket; }
|
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
|
void SetOption(const std::string& option, const void* value, size_t valueSize) override
|
||||||
{
|
{
|
||||||
if (zmq_setsockopt(fSocket, getConstant(option), value, valueSize) < 0) {
|
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 GetMessagesTx() const override { return fMessagesTx; }
|
||||||
unsigned long GetMessagesRx() const override { return fMessagesRx; }
|
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:
|
private:
|
||||||
Context& fCtx;
|
Context& fCtx;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user