/*
 * call-seq:
 *   socket.close() -> nil
 *
 * Destroys the 0MQ socket.  Any outstanding messages physically received from
 * the network but not yet received by the application with ZMQ::Socket#recv()
 * shall be discarded. The behaviour for discarding messages sent by the
 * application with ZMQ::Socket#send() but not yet physically transferred to
 * the network depends on the value of the ZMQ::LINGER socket option for the
 * socket.
 */
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 (exception_type, "%s", zmq_strerror (zmq_errno ()));
            return Qnil;
        }

        DATA_PTR (self_) = NULL;
    }
    return Qnil;
}