diff --git a/pkg/node/identity.go b/pkg/node/identity.go index 7a20fd9..1c48636 100644 --- a/pkg/node/identity.go +++ b/pkg/node/identity.go @@ -275,7 +275,7 @@ func (manager *NodeManager) loadIdentity() error { return nil } -// Delete removes the node identity and keys from disk. +// if err := manager.Delete(); err != nil { return err } // removes key and config from disk; clears in-memory state func (manager *NodeManager) Delete() error { manager.mutex.Lock() defer manager.mutex.Unlock() diff --git a/pkg/node/transport.go b/pkg/node/transport.go index e5b0250..51aeb42 100644 --- a/pkg/node/transport.go +++ b/pkg/node/transport.go @@ -607,7 +607,7 @@ func (t *Transport) handleWSUpgrade(w http.ResponseWriter, r *http.Request) { go t.keepalive(pc) } -// performHandshake initiates handshake with a peer. +// if err := t.performHandshake(pc); err != nil { conn.Close(); return nil, err } func (t *Transport) performHandshake(pc *PeerConnection) error { // Set handshake timeout handshakeTimeout := 10 * time.Second @@ -712,7 +712,7 @@ func (t *Transport) performHandshake(pc *PeerConnection) error { return nil } -// readLoop reads messages from a peer connection. +// go t.readLoop(pc) // started by Connect and handleWSUpgrade after handshake func (t *Transport) readLoop(pc *PeerConnection) { defer t.waitGroup.Done() defer t.removeConnection(pc) @@ -781,7 +781,7 @@ func (t *Transport) readLoop(pc *PeerConnection) { } } -// keepalive sends periodic pings. +// go t.keepalive(pc) // started by Connect and handleWSUpgrade; pings every t.config.PingInterval func (t *Transport) keepalive(pc *PeerConnection) { defer t.waitGroup.Done() @@ -816,7 +816,7 @@ func (t *Transport) keepalive(pc *PeerConnection) { } } -// removeConnection removes and cleans up a connection. +// t.removeConnection(pc) // called from readLoop on error and keepalive on timeout func (t *Transport) removeConnection(pc *PeerConnection) { t.mutex.Lock() delete(t.conns, pc.Peer.ID)