initRpcServer intializes the listener for rpc requests on the passed port.
(port int)
| 18 | |
| 19 | // initRpcServer intializes the listener for rpc requests on the passed port. |
| 20 | func (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 | |
| 32 | func (n *Node) listen() { |
| 33 | for { |
no outgoing calls