Skip to content

Commit

Permalink
2024-09-28 20:14:16
Browse files Browse the repository at this point in the history
  • Loading branch information
mohanson committed Sep 28, 2024
1 parent 0e48c61 commit ddd19d9
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions protocol/czar/mux.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package czar
import (
"encoding/binary"
"io"
"net"
"sync"

"github.com/mohanson/daze/lib/doa"
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand All @@ -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)
Expand All @@ -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
Expand Down

0 comments on commit ddd19d9

Please sign in to comment.