abstract class GRPC::Transport::Http2Connection

Overview

Http2Connection wraps an nghttp2 session over any IO (plain TCP or TLS). Subclasses implement server-specific or client-specific logic.

Direct Known Subclasses

Defined in:

grpc/transport/http2_connection.cr

Constant Summary

CLOSE_DRAIN_TIMEOUT = 100.milliseconds
HTTP2_CLIENT_PREFACE = "PRI * HTTP/2.0\r\n\r\nSM\r\n\r\n"
MAX_PENDING_OUTPUT = 256 * 1024
RECV_BUFFER_SIZE = 65536

Constructors

Instance Method Summary

Constructor Detail

def self.new(socket : IO, peer_address : String = "unknown") #

[View source]

Instance Method Detail

def close : Nil #

[View source]
def closed? : Bool #

[View source]
def invoke_callback(& : -> Nil) : Int32 #

Do not unwind a Crystal exception through libnghttp2's C stack. The enclosing session operation will fail and tear down the connection.


[View source]
def on_begin_headers_cb(frame : Pointer(Void)) : Nil #

[View source]
def on_data_chunk_cb(stream_id : Int32, data : Pointer(UInt8), len : LibC::SizeT) : Nil #

[View source]
def on_frame_recv_cb(frame : Pointer(Void)) : Nil #

[View source]
def on_frame_send_cb(frame : Pointer(Void)) : Nil #

[View source]
def on_header_cb(frame : Pointer(Void), name : Pointer(UInt8), nlen : LibC::SizeT, value : Pointer(UInt8), vlen : LibC::SizeT) : Nil #

[View source]
def on_stream_close_cb(stream_id : Int32, error_code : UInt32) : Nil #

[View source]
def run_recv_loop : Nil #

run_recv_loop reads from the socket and feeds data to nghttp2. Runs until the connection closes.


[View source]