socket

package
v2.9.3 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2021 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package socket provides a pseudo socket

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Pool

type Pool struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func NewPool

func NewPool() *Pool

NewPool returns a new socket pool

func (*Pool) Close

func (p *Pool) Close()

Close the pool and delete all the sockets

func (*Pool) Get

func (p *Pool) Get(id string) (*Socket, bool)

func (*Pool) Release

func (p *Pool) Release(s *Socket)

type Socket

type Socket struct {
	// contains filtered or unexported fields
}

Socket is our pseudo socket for transport.Socket

func New

func New(id string) *Socket

New returns a new pseudo socket which can be used in the place of a transport socket. Messages are sent to the socket via Accept and receives from the socket via Process. SetLocal/SetRemote should be called before using the socket.

func (*Socket) Accept

func (s *Socket) Accept(m *transport.Message) error

Accept passes a message to the socket which will be processed by the call to Recv

func (*Socket) Close

func (s *Socket) Close() error

Close closes the socket

func (*Socket) Local

func (s *Socket) Local() string

func (*Socket) Process

func (s *Socket) Process(m *transport.Message) error

Process takes the next message off the send queue created by a call to Send

func (*Socket) Recv

func (s *Socket) Recv(m *transport.Message) error

func (*Socket) Remote

func (s *Socket) Remote() string

func (*Socket) Send

func (s *Socket) Send(m *transport.Message) error

func (*Socket) SetLocal

func (s *Socket) SetLocal(l string)

func (*Socket) SetRemote

func (s *Socket) SetRemote(r string)

Jump to

Keyboard shortcuts

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