mirror of
https://github.com/yggdrasil-network/yggdrasil-go.git
synced 2024-11-23 18:15:24 +00:00
Tweak logging for connections
This commit is contained in:
parent
22caddef63
commit
c55611a478
@ -286,7 +286,7 @@ func (intf *link) handler() error {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if intf.incoming && !intf.force && !isallowed {
|
if intf.incoming && !intf.force && !isallowed {
|
||||||
intf.links.core.log.Warnf("%s connection from %s forbidden: AllowedEncryptionPublicKeys does not contain key %s",
|
intf.links.core.log.Warnf("%s connection from %s forbidden: AllowedPublicKeys does not contain key %s",
|
||||||
strings.ToUpper(intf.info.linkType), intf.info.remote, hex.EncodeToString(meta.key))
|
strings.ToUpper(intf.info.linkType), intf.info.remote, hex.EncodeToString(meta.key))
|
||||||
_ = intf.close()
|
_ = intf.close()
|
||||||
return fmt.Errorf("forbidden connection")
|
return fmt.Errorf("forbidden connection")
|
||||||
@ -302,15 +302,15 @@ func (intf *link) handler() error {
|
|||||||
intf.links.core.log.Infof("Connected %s: %s, source %s",
|
intf.links.core.log.Infof("Connected %s: %s, source %s",
|
||||||
strings.ToUpper(intf.info.linkType), remoteStr, localStr)
|
strings.ToUpper(intf.info.linkType), remoteStr, localStr)
|
||||||
|
|
||||||
// TODO don't report an error if it's just a 'use of closed network connection'
|
err = intf.links.core.HandleConn(meta.key, intf.conn)
|
||||||
if err = intf.links.core.HandleConn(meta.key, intf.conn); err != nil && err != io.EOF {
|
switch err {
|
||||||
intf.links.core.log.Infof("Disconnected %s: %s, source %s; error: %s",
|
case io.EOF, net.ErrClosed, nil:
|
||||||
strings.ToUpper(intf.info.linkType), remoteStr, localStr, err)
|
|
||||||
} else {
|
|
||||||
intf.links.core.log.Infof("Disconnected %s: %s, source %s",
|
intf.links.core.log.Infof("Disconnected %s: %s, source %s",
|
||||||
strings.ToUpper(intf.info.linkType), remoteStr, localStr)
|
strings.ToUpper(intf.info.linkType), remoteStr, localStr)
|
||||||
|
default:
|
||||||
|
intf.links.core.log.Infof("Disconnected %s: %s, source %s; error: %s",
|
||||||
|
strings.ToUpper(intf.info.linkType), remoteStr, localStr, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user