Class: Raindrops::TCP_Info

### Home Classes Methods

### In Files

- lib/raindrops.rb

### Parent

Object

### Methods

- ::new
- #get!

### Files

- LICENSE
- NEWS
- README

### Class/Module Index

Quicksearch

- Raindrops
- Raindrops::Aggregate
- Raindrops::Aggregate::LastDataRecv
- Raindrops::Aggregate::PMQ
- Raindrops::InetDiagSocket
- Raindrops::LastDataRecv
- Raindrops::Linux
- Raindrops::ListenStats
- Raindrops::Middleware
- Raindrops::Middleware::Proxy
- Raindrops::Middleware::Stats
- Raindrops::Struct
- Raindrops::TCP_Info
- Raindrops::Watcher

No matching classes.

# Raindrops::TCP_Info

This is used to wrap "struct tcp_info" as described in tcp(7) and /usr/include/linux/tcp.h. The following readers methods are defined corresponding to the "tcpi_" fields in the tcp_info struct.

In particular, the `last_data_recv` field is useful for measuring the amount of time a client spent in the listen queue before +accept()+, but only if `TCP_DEFER_ACCEPT` is used with the listen socket (it is on by default in Unicorn).

- state

- ca_state

- retransmits

- probes

- backoff

- options

- snd_wscale

- rcv_wscale

- rto

- ato

- snd_mss

- rcv_mss

- unacked

- sacked

- lost

- retrans

- fackets

- last_data_sent

- last_ack_sent

- last_data_recv

- last_ack_recv

- pmtu

- rcv_ssthresh

- rtt

- rttvar

- snd_ssthresh

- snd_cwnd

- advmss

- reordering

- rcv_rtt

- rcv_space

- total_retrans

kernel.org/doc/man-pages/online/pages/man7/tcp.7.html

### Public Class Methods

Raindrops::TCP_Info.new(tcp_socket) → TCP_Info object click to toggle source

Reads a TCP_Info object from any given `tcp_socket`. See the tcp(7) manpage and /usr/include/linux/tcp.h for more details.

    static VALUE init(VALUE self, VALUE io)
    {
            int fd = my_fileno(io);
            struct tcp_info *info = DATA_PTR(self);
            socklen_t len = (socklen_t)sizeof(struct tcp_info);
            int rc = getsockopt(fd, IPPROTO_TCP, TCP_INFO, info, &len);

            if (rc != 0)
                    rb_sys_fail("getsockopt");

            return self;
    }

### Public Instance Methods

Raindrops::TCP_Info.new(tcp_socket) → TCP_Info object click to toggle source

Reads a TCP_Info object from any given `tcp_socket`. See the tcp(7) manpage and /usr/include/linux/tcp.h for more details.

    static VALUE init(VALUE self, VALUE io)
    {
            int fd = my_fileno(io);
            struct tcp_info *info = DATA_PTR(self);
            socklen_t len = (socklen_t)sizeof(struct tcp_info);
            int rc = getsockopt(fd, IPPROTO_TCP, TCP_INFO, info, &len);

            if (rc != 0)
                    rb_sys_fail("getsockopt");

            return self;
    }

[Validate]

Generated with the Darkfish Rdoc Generator 2.