File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ import (
1010 "time"
1111
1212 "github.com/libraries/daze"
13+ "github.com/libraries/daze/lib/expvpp"
1314 "github.com/libraries/daze/lib/rate"
1415 "github.com/libraries/daze/protocol/ashe"
1516)
@@ -55,6 +56,13 @@ var Conf = struct {
5556 StreamPool : 256 ,
5657}
5758
59+ // Expv is a simple wrapper around the expvars package.
60+ var Expv = struct {
61+ StreamWriteSize * expvpp.Average
62+ }{
63+ StreamWriteSize : expvpp .NewAverage ("Protocol.Czar.Stream.WriteSize" , 64 ),
64+ }
65+
5866// Server implemented the czar protocol.
5967type Server struct {
6068 Cipher []byte
Original file line number Diff line number Diff line change @@ -90,6 +90,7 @@ func (s *Stream) Read(p []byte) (int, error) {
9090
9191// Write implements io.Writer.
9292func (s * Stream ) Write (p []byte ) (int , error ) {
93+ Expv .StreamWriteSize .Append (float64 (len (p )))
9394 var (
9495 buf []byte
9596 l = 0
@@ -248,10 +249,6 @@ func (m *Mux) Recv() {
248249 m .ach <- stm
249250 case 0x01 :
250251 bsz = binary .BigEndian .Uint16 (buf [2 :4 ])
251- if int (bsz ) > Conf .PacketSize - 4 {
252- m .con .Close ()
253- break
254- }
255252 msg = make ([]byte , bsz )
256253 _ , err = io .ReadFull (m .con , msg )
257254 if err != nil {
You can’t perform that action at this time.
0 commit comments