Module: HTTPkit::Connection::Status

Included in:
HTTPkit::Client, Server
Defined in:
lib/httpkit/connection/status.rb

Instance Method Summary collapse

Instance Method Details

#close(reason = nil) ⇒ Object


6
7
8
# File 'lib/httpkit/connection/status.rb', line 6

def close(reason = nil)
  @connection.close(reason)
end

#closed?Boolean

Returns:

  • (Boolean)

10
11
12
# File 'lib/httpkit/connection/status.rb', line 10

def closed?
  !@connection.closed.pending?
end

#error?Boolean

Returns:

  • (Boolean)

14
15
16
# File 'lib/httpkit/connection/status.rb', line 14

def error?
  @connection.closed.rejected?
end

#network_fault?Boolean

Returns:

  • (Boolean)

18
19
20
21
# File 'lib/httpkit/connection/status.rb', line 18

def network_fault?
  [Errno::ENOTCONN, Errno::ENETUNREACH]
    .include?(@connection.closed.reason)
end

#timeout?Boolean

Returns:

  • (Boolean)

23
24
25
# File 'lib/httpkit/connection/status.rb', line 23

def timeout?
  @connection.closed.reason == Errno::ETIMEDOUT
end