mirror of
https://github.com/ScuroNeko/mtg.git
synced 2026-09-02 00:11:56 +03:00
Get rid of buffersize everywhere
This commit is contained in:
@@ -3,16 +3,14 @@ package relay
|
||||
import (
|
||||
"context"
|
||||
"io"
|
||||
"net"
|
||||
"sync"
|
||||
)
|
||||
|
||||
func Relay(ctx context.Context, log Logger, bufferSize int,
|
||||
telegramConn net.Conn, clientConn io.ReadWriteCloser) {
|
||||
func Relay(ctx context.Context, log Logger, telegramConn, clientConn io.ReadWriteCloser) {
|
||||
defer telegramConn.Close()
|
||||
defer clientConn.Close()
|
||||
|
||||
ctx, cancel := context.WithTimeout(ctx, getConnectionTimeToLive())
|
||||
ctx, cancel := context.WithCancel(ctx)
|
||||
defer cancel()
|
||||
|
||||
go func() {
|
||||
@@ -21,13 +19,9 @@ func Relay(ctx context.Context, log Logger, bufferSize int,
|
||||
clientConn.Close()
|
||||
}()
|
||||
|
||||
buffers := acquireEastWest(bufferSize)
|
||||
buffers := acquireEastWest()
|
||||
defer releaseEastWest(buffers)
|
||||
|
||||
telegramConn = conn{
|
||||
Conn: telegramConn,
|
||||
}
|
||||
|
||||
wg := &sync.WaitGroup{}
|
||||
wg.Add(2) // nolint: gomnd
|
||||
|
||||
|
||||
Reference in New Issue
Block a user