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


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

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


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

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;
}