server

package
v0.2.19 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2023 License: Unlicense Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ContextWithPeerInfo

func ContextWithPeerInfo(ctx context.Context, c codec.PeerInfo) context.Context

func PeerInfoFromContext

func PeerInfoFromContext(ctx context.Context) codec.PeerInfo

PeerInfoFromContext returns information about the client's network connection. Use this with the context passed to RPC method handler functions.

The zero value is returned if no connection info is present in ctx.

Types

type Server

type Server struct {
	Tracing Tracing
	// contains filtered or unexported fields
}

Server is an RPC server.

func NewServer

func NewServer(r codec.Handler) *Server

NewServer creates a new server instance with no registered handlers.

func (*Server) ServeCodec

func (s *Server) ServeCodec(pctx context.Context, remote codec.ReaderWriter)

ServeCodec reads incoming requests from codec, calls the appropriate callback and writes the response back using the given codec. It will block until the codec is closed or the server is stopped. In either case the codec is closed.

func (*Server) Stop

func (s *Server) Stop()

Stop stops reading new requests, waits for stopPendingRequestTimeout to allow pending requests to finish, then closes all codecs which will cancel pending requests and subscriptions.

type Tracing

type Tracing struct {
	ErrorLogger func(remote codec.ReaderWriter, err error)
}

Jump to

Keyboard shortcuts

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