Skip to content

Commit 0c368c0

Browse files
authored
Merge pull request #95 from SenseUnit/revert_conn_timelimit
Revert conn time limit
2 parents 512e0ab + c15ca0b commit 0c368c0

File tree

2 files changed

+0
-14
lines changed

2 files changed

+0
-14
lines changed

README.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,8 +207,6 @@ Usage of /home/user/go/bin/dumbproxy:
207207
enable TLS and use certificate
208208
-ciphers string
209209
colon-separated list of enabled ciphers
210-
-conn-time-limit duration
211-
hard time limit for connections (default 6h0m0s)
212210
-disable-http2
213211
disable HTTP2
214212
-hmac-genkey

main.go

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ package main
22

33
import (
44
"bytes"
5-
"context"
65
"crypto/rand"
76
"crypto/tls"
87
"crypto/x509"
@@ -156,7 +155,6 @@ type CLIArgs struct {
156155
bwLimit uint64
157156
bwBuckets uint
158157
bwSeparate bool
159-
connTimeLimit time.Duration
160158
reqHeaderTimeout time.Duration
161159
}
162160

@@ -199,7 +197,6 @@ func parse_args() CLIArgs {
199197
flag.Uint64Var(&args.bwLimit, "bw-limit", 0, "per-user bandwidth limit in bytes per second")
200198
flag.UintVar(&args.bwBuckets, "bw-limit-buckets", 1024*1024, "number of buckets of bandwidth limit")
201199
flag.BoolVar(&args.bwSeparate, "bw-limit-separate", false, "separate upload and download bandwidth limits")
202-
flag.DurationVar(&args.connTimeLimit, "conn-time-limit", 6*time.Hour, "hard time limit for connections")
203200
flag.DurationVar(&args.reqHeaderTimeout, "req-header-timeout", 30*time.Second, "amount of time allowed to read request headers")
204201
flag.Parse()
205202
args.positionalArgs = flag.Args()
@@ -270,14 +267,6 @@ func run() int {
270267
d = newDialer
271268
}
272269

273-
var srvConnContext func(ctx context.Context, c net.Conn) context.Context
274-
if args.connTimeLimit > 0 {
275-
srvConnContext = func(ctx context.Context, c net.Conn) context.Context {
276-
newCtx, _ := context.WithTimeout(ctx, args.connTimeLimit)
277-
return newCtx
278-
}
279-
}
280-
281270
forwarder := forward.PairConnections
282271
if args.bwLimit != 0 {
283272
forwarder = forward.NewBWLimit(
@@ -301,7 +290,6 @@ func run() int {
301290
ReadHeaderTimeout: args.reqHeaderTimeout,
302291
WriteTimeout: 0,
303292
IdleTimeout: 0,
304-
ConnContext: srvConnContext,
305293
}
306294

307295
if args.disableHTTP2 {

0 commit comments

Comments
 (0)