fix: remove timeouts from HTTP/HTTPS handlers and improve concurrency
All checks were successful
Docker Build and Push / build-and-push (push) Successful in 3m40s

This commit is contained in:
2025-07-21 19:54:17 +07:00
parent 4a25627ab5
commit 9f18cfa954
4 changed files with 105 additions and 104 deletions

View File

@ -4,11 +4,9 @@ import (
"bufio"
"crypto/tls"
"errors"
"golang.org/x/net/context"
"log"
"net"
"strings"
"time"
"tunnel_pls/session"
"tunnel_pls/utils"
)
@ -70,23 +68,10 @@ func HandlerTLS(conn net.Conn) {
conn.Close()
return
}
keepalive, timeout := parseConnectionDetails(headers)
var ctx context.Context
var cancel context.CancelFunc
if keepalive {
if timeout >= 300 {
timeout = 300
}
ctx, cancel = context.WithDeadline(context.Background(), time.Now().Add(time.Duration(timeout)*time.Second))
} else {
ctx, cancel = context.WithDeadline(context.Background(), time.Now().Add(5*time.Second))
}
sshSession.HandleForwardedConnection(session.UserConnection{
Reader: reader,
Writer: conn,
Context: ctx,
Cancel: cancel,
Reader: reader,
Writer: conn,
}, sshSession.Connection)
return
}