From ddd19d9eb4f4513cb288786234ad573c806e35c5 Mon Sep 17 00:00:00 2001 From: mohanson Date: Sat, 28 Sep 2024 20:14:16 +0800 Subject: [PATCH] 2024-09-28 20:14:16 --- protocol/czar/mux.go | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/protocol/czar/mux.go b/protocol/czar/mux.go index 45419c8..7dad69f 100644 --- a/protocol/czar/mux.go +++ b/protocol/czar/mux.go @@ -3,7 +3,6 @@ package czar import ( "encoding/binary" "io" - "net" "sync" "github.com/mohanson/daze/lib/doa" @@ -143,7 +142,7 @@ func NewWither(idx uint8, mux *Mux) *Stream { // Mux is used to wrap a reliable ordered connection and to multiplex it into multiple streams. type Mux struct { ach chan *Stream - con net.Conn + con io.ReadWriteCloser idp *Sip pri *priority.Priority rer *Err @@ -246,7 +245,7 @@ func (m *Mux) Recv() { } // NewMux returns a new Mux. -func NewMux(conn net.Conn) *Mux { +func NewMux(conn io.ReadWriteCloser) *Mux { mux := &Mux{ ach: make(chan *Stream), con: conn, @@ -259,7 +258,7 @@ func NewMux(conn net.Conn) *Mux { } // NewMuxServer returns a new MuxServer. -func NewMuxServer(conn net.Conn) *Mux { +func NewMuxServer(conn io.ReadWriteCloser) *Mux { mux := NewMux(conn) for i := range 256 { mux.usb[i] = NewWither(uint8(i), mux) @@ -269,7 +268,7 @@ func NewMuxServer(conn net.Conn) *Mux { } // NewMuxClient returns a new MuxClient. -func NewMuxClient(conn net.Conn) *Mux { +func NewMuxClient(conn io.ReadWriteCloser) *Mux { mux := NewMux(conn) go mux.Recv() return mux