Skip to content

Commit

Permalink
Added logs to noise.Listener
Browse files Browse the repository at this point in the history
  • Loading branch information
林志宇 committed Jun 1, 2019
1 parent f5a565c commit 504c92a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 3 additions & 1 deletion internal/noise/net.go
Original file line number Diff line number Diff line change
Expand Up @@ -216,12 +216,14 @@ func (ml *Listener) Accept() (net.Conn, error) {
Initiator: ml.init,
})
if err != nil {
continue
return nil, err
}
rw := NewReadWriter(conn, ns)
if err := rw.Handshake(time.Second * 10); err != nil {
log.WithError(err).Warn("accept: noise handshake failed.")
continue
}
log.Infoln("accepted:", rw.RemoteStatic())
return &Conn{Conn: conn, ns: rw}, nil
}
}
Expand Down
4 changes: 2 additions & 2 deletions internal/noise/noise.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
"github.com/skycoin/skywire/pkg/cipher"
)

var logger = logging.MustGetLogger("noise")
var log = logging.MustGetLogger("noise")

// Config hold noise parameters.
type Config struct {
Expand Down Expand Up @@ -136,7 +136,7 @@ func (ns *Noise) EncryptUnsafe(plaintext []byte) []byte {
func (ns *Noise) DecryptUnsafe(ciphertext []byte) ([]byte, error) {
seq := binary.BigEndian.Uint32(ciphertext[:4])
if seq <= ns.previousSeq {
logger.Warnf("current seq: %s is not higher than previous one: %s. "+
log.Warnf("current seq: %s is not higher than previous one: %s. "+
"Highest sequence number received so far is: %s", ns.seq, ns.previousSeq, ns.highestPrevious)
} else {
if ns.previousSeq > ns.highestPrevious {
Expand Down

0 comments on commit 504c92a

Please sign in to comment.