/*
* call-seq:
* disconnect -> nil
*
* Disconnect from Spread. Invoking methods like #receive and
* #multicast on a disconnected Spread::Connection will throw
* exceptions. You can reconnect to Spread (perhaps supplying
* different connection parameters) using #connect.
*/
static VALUE
spconn_disconnect(VALUE obj)
{
int n;
struct SpreadConnection *sp;
Data_Get_Struct(obj, struct SpreadConnection, sp);
if ((n = SP_disconnect(sp->mbox)) < 0)
raise_sp_error(n);
sp->connected = false;
/*
* The mailbox fd is no longer valid, so get rid of the cached IO
* wrapper for it (if any)
*/
sp->rb_fd = Qnil;
return Qnil;
}