Class: Nonnative::LimitDataSocketPair
- Inherits:
-
SocketPair
- Object
- SocketPair
- Nonnative::LimitDataSocketPair
- Defined in:
- lib/nonnative/limit_data_socket_pair.rb
Overview
Socket-pair variant used by the fault-injection proxy to truncate upstream responses.
When active, client requests pass through unchanged, while the first proxy.options[:bytes]
bytes of the upstream stream are forwarded to the client on each connection. Once the limit is
reached, the pair's normal connection lifecycle closes both sockets gracefully. A missing or
non-positive limit leaves the connection in pass-through mode.
This behavior is enabled by calling FaultInjectionProxy#limit_data.
Instance Method Summary collapse
-
#connect(local_socket) ⇒ void
Tracks the client socket and response byte budget for this connection.
Methods inherited from SocketPair
Constructor Details
This class inherits a constructor from Nonnative::SocketPair
Instance Method Details
#connect(local_socket) ⇒ void
This method returns an undefined value.
Tracks the client socket and response byte budget for this connection.
21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/nonnative/limit_data_socket_pair.rb', line 21 def connect(local_socket) @local_socket = local_socket @remaining = proxy.[:bytes] @limit_reached = false super ensure @local_socket = nil @remaining = nil @limit_reached = nil end |