/*
* call-seq:
* socket.close() -> nil
*
* Destroys the 0MQ socket. All active connections on the socket shall be
* terminated, and resources associated with the socket shall be released.
* Any outstanding messages sent with send() but not yet physically sent
* to the network shall be dropped. Likewise, any outstanding messages
* physically received from the network but not yet received by the
* application with recv() shall also be dropped.
*/
static VALUE socket_close (VALUE self_)
{
void * s = NULL;
Data_Get_Struct (self_, void, s);
if (s != NULL) {
int rc = zmq_close (s);
if (rc != 0) {
rb_raise (rb_eRuntimeError, "%s", zmq_strerror (zmq_errno ()));
return Qnil;
}
DATA_PTR (self_) = NULL;
}
return Qnil;
}