Commit d0c8edde authored by Guido Goldstein's avatar Guido Goldstein Committed by Martin Sustrik

Added missing close method w/ check if socket is already closed.

Signed-off-by: 's avatarGuido Goldstein <github@a-nugget.de>
parent 7b95c592
......@@ -214,8 +214,7 @@ namespace zmq
inline ~socket_t ()
{
int rc = zmq_close (ptr);
assert (rc == 0);
close();
}
inline operator void* ()
......@@ -223,6 +222,17 @@ namespace zmq
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_,
size_t optvallen_)
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment