mirror of
https://github.com/cwinfo/yggdrasil-go.git
synced 2024-11-10 11:00:28 +00:00
Merge pull request #470 from neilalexander/conndebug
Redirect Conn session closure errors to debug channel
This commit is contained in:
commit
837eb0131b
@ -63,7 +63,11 @@ func (s *tunConn) reader() (err error) {
|
|||||||
}
|
}
|
||||||
if n, err = s.conn.Read(b); err != nil {
|
if n, err = s.conn.Read(b); err != nil {
|
||||||
if e, eok := err.(yggdrasil.ConnError); eok && !e.Temporary() {
|
if e, eok := err.(yggdrasil.ConnError); eok && !e.Temporary() {
|
||||||
|
if e.Closed() {
|
||||||
|
s.tun.log.Debugln(s.conn.String(), "TUN/TAP conn read debug:", err)
|
||||||
|
} else {
|
||||||
s.tun.log.Errorln(s.conn.String(), "TUN/TAP conn read error:", err)
|
s.tun.log.Errorln(s.conn.String(), "TUN/TAP conn read error:", err)
|
||||||
|
}
|
||||||
return e
|
return e
|
||||||
}
|
}
|
||||||
} else if n > 0 {
|
} else if n > 0 {
|
||||||
@ -98,9 +102,12 @@ func (s *tunConn) writer() error {
|
|||||||
}
|
}
|
||||||
// TODO write timeout and close
|
// TODO write timeout and close
|
||||||
if _, err := s.conn.Write(b); err != nil {
|
if _, err := s.conn.Write(b); err != nil {
|
||||||
e, eok := err.(yggdrasil.ConnError)
|
if e, eok := err.(yggdrasil.ConnError); !eok {
|
||||||
if !eok {
|
if e.Closed() {
|
||||||
|
s.tun.log.Debugln(s.conn.String(), "TUN/TAP generic write debug:", err)
|
||||||
|
} else {
|
||||||
s.tun.log.Errorln(s.conn.String(), "TUN/TAP generic write error:", err)
|
s.tun.log.Errorln(s.conn.String(), "TUN/TAP generic write error:", err)
|
||||||
|
}
|
||||||
} else if ispackettoobig, maxsize := e.PacketTooBig(); ispackettoobig {
|
} else if ispackettoobig, maxsize := e.PacketTooBig(); ispackettoobig {
|
||||||
// TODO: This currently isn't aware of IPv4 for CKR
|
// TODO: This currently isn't aware of IPv4 for CKR
|
||||||
ptb := &icmp.PacketTooBig{
|
ptb := &icmp.PacketTooBig{
|
||||||
@ -110,9 +117,13 @@ func (s *tunConn) writer() error {
|
|||||||
if packet, err := CreateICMPv6(b[8:24], b[24:40], ipv6.ICMPTypePacketTooBig, 0, ptb); err == nil {
|
if packet, err := CreateICMPv6(b[8:24], b[24:40], ipv6.ICMPTypePacketTooBig, 0, ptb); err == nil {
|
||||||
s.tun.send <- packet
|
s.tun.send <- packet
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
if e.Closed() {
|
||||||
|
s.tun.log.Debugln(s.conn.String(), "TUN/TAP conn write debug:", err)
|
||||||
} else {
|
} else {
|
||||||
s.tun.log.Errorln(s.conn.String(), "TUN/TAP conn write error:", err)
|
s.tun.log.Errorln(s.conn.String(), "TUN/TAP conn write error:", err)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
s.stillAlive()
|
s.stillAlive()
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user