diff --git a/protocol/czar/mux.go b/protocol/czar/mux.go index 92a9d65..1d6cba9 100644 --- a/protocol/czar/mux.go +++ b/protocol/czar/mux.go @@ -11,7 +11,6 @@ import ( // A Stream managed by the multiplexer. type Stream struct { - idp *Sip idx uint8 mux *Mux rbf []byte @@ -46,7 +45,7 @@ func (s *Stream) Esolc() error { }) }) s.zo1.Do(func() { - s.idp.Put(s.idx) + s.mux.idp.Put(s.idx) }) return nil } @@ -120,7 +119,6 @@ func (s *Stream) Write(p []byte) (int, error) { // NewStream returns a new Stream. func NewStream(idx uint8, mux *Mux) *Stream { return &Stream{ - idp: nil, idx: idx, mux: mux, rbf: make([]byte, 0), @@ -181,7 +179,6 @@ func (m *Mux) Open() (*Stream, error) { return nil, err } stm = NewStream(idx, m) - stm.idp = m.idp m.usb[idx] = stm return stm, nil } @@ -215,9 +212,7 @@ func (m *Mux) Recv() { break } stm = NewStream(idx, m) - // The mux server does not need to using an id pool. - stm.idp = m.idp - stm.idp.Set(idx) + m.idp.Set(idx) m.usb[idx] = stm m.ach <- stm case cmd == 0x01: diff --git a/protocol/czar/sip.go b/protocol/czar/sip.go index a4482ae..84cb7b4 100644 --- a/protocol/czar/sip.go +++ b/protocol/czar/sip.go @@ -43,7 +43,7 @@ func (s *Sip) Set(x uint8) { s.i = s.i.SetBit(s.i, int(x), 1) } -// NewSip returns a new sid. +// NewSip returns a new sip. func NewSip() *Sip { return &Sip{ i: big.NewInt(0),