From 9f90cc456cbe7070abeecc9edf47c439612ad77e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=BA=90=E6=96=87=E9=9B=A8?= <41315874+fumiama@users.noreply.github.com> Date: Fri, 15 Apr 2022 16:58:23 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81=E7=BB=93?= =?UTF-8?q?=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- gold/link/me.go | 5 ++++- gold/link/recv.go | 10 ---------- 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/gold/link/me.go b/gold/link/me.go index 62c4922..754f95f 100644 --- a/gold/link/me.go +++ b/gold/link/me.go @@ -92,7 +92,10 @@ func NewMe(cfg *MyConfig) (m Me) { m.srcport = cfg.SrcPort m.dstport = cfg.DstPort m.mtu = cfg.MTU & 0xfff8 - m.initrecvpool() + if m.writer == nil { + m.writer = helper.SelectWriter() + } + m.recving = ttl.NewCache[[32]byte, *head.Packet](time.Second * 128) return } diff --git a/gold/link/recv.go b/gold/link/recv.go index 1bd009b..cf5337c 100644 --- a/gold/link/recv.go +++ b/gold/link/recv.go @@ -3,13 +3,10 @@ package link import ( "encoding/binary" "encoding/hex" - "time" "unsafe" "github.com/fumiama/WireGold/gold/head" - "github.com/fumiama/WireGold/helper" "github.com/sirupsen/logrus" - "github.com/wdvxdr1123/ZeroBot/extension/ttl" ) // Read 从 peer 收包 @@ -17,13 +14,6 @@ func (l *Link) Read() *head.Packet { return <-l.pipe } -func (m *Me) initrecvpool() { - if m.writer == nil { - m.writer = helper.SelectWriter() - } - m.recving = ttl.NewCache[[32]byte, *head.Packet](time.Second * 128) -} - func (m *Me) wait(data []byte) *head.Packet { flags := binary.LittleEndian.Uint16(data[10:12]) logrus.Debugln("[recv]", len(data), "bytes data with flag", hex.EncodeToString(data[10:12]))