Class: Couchbase::EM::Socket

Inherits:
Connection
  • Object
show all
Defined in:
ext/couchbase_ext/eventmachine_plugin.c

Instance Method Summary collapse

Instance Method Details

#notify_readableObject



137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
# File 'ext/couchbase_ext/eventmachine_plugin.c', line 137

static VALUE
rb_em_socket_notify_readable(VALUE self)
{
    VALUE event = rb_ivar_get(self, cb_id_iv_event);
    rb_em_event *ev;

    if (RTEST(event)) {
        Data_Get_Struct(event, rb_em_event, ev);
        ev->in_read_handler = 1;
        rb_em_event_run_callback(ev, LCB_READ_EVENT);
        ev->in_read_handler = 0;
    } else {
        rb_funcall_0(self, cb_id_detach);
    }

    return Qnil;
}

#notify_writableObject



155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
# File 'ext/couchbase_ext/eventmachine_plugin.c', line 155

static VALUE
rb_em_socket_notify_writable(VALUE self)
{
    VALUE event = rb_ivar_get(self, cb_id_iv_event);
    rb_em_event *ev;

    if (RTEST(event)) {
        Data_Get_Struct(event, rb_em_event, ev);
        rb_em_event_run_callback(ev, LCB_WRITE_EVENT);
        if (ev->deferred_write_reset) {
            ev->deferred_write_reset = 0;
            rb_funcall_1(ev->holder, cb_id_set_notify_writable, Qfalse);
        }
    } else {
        rb_funcall_0(self, cb_id_detach);
    }

    return Qnil;
}