Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
fix kcp
Browse files Browse the repository at this point in the history
  • Loading branch information
nullchinchilla committed Feb 26, 2020
1 parent 413d74c commit bc79ea4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions cmd/geph-exit/handle.go
Original file line number Diff line number Diff line change
Expand Up @@ -180,8 +180,6 @@ func handle(rawClient net.Conn) {
}
go func() {
defer soxclient.Close()
atomic.AddUint64(&tunnCount, 1)
defer atomic.AddUint64(&tunnCount, ^uint64(0))
soxclient.SetDeadline(time.Now().Add(time.Minute))
var command []string
err = rlp.Decode(&io.LimitedReader{R: soxclient, N: 1000}, &command)
Expand All @@ -203,7 +201,7 @@ func handle(rawClient net.Conn) {
dialStart := time.Now()
host := command[1]
var remote net.Conn
for _, ntype := range []string{"tcp4", "tcp6"} {
for _, ntype := range []string{"tcp6", "tcp4"} {
tcpAddr, err := net.ResolveTCPAddr(ntype, host)
if err != nil || isBlack(tcpAddr) {
continue
Expand All @@ -217,6 +215,8 @@ func handle(rawClient net.Conn) {
if remote == nil {
return
}
atomic.AddUint64(&tunnCount, 1)
defer atomic.AddUint64(&tunnCount, ^uint64(0))
regConn(remote)
defer func() {
log.Debugf("<%v> cmd %v closed in %v", atomic.LoadUint64(&tunnCount), command, time.Since(dialStart))
Expand Down
8 changes: 4 additions & 4 deletions libs/kcp-go/kcp.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const (
IKCP_PROBE_LIMIT = 120000 // up to 120 secs to probe window
)

var QuiescentMax = 1
var QuiescentMax = 20

var CongestionControl = "LOL"

Expand Down Expand Up @@ -923,9 +923,9 @@ func (kcp *KCP) flush(ackOnly bool) uint32 {
var busy bool
defer func() {
if !busy {
// kcp.LOL.filledPipe = false
// kcp.LOL.fullBwCount = 0
// kcp.LOL.fullBw = 0
kcp.LOL.filledPipe = false
kcp.LOL.fullBwCount = 0
kcp.LOL.fullBw = 0
kcp.quiescent--
if kcp.quiescent <= 0 {
kcp.quiescent = 0
Expand Down

0 comments on commit bc79ea4

Please sign in to comment.