Skip to content

Commit

Permalink
Merge pull request #20 from xqdoo00o/master
Browse files Browse the repository at this point in the history
add timeout
  • Loading branch information
bi1101 authored May 3, 2024
2 parents a5bfcf4 + 2b6ea6e commit e2a8152
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion internal/chatgpt/request.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ type rawDialer interface {

func createWSConn(addr string, connInfo *connInfo, proxyURLString string, retry int) error {
dialer := websocket.Dialer{
HandshakeTimeout: 8 * time.Second,
NetDialTLSContext: func(ctx context.Context, network, addr string) (net.Conn, error) {
host, _, _ := net.SplitHostPort(addr)
config := &tls.Config{ServerName: host, OmitEmptyPsk: true}
Expand Down Expand Up @@ -203,7 +204,7 @@ func InitWSConn(secret *tokens.Secret, deviceId string, uuid string, proxy strin
if err != nil {
return err
}
createWSConn(wssURL, connInfo, proxy, 0)
err = createWSConn(wssURL, connInfo, proxy, 0)
if err != nil {
return err
}
Expand Down

0 comments on commit e2a8152

Please sign in to comment.