Make proxyconn channel response async

This commit is contained in:
9seconds
2019-11-12 10:36:32 +03:00
parent 596fafe30d
commit 27c5646680
+3 -1
View File
@@ -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,