mirror of
https://github.com/ScuroNeko/mtg.git
synced 2026-09-01 01:14:03 +03:00
Actually embedd connStandard into connEventTraffic
This commit is contained in:
+5
-5
@@ -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
@@ -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,
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user