fix: Fixes errors showing for no reason.
This commit is contained in:
parent
7837334361
commit
4cb648cd66
1 changed files with 7 additions and 6 deletions
|
@ -2,6 +2,7 @@ package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"net"
|
"net"
|
||||||
"os"
|
"os"
|
||||||
|
@ -211,13 +212,13 @@ func (backend *SSHBackend) StartProxy(command *commonbackend.AddProxy) (bool, er
|
||||||
|
|
||||||
for {
|
for {
|
||||||
len, err := forwardedConn.Read(forwardedBuffer)
|
len, err := forwardedConn.Read(forwardedBuffer)
|
||||||
if err != nil {
|
|
||||||
|
if err != nil && err.Error() != "EOF" && !errors.Is(err, net.ErrClosed) {
|
||||||
log.Errorf("failed to read from forwarded connection: %s", err.Error())
|
log.Errorf("failed to read from forwarded connection: %s", err.Error())
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
_, err = sourceConn.Write(forwardedBuffer[:len])
|
if _, err = sourceConn.Write(forwardedBuffer[:len]); err != nil && err.Error() != "EOF" && !errors.Is(err, net.ErrClosed) {
|
||||||
if err != nil {
|
|
||||||
log.Errorf("failed to write to source connection: %s", err.Error())
|
log.Errorf("failed to write to source connection: %s", err.Error())
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -229,13 +230,13 @@ func (backend *SSHBackend) StartProxy(command *commonbackend.AddProxy) (bool, er
|
||||||
|
|
||||||
for {
|
for {
|
||||||
len, err := sourceConn.Read(sourceBuffer)
|
len, err := sourceConn.Read(sourceBuffer)
|
||||||
if err != nil && err.Error() != "EOF" && strings.HasSuffix(err.Error(), "use of closed network connection") {
|
|
||||||
|
if err != nil && err.Error() != "EOF" && !errors.Is(err, net.ErrClosed) {
|
||||||
log.Errorf("failed to read from source connection: %s", err.Error())
|
log.Errorf("failed to read from source connection: %s", err.Error())
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
_, err = forwardedConn.Write(sourceBuffer[:len])
|
if _, err = forwardedConn.Write(sourceBuffer[:len]); err != nil && err.Error() != "EOF" && !errors.Is(err, net.ErrClosed) {
|
||||||
if err != nil && err.Error() != "EOF" && strings.HasSuffix(err.Error(), "use of closed network connection") {
|
|
||||||
log.Errorf("failed to write to forwarded connection: %s", err.Error())
|
log.Errorf("failed to write to forwarded connection: %s", err.Error())
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue