Class: NanoMsg::SurveySocket
Instance Method Summary
collapse
Methods inherited from Socket
#bind, #close, #connect, #getsockopt, #recv, #send, #setsockopt
Constructor Details
#initialize ⇒ Object
Instance Method Details
#deadline ⇒ Object
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
|
# File 'ext/init.c', line 404
static VALUE
srvy_get_deadline(VALUE self)
{
int sock = sock_get(self);
int deadline;
size_t size = sizeof(int);
int err;
err = nn_getsockopt(sock, NN_SURVEYOR, NN_SURVEYOR_DEADLINE, &deadline, &size);
if (err < 0)
RAISE_SOCK_ERROR;
return rb_funcall(INT2NUM(deadline), rb_intern("/"), 1, rb_float_new(1000));
}
|
#deadline=(deadline) ⇒ Object
389
390
391
392
393
394
395
396
397
398
399
400
401
402
|
# File 'ext/init.c', line 389
static VALUE
srvy_set_deadline(VALUE self, VALUE deadline)
{
int sock = sock_get(self);
VALUE miliseconds = rb_funcall(deadline, rb_intern("*"), 1, INT2NUM(1000));
int timeout = FIX2INT(miliseconds);
int err;
err = nn_setsockopt(sock, NN_SURVEYOR, NN_SURVEYOR_DEADLINE, &timeout, sizeof(int));
if (err < 0)
RAISE_SOCK_ERROR;
return deadline;
}
|