Actually embedd connStandard into connEventTraffic

This commit is contained in:
9seconds
2021-03-22 18:41:54 +03:00
parent 42160a08fe
commit f7c33ee333
2 changed files with 6 additions and 6 deletions
+5 -5
View File
@@ -53,7 +53,7 @@ func (c connStandard) SetWriteDeadline(t time.Time) error {
} }
type connEventTraffic struct { type connEventTraffic struct {
net.Conn connStandard
connID string connID string
stream EventStream stream EventStream
@@ -61,7 +61,7 @@ type connEventTraffic struct {
} }
func (c connEventTraffic) Read(b []byte) (int, error) { func (c connEventTraffic) Read(b []byte) (int, error) {
n, err := c.Conn.Read(b) n, err := c.connStandard.Read(b)
if n > 0 { if n > 0 {
c.stream.Send(c.ctx, EventTraffic{ c.stream.Send(c.ctx, EventTraffic{
@@ -72,11 +72,11 @@ func (c connEventTraffic) Read(b []byte) (int, error) {
}) })
} }
return n, err // nolint: wrapcheck return n, err
} }
func (c connEventTraffic) Write(b []byte) (int, error) { func (c connEventTraffic) Write(b []byte) (int, error) {
n, err := c.Conn.Write(b) n, err := c.connStandard.Write(b)
if n > 0 { if n > 0 {
c.stream.Send(c.ctx, EventTraffic{ c.stream.Send(c.ctx, EventTraffic{
@@ -87,5 +87,5 @@ func (c connEventTraffic) Write(b []byte) (int, error) {
}) })
} }
return n, err // nolint: wrapcheck return n, err
} }
+1 -1
View File
@@ -130,7 +130,7 @@ func (p *Proxy) doTelegramCall(ctx *streamContext) error {
} }
ctx.telegramConn = connEventTraffic{ ctx.telegramConn = connEventTraffic{
Conn: connStandard{ connStandard: connStandard{
conn: conn, conn: conn,
idleTimeout: p.idleTimeout, idleTimeout: p.idleTimeout,
}, },