File tree Expand file tree Collapse file tree 3 files changed +12
-4
lines changed
Expand file tree Collapse file tree 3 files changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -27,7 +27,7 @@ var Conf = struct {
2727 // that you are using a proxy server.
2828 Masker string
2929}{
30- Masker : "https://github.com/ " ,
30+ Masker : "https://github.com" ,
3131}
3232
3333// Server implemented the baboon protocol.
Original file line number Diff line number Diff line change @@ -41,6 +41,14 @@ import (
4141// | Sid | 2 | 0/1 | Rsv |
4242// +-----+-----+-----+-----+
4343
44+ // Conf is acting as package level configuration.
45+ var Conf = struct {
46+ // The newly created stream has a higher write priority.
47+ FastWriteDuration time.Duration
48+ }{
49+ FastWriteDuration : time .Second * 8 ,
50+ }
51+
4452// Server implemented the czar protocol.
4553type Server struct {
4654 Cipher []byte
Original file line number Diff line number Diff line change @@ -12,9 +12,9 @@ import (
1212
1313// A Stream managed by the multiplexer.
1414type Stream struct {
15+ fwd time.Time
1516 idx uint8
1617 mux * Mux
17- qtw time.Time
1818 rbf []byte
1919 rch chan []byte
2020 rer * Err
@@ -105,7 +105,7 @@ func (s *Stream) Write(p []byte) (int, error) {
105105 binary .BigEndian .PutUint16 (buf [2 :4 ], uint16 (l ))
106106 copy (buf [4 :], p [:l ])
107107 p = p [l :]
108- if time .Now ().After (s .qtw ) {
108+ if time .Now ().After (s .fwd ) {
109109 z = 2
110110 }
111111 err := s .mux .pri .Pri (z , func () error {
@@ -129,9 +129,9 @@ func (s *Stream) Write(p []byte) (int, error) {
129129// NewStream returns a new Stream.
130130func NewStream (idx uint8 , mux * Mux ) * Stream {
131131 return & Stream {
132+ fwd : time .Now ().Add (Conf .FastWriteDuration ),
132133 idx : idx ,
133134 mux : mux ,
134- qtw : time .Now ().Add (time .Second * 8 ),
135135 rbf : make ([]byte , 0 ),
136136 rch : make (chan []byte , 32 ),
137137 rer : NewErr (),
You can’t perform that action at this time.
0 commit comments