eventloop

package
v0.0.13 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 27, 2021 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Loop

type Loop struct {
	HttpCommands       chan (*commands.HttpCommand)
	MonitoringCommands chan (*commands.MonitoringCommand)
	PingCommands       chan (*commands.PingCommand)
	IncomingFrames     chan (frames.Frame)
	Shutdown           chan (bool)
	Host               string
	Port               int
	// contains filtered or unexported fields
}

func Start

func Start(host string, port int, incomingFrameFilters []func(frames.Frame) frames.Frame, outgoingFrameFilters []func(frames.Frame) frames.Frame) (*Loop, error)

Start starts the event loop managing the HTTP/2 communication with a server.

A lot of HTTP/2 features are hard to implement in a thread safe way:

  • Push promises arriving while the client sends a request at the same time.
  • Window updates increase the flow control window while the client sends data and decreases the flow control window at the same time.
  • etc.

Therefore, each HTTP/2 connection is handled single thread in h2c (that is, h2c avoids concurrency problems by being single-threaded per connection).

The eventloop takes all events, and executes them sequentially in a single thread. The implementation in github.com/ajmath/h2c/http2client/connection does not need to care about thread safety.

There are two sources of events:

1. Command line: A user types a comand in order to send a GET, POST, ... request. 2. Network Socket: Frames received from the server.

func (*Loop) IsTerminated

func (l *Loop) IsTerminated() bool

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL