tun2: do pingloop more manually

This commit is contained in:
Cadey Ratio 2017-03-26 15:19:10 -07:00
parent 1d5c58e22d
commit d7e1510121
2 changed files with 19 additions and 2 deletions

1
lib/tun2/.#server.go Symbolic link
View File

@ -0,0 +1 @@
xena@greedo.xeserv.us.3075:1486865539

View File

@ -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(),
})