MCPcopy Create free account
hub / github.com/dadgar/onecache / initRpcServer

Method initRpcServer

onecache/rpc_dispatch.go:20–30  ·  view source on GitHub ↗

initRpcServer intializes the listener for rpc requests on the passed port.

(port int)

Source from the content-addressed store, hash-verified

18
19// initRpcServer intializes the listener for rpc requests on the passed port.
20func (n *Node) initRpcServer(port int) error {
21 l, err := net.Listen("tcp", ":"+strconv.Itoa(port))
22 if err != nil {
23 return fmt.Errorf("couldn't listen on port %d: %v", port, err)
24 }
25
26 n.port = l.Addr().(*net.TCPAddr).Port
27 n.listener = l
28 n.shutdown = false
29 return nil
30}
31
32func (n *Node) listen() {
33 for {

Callers 4

TestNewRpcServerAnyPortFunction · 0.95
CreateFunction · 0.95

Calls

no outgoing calls

Tested by 3

TestNewRpcServerAnyPortFunction · 0.76