mirror of
https://github.com/ScuroNeko/mtg.git
synced 2026-09-01 16:01:55 +03:00
Make proxyconn channel response async
This commit is contained in:
+3
-1
@@ -12,6 +12,8 @@ import (
|
|||||||
const (
|
const (
|
||||||
proxyConnWriteTimeout = 2 * time.Minute
|
proxyConnWriteTimeout = 2 * time.Minute
|
||||||
proxyConnReadTimeout = 2 * time.Minute
|
proxyConnReadTimeout = 2 * time.Minute
|
||||||
|
|
||||||
|
proxyConnBackpressureAfter = 10
|
||||||
)
|
)
|
||||||
|
|
||||||
type ProxyConn struct {
|
type ProxyConn struct {
|
||||||
@@ -69,7 +71,7 @@ func (p *ProxyConn) Close() {
|
|||||||
|
|
||||||
func newProxyConn(req *protocol.TelegramRequest, channelClosed chan<- conntypes.ConnID) *ProxyConn {
|
func newProxyConn(req *protocol.TelegramRequest, channelClosed chan<- conntypes.ConnID) *ProxyConn {
|
||||||
return &ProxyConn{
|
return &ProxyConn{
|
||||||
channelResponse: make(chan *rpc.ProxyResponse),
|
channelResponse: make(chan *rpc.ProxyResponse, proxyConnBackpressureAfter),
|
||||||
channelDone: make(chan struct{}),
|
channelDone: make(chan struct{}),
|
||||||
channelClosed: channelClosed,
|
channelClosed: channelClosed,
|
||||||
req: req,
|
req: req,
|
||||||
|
|||||||
Reference in New Issue
Block a user