eventloop

package
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2015 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 {
	HttpRequests       chan (message.HttpRequest)
	MonitoringRequests chan (message.MonitoringRequest)
	IncomingFrames     chan (frames.Frame)
	Shutdown           chan (bool)
	Host               string
	Port               int
}

func Start

func Start(host string, port int, dump bool) (*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.

The eventloop takes all events, and executes them sequentially in a single thread. The implementation in github.com/fstab/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.

Jump to

Keyboard shortcuts

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