mirror of
https://github.com/openziti/zrok.git
synced 2025-01-09 07:28:15 +01:00
this might be all we need to ensure that we're cleaning up both sides when one side terminates (#305)
This commit is contained in:
parent
c31a1cd464
commit
7c01f6d52a
@ -68,6 +68,9 @@ func (b *Backend) handle(conn net.Conn) {
|
||||
}
|
||||
|
||||
func (b *Backend) rxer(conn, rConn net.Conn) {
|
||||
logrus.Infof("started '%v' <=> '%v'", conn.RemoteAddr(), rConn.RemoteAddr())
|
||||
defer logrus.Warnf("exited '%v' <=> '%v'", conn.RemoteAddr(), rConn.RemoteAddr())
|
||||
|
||||
buf := make([]byte, 10240)
|
||||
for {
|
||||
if rxsz, err := conn.Read(buf); err == nil {
|
||||
@ -77,16 +80,23 @@ func (b *Backend) rxer(conn, rConn net.Conn) {
|
||||
}
|
||||
} else {
|
||||
logrus.Errorf("error writing '%v': %v", rConn.RemoteAddr(), err)
|
||||
_ = rConn.Close()
|
||||
_ = conn.Close()
|
||||
return
|
||||
}
|
||||
} else {
|
||||
logrus.Errorf("read error '%v': %v", rConn.RemoteAddr(), err)
|
||||
_ = rConn.Close()
|
||||
_ = conn.Close()
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (b *Backend) txer(conn, rConn net.Conn) {
|
||||
logrus.Infof("started '%v' <=> '%v'", conn.RemoteAddr(), rConn.RemoteAddr())
|
||||
defer logrus.Warnf("exited '%v' <=> '%v'", conn.RemoteAddr(), rConn.RemoteAddr())
|
||||
|
||||
buf := make([]byte, 10240)
|
||||
for {
|
||||
if rxsz, err := rConn.Read(buf); err == nil {
|
||||
@ -96,10 +106,14 @@ func (b *Backend) txer(conn, rConn net.Conn) {
|
||||
}
|
||||
} else {
|
||||
logrus.Errorf("error writing '%v': %v", conn.RemoteAddr(), err)
|
||||
_ = rConn.Close()
|
||||
_ = conn.Close()
|
||||
return
|
||||
}
|
||||
} else {
|
||||
logrus.Errorf("read error '%v': %v", conn.RemoteAddr(), err)
|
||||
_ = rConn.Close()
|
||||
_ = conn.Close()
|
||||
return
|
||||
}
|
||||
}
|
@ -74,6 +74,9 @@ func (f *Frontend) accept(conn transport.Conn) {
|
||||
}
|
||||
|
||||
func (f *Frontend) rxer(conn transport.Conn, zConn edge.Conn) {
|
||||
logrus.Infof("started '%v' <=> '%v'", conn.RemoteAddr(), zConn.RemoteAddr())
|
||||
defer logrus.Warnf("exited '%v' <=> '%v'", conn.RemoteAddr(), zConn.RemoteAddr())
|
||||
|
||||
buf := make([]byte, 10240)
|
||||
for {
|
||||
if rxsz, err := conn.Read(buf); err == nil {
|
||||
@ -83,16 +86,23 @@ func (f *Frontend) rxer(conn transport.Conn, zConn edge.Conn) {
|
||||
}
|
||||
} else {
|
||||
logrus.Errorf("error writing '%v': %v", zConn.RemoteAddr(), err)
|
||||
_ = zConn.Close()
|
||||
_ = conn.Close()
|
||||
return
|
||||
}
|
||||
} else {
|
||||
logrus.Errorf("read error '%v': %v", zConn.RemoteAddr(), err)
|
||||
_ = zConn.Close()
|
||||
_ = conn.Close()
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (f *Frontend) txer(conn transport.Conn, zConn edge.Conn) {
|
||||
logrus.Infof("started '%v' <=> '%v'", conn.RemoteAddr(), zConn.RemoteAddr())
|
||||
defer logrus.Warnf("exited '%v' <=> '%v'", conn.RemoteAddr(), zConn.RemoteAddr())
|
||||
|
||||
buf := make([]byte, 10240)
|
||||
for {
|
||||
if rxsz, err := zConn.Read(buf); err == nil {
|
||||
@ -102,10 +112,14 @@ func (f *Frontend) txer(conn transport.Conn, zConn edge.Conn) {
|
||||
}
|
||||
} else {
|
||||
logrus.Errorf("error writing '%v': %v", conn.RemoteAddr(), err)
|
||||
_ = zConn.Close()
|
||||
_ = conn.Close()
|
||||
return
|
||||
}
|
||||
} else {
|
||||
logrus.Errorf("read error '%v': %v", conn.RemoteAddr(), err)
|
||||
_ = zConn.Close()
|
||||
_ = conn.Close()
|
||||
return
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user