Method: Capp#timeout=

Defined in:
ext/capp/capp.c

#timeout=(milliseconds) ⇒ Object

Sets the maximum amount of time in milliseconds that will elapse between receiving a packet and yielding it to #loop.

Reducing the timeout will increase responsiveness as pcap_loop(3) must “check in” more frequently while increasing the timeout will reduce responsiveness.

Setting the timeout too low may increase GVL contention when many packets are arriving at once as #loop will be waking up frequently to service captured packets.



1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
# File 'ext/capp/capp.c', line 1075

static VALUE
capp_set_timeout(VALUE self, VALUE milliseconds)
{
    pcap_t *handle;

    GetCapp(self, handle);

    if (pcap_set_timeout(handle, NUM2INT(milliseconds)))
  rb_raise(eCappError, "pcap already activated");

    return milliseconds;
}