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 (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"net"
|
||||
"os"
|
||||
|
@ -211,13 +212,13 @@ func (backend *SSHBackend) StartProxy(command *commonbackend.AddProxy) (bool, er
|
|||
|
||||
for {
|
||||
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())
|
||||
return
|
||||
}
|
||||
|
||||
_, err = sourceConn.Write(forwardedBuffer[:len])
|
||||
if err != nil {
|
||||
if _, err = sourceConn.Write(forwardedBuffer[:len]); err != nil && err.Error() != "EOF" && !errors.Is(err, net.ErrClosed) {
|
||||
log.Errorf("failed to write to source connection: %s", err.Error())
|
||||
return
|
||||
}
|
||||
|
@ -229,13 +230,13 @@ func (backend *SSHBackend) StartProxy(command *commonbackend.AddProxy) (bool, er
|
|||
|
||||
for {
|
||||
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())
|
||||
return
|
||||
}
|
||||
|
||||
_, err = forwardedConn.Write(sourceBuffer[:len])
|
||||
if err != nil && err.Error() != "EOF" && strings.HasSuffix(err.Error(), "use of closed network connection") {
|
||||
if _, err = forwardedConn.Write(sourceBuffer[:len]); err != nil && err.Error() != "EOF" && !errors.Is(err, net.ErrClosed) {
|
||||
log.Errorf("failed to write to forwarded connection: %s", err.Error())
|
||||
return
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue