Skip to content

Commit 9687ca1

Browse files
committed
Removed fast write strategy
1 parent 6b3538c commit 9687ca1

File tree

2 files changed

+2
-11
lines changed

2 files changed

+2
-11
lines changed

protocol/czar/engine.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,6 @@ import (
5050

5151
// Conf is acting as package level configuration.
5252
var Conf = struct {
53-
// The newly created stream has a higher write priority.
54-
FastWriteDuration time.Duration
5553
// The duration a connection needs to be idle before mux begins sending out keep-alive probe.
5654
IdleProbeDuration time.Duration
5755
// If no data is read for more than this time, the connection is closed.
@@ -61,7 +59,6 @@ var Conf = struct {
6159
// will be reduced.
6260
PacketSize int
6361
}{
64-
FastWriteDuration: time.Second * 8,
6562
IdleProbeDuration: time.Second * 120,
6663
IdleReplyDuration: time.Second * 128,
6764
PacketSize: 2048,

protocol/czar/mux.go

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import (
1212

1313
// A Stream managed by the multiplexer.
1414
type Stream struct {
15-
fwu time.Time
1615
idx uint8
1716
mux *Mux
1817
rbf []byte
@@ -87,7 +86,6 @@ func (s *Stream) Write(p []byte) (int, error) {
8786
buf []byte
8887
l = 0
8988
n = 0
90-
z = 1
9189
)
9290
for {
9391
switch {
@@ -105,10 +103,7 @@ func (s *Stream) Write(p []byte) (int, error) {
105103
binary.BigEndian.PutUint16(buf[2:4], uint16(l))
106104
copy(buf[4:], p[:l])
107105
p = p[l:]
108-
if time.Now().After(s.fwu) {
109-
z = 2
110-
}
111-
err := s.mux.pri.Pri(z, func() error {
106+
err := s.mux.pri.Pri(1, func() error {
112107
if err := s.wer.Get(); err != nil {
113108
return err
114109
}
@@ -129,7 +124,6 @@ func (s *Stream) Write(p []byte) (int, error) {
129124
// NewStream returns a new Stream.
130125
func NewStream(idx uint8, mux *Mux) *Stream {
131126
return &Stream{
132-
fwu: time.Now().Add(Conf.FastWriteDuration),
133127
idx: idx,
134128
mux: mux,
135129
rbf: make([]byte, 0),
@@ -281,7 +275,7 @@ func NewMux(conn io.ReadWriteCloser) *Mux {
281275
ach: make(chan *Stream),
282276
con: conn,
283277
idp: NewSip(),
284-
pri: priority.NewPriority(3),
278+
pri: priority.NewPriority(2),
285279
rer: NewErr(),
286280
usb: make([]*Stream, 256),
287281
}

0 commit comments

Comments
 (0)