httpx/sig/io/tcp.rbs
HoneyryderChuck 487a747544 allow reuse of previously closed connections within the scope of a session
when closed, connections are now placed in a place called eden_connections; whenever a connection is matched for, after checking the live connections and finding none, a match is looked in eden connections; the match is accepted **if** the IP is considered fresh (the input is validated in the cache, or input was an ip or in /etc/hosts, or it's an external socket) and, if a TLS connection, the stored TLS session did not expire; if these conditions do not match, the connection is dropped from the eden and a new connection will started instead; this will therefore allow reusing ruby objects, reusing TLS sessions, and still respect the DNs cache
2023-09-06 22:09:56 +01:00

61 lines
1.1 KiB
Plaintext

module HTTPX
class TCP
include Loggable
attr_reader ip: IPAddr?
attr_reader port: Integer
attr_reader addresses: Array[ipaddr]
attr_reader state: Symbol
attr_reader interests: io_interests
alias host ip
# TODO: lift when https://github.com/ruby/rbs/issues/1497 fixed
def initialize: (URI::Generic origin, Array[ipaddr]? addresses, options options) ?{ (self) -> void } -> void
def add_addresses: (Array[ipaddr] addrs) -> void
def to_io: () -> ::IO
def protocol: () -> String
def connect: () -> void
private
# :nocov:
def try_connect: () -> void
public
def read: (Integer size, ?(Buffer | String) buffer) -> (0 | nil | untyped)
def write: (Buffer buffer) -> Integer?
def close: () -> void
def connected?: () -> bool
def expired?: () -> boolish
def closed?: () -> bool
# :nocov:
def inspect: () -> ::String
private
def build_socket: () -> Socket
def transition: (Symbol nextstate) -> void
def do_transition: (Symbol nextstate) -> void
def log_transition_state: (Symbol nextstate) -> void
end
end