Skip to content

Commit

Permalink
fix: goroutine leak in httptunnel
Browse files Browse the repository at this point in the history
  • Loading branch information
nange committed Apr 28, 2024
1 parent 308ca73 commit e77a44f
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions remote.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"io"
"net"
"os"
"time"

"github.com/caddyserver/certmagic"
"github.com/nange/easyss/v2/cipherstream"
Expand Down Expand Up @@ -198,13 +199,17 @@ func (es *EasyServer) handShakeWithClient(conn net.Conn) (hsRes, error) {
cs := csStream.(*cipherstream.CipherStream)
defer cs.Release()

_ = csStream.SetDeadline(time.Now().Add(5 * es.Timeout()))

var frame *cipherstream.Frame
for {
frame, err = cs.ReadFrame()
if err != nil {
return res, err
}

_ = csStream.SetDeadline(time.Now().Add(5 * es.Timeout()))

if frame.IsPingFrame() {
log.Debug("[REMOTE] got ping message",
"payload", string(frame.RawDataPayload()), "is_need_ack", frame.IsNeedACK())
Expand Down

0 comments on commit e77a44f

Please sign in to comment.