增加稳定性

This commit is contained in:
wenyifan 2022-09-01 17:49:27 +08:00
parent 0b338de152
commit c695474f6b
2 changed files with 6 additions and 1 deletions

View File

@ -41,7 +41,7 @@ func (c *Client) Start() {
stream := bridge.GetStream() stream := bridge.GetStream()
if stream == nil { if stream == nil {
conn.Close() conn.Close()
fmt.Printf("[Client] connect to server error") fmt.Println("[Client] connect to server error")
continue continue
} }
fmt.Printf("[Client] New TCP connection: %v <-> %v \n", conn.LocalAddr().String(), conn.RemoteAddr().String()) fmt.Printf("[Client] New TCP connection: %v <-> %v \n", conn.LocalAddr().String(), conn.RemoteAddr().String())

View File

@ -5,6 +5,7 @@ import (
"github.com/xtaci/smux" "github.com/xtaci/smux"
"io" "io"
"net" "net"
"time"
) )
type Server struct { type Server struct {
@ -56,6 +57,10 @@ func handler(conn net.Conn, targetAddress string, fakeAddress string) {
<-waitCh <-waitCh
//Clean up previous buffered data
conn.SetDeadline(time.Now())
conn.SetDeadline(time.Time{})
//Process real tcp connection //Process real tcp connection
session, err := smux.Server(conn, nil) session, err := smux.Server(conn, nil)
if err != nil { if err != nil {