Package dev.relism.flash.transport
package dev.relism.flash.transport
-
ClassDescriptionSingle accept-loop body — runs on each of a listener's accept threads.One bound listener socket (plain or TLS) plus whether it is TLS, for logging only.The single buffered view over one connection's inbound bytes, for the whole lifetime of the gives
ProtocolNegotiatora way to inspect the first bytes of a plaintext connection (the h2c preface) without consuming them.Everything aConnectionProtocolimplementation needs to serve one connection, bundled into a single object instead of a long parameter list.ALPN/preface detection (ConnectionRunner), and dispatches to one implementation of this interface.Owns one connection's socket lifecycle from accept to close: configures socket options, dispatches to the matchingConnectionProtocol— guaranteeing cleanup (scratch release, active-socket tracking) regardless of how the protocol implementation exits.ThreadLocalonHttpServer: the decimal-formatting scratch, the streaming relay buffer, and the WebSocket-handshakeMessageDigest.Turns aFlashConfiguration.Listenerinto a boundServerSocket.The result ofProtocolNegotiator.negotiate(java.net.Socket, dev.relism.flash.transport.BufferedByteSource): which protocol a connection will speak,Detects HTTP/1.1 or HTTP/2 once, before the connection parser is selected.A bounded cache ofConnectionScratchinstances, reused across connections instead of being allocated and garbage-collected per connection.Owns the server's lifecycle: the accept threads (one per listener ×TransportTuning.ACCEPT_THREADS), the active-socket registry, and the two-stageshutdownDrainTimeoutMs(during whichHttp1ConnectionforcesConnection: closeon the next response once it observesServerLifecycle.isStopped()), then force-close whatever remains.Composes the whole transport: binds every configured listener, wires the connection runner and the h1 protocol, and returns theServerHandleimplementation (ServerLifecycle) thatServerHandle.create(dev.relism.flash.extension.FlashConfiguration, dev.relism.flash.routing.AbstractRouter, dev.relism.flash.routing.AbstractWsRouter)exposes publicly.Transport-level bound on concurrent connections, enforced byConnectionRunnerbefore any per-connection state (TLS handshake, protocol negotiation, HPACK tables, buffers) is set up.