An experimental pub/sub client and server project.

comment on the timeout check

+3 -1
+3 -1
server/server.go
··· 127 127 for { 128 128 action, err := readAction(peer, time.Millisecond*100) 129 129 if err != nil { 130 + // if the error is a timeout, it means the peer hasn't sent an action indicating it wishes to do something so sleep 131 + // for a little bit to allow for other actions to happen on the connection 130 132 var neterr net.Error 131 133 if errors.As(err, &neterr) && neterr.Timeout() { 132 - time.Sleep(time.Second) 134 + time.Sleep(time.Millisecond * 500) 133 135 continue 134 136 } 135 137