etsnunix

package
v0.0.0-...-ef9d1e6 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2013 License: BSD-2-Clause Imports: 6 Imported by: 0

README

This is a library for registering services with etsnsrv(1).

Documentation: http://godoc.org/github.com/JImmyFrasche/etsn/etsnunix

Documentation

Overview

etsnunix implements an interface similar to etsn, but for listening for connections on a unix socket provided by the etsnsrv command.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Server

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

Server encapsulates the state of an etsnsrv listener.

func New

func New(dir string, logger func(error)) *Server

New creates a new server that advertises its protocols at dir.

logger is called whenever there's an error establishing a connection within Listen. Note that the error may be nil. If logger is nil, a no op logger is used.

func (*Server) Listen

func (s *Server) Listen(proto string, handler func(*net.TCPConn) error) error

Listen advertises a single protocol, proto, in the directory the server was created with. It will invoke handler in a new goroutine every time a fd representing a tcp socket is sent down the unix domain socket created at dir/proto by an instance of etnsrv on dir.

Warning: if there is an existing file named dir/proto it will be deleted.

It is safe to call multiple times on same server, with different proto.

Notes

Bugs

  • There are surely many an error that should lead to us breaking out of the listen loop. For example if another process deletes our socket

Jump to

Keyboard shortcuts

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