mirror of
https://github.com/zeromq/libzmq.git
synced 2025-11-03 11:26:22 +01:00
Added missing close method w/ check if socket is already closed.
Signed-off-by: Guido Goldstein <github@a-nugget.de>
This commit is contained in:
committed by
Martin Sustrik
parent
7b95c5920c
commit
d0c8edde35
@@ -214,8 +214,7 @@ namespace zmq
|
|||||||
|
|
||||||
inline ~socket_t ()
|
inline ~socket_t ()
|
||||||
{
|
{
|
||||||
int rc = zmq_close (ptr);
|
close();
|
||||||
assert (rc == 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
inline operator void* ()
|
inline operator void* ()
|
||||||
@@ -223,6 +222,17 @@ namespace zmq
|
|||||||
return ptr;
|
return ptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline void close()
|
||||||
|
{
|
||||||
|
if(ptr == NULL)
|
||||||
|
// already closed
|
||||||
|
return ;
|
||||||
|
int rc = zmq_close (ptr);
|
||||||
|
if (rc != 0)
|
||||||
|
throw error_t ();
|
||||||
|
ptr = 0 ;
|
||||||
|
}
|
||||||
|
|
||||||
inline void setsockopt (int option_, const void *optval_,
|
inline void setsockopt (int option_, const void *optval_,
|
||||||
size_t optvallen_)
|
size_t optvallen_)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user