From d7e15101218360abde67387e3a86a54c84eb9230 Mon Sep 17 00:00:00 2001 From: Christine Dodrill Date: Sun, 26 Mar 2017 15:19:10 -0700 Subject: [PATCH] tun2: do pingloop more manually --- lib/tun2/.#server.go | 1 + lib/tun2/server.go | 20 ++++++++++++++++++-- 2 files changed, 19 insertions(+), 2 deletions(-) create mode 120000 lib/tun2/.#server.go diff --git a/lib/tun2/.#server.go b/lib/tun2/.#server.go new file mode 120000 index 0000000..a16c320 --- /dev/null +++ b/lib/tun2/.#server.go @@ -0,0 +1 @@ +xena@greedo.xeserv.us.3075:1486865539 \ No newline at end of file diff --git a/lib/tun2/server.go b/lib/tun2/server.go index 74ff24d..af2b72c 100644 --- a/lib/tun2/server.go +++ b/lib/tun2/server.go @@ -7,6 +7,7 @@ import ( "encoding/json" "errors" "fmt" + "io/ioutil" "math/rand" "net" "net/http" @@ -153,12 +154,27 @@ func (s *Server) ListenAndServe() error { panic(err) } - _, err = s.RoundTrip(req) + stream, err := c.session.OpenStream() if err != nil { ln.Error(err) c.cancel() } + + err = req.Write(stream) + if err != nil { + ln.Error(err) + + c.cancel() + } + + _, err = ioutil.ReadAll(stream) + if err != nil { + ln.Error(err) + c.cancel() + } + + stream.Close() } s.connlock.Unlock() @@ -188,7 +204,7 @@ func (s *Server) HandleConn(c net.Conn, isKCP bool) { controlStream, err := session.OpenStream() if err != nil { ln.Error(err, ln.F{ - "action": "control_stream_failure", + "action": "control_stream_failure" "local": c.LocalAddr().String(), "remote": c.RemoteAddr().String(), })