增加稳定性
This commit is contained in:
parent
0b338de152
commit
c695474f6b
@ -41,7 +41,7 @@ func (c *Client) Start() {
|
||||
stream := bridge.GetStream()
|
||||
if stream == nil {
|
||||
conn.Close()
|
||||
fmt.Printf("[Client] connect to server error")
|
||||
fmt.Println("[Client] connect to server error")
|
||||
continue
|
||||
}
|
||||
fmt.Printf("[Client] New TCP connection: %v <-> %v \n", conn.LocalAddr().String(), conn.RemoteAddr().String())
|
||||
|
@ -5,6 +5,7 @@ import (
|
||||
"github.com/xtaci/smux"
|
||||
"io"
|
||||
"net"
|
||||
"time"
|
||||
)
|
||||
|
||||
type Server struct {
|
||||
@ -56,6 +57,10 @@ func handler(conn net.Conn, targetAddress string, fakeAddress string) {
|
||||
|
||||
<-waitCh
|
||||
|
||||
//Clean up previous buffered data
|
||||
conn.SetDeadline(time.Now())
|
||||
conn.SetDeadline(time.Time{})
|
||||
|
||||
//Process real tcp connection
|
||||
session, err := smux.Server(conn, nil)
|
||||
if err != nil {
|
||||
|
Loading…
Reference in New Issue
Block a user