Skip to content

Commit

Permalink
client bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
yisier committed Nov 1, 2022
1 parent 8be1e9f commit 00315a8
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions lib/goroutine/pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ func CopyBuffer(dst io.Writer, src io.Reader, flow *file.Flow, task *file.Tunnel
}
//logs.Info("HTTP Request: " + firstLine[0:strings.Index(firstLine, "\n")])
//logs.Info("%s request, method %s, host %s, url %s, remote address %s, target %s", r.URL.Scheme, r.Method, r.Host, r.URL.Path, c.RemoteAddr().String(), lk.Host)

}

task.IsHttp = true
Expand All @@ -78,13 +77,15 @@ func CopyBuffer(dst io.Writer, src io.Reader, flow *file.Flow, task *file.Tunnel
nw, ew := dst.Write(buf[0:nr])
if nw > 0 {
//written += int64(nw)
flow.Add(int64(nw), int64(nw))

// <<20 = 1024 * 1024
if flow.FlowLimit > 0 && (flow.FlowLimit<<20) < (flow.ExportFlow+flow.InletFlow) {
logs.Info("流量已经超出.........")
break
if flow != nil {
flow.Add(int64(nw), int64(nw))
// <<20 = 1024 * 1024
if flow.FlowLimit > 0 && (flow.FlowLimit<<20) < (flow.ExportFlow+flow.InletFlow) {
logs.Info("流量已经超出.........")
break
}
}

}
if ew != nil {
err = ew
Expand Down

0 comments on commit 00315a8

Please sign in to comment.