@@ -248,6 +248,7 @@ func (c *wsStreamCreator) readDemuxLoop(bufferSize int, period time.Duration, de
248
248
// Initialize and start the ping/pong heartbeat.
249
249
h := newHeartbeat (c .conn , period , deadline )
250
250
// Set initial timeout for websocket connection reading.
251
+ klog .V (5 ).Infof ("Websocket initial read deadline: %s" , deadline )
251
252
if err := c .conn .SetReadDeadline (time .Now ().Add (deadline )); err != nil {
252
253
klog .Errorf ("Websocket initial setting read deadline failed %v" , err )
253
254
return
@@ -354,16 +355,16 @@ func (s *stream) Read(p []byte) (n int, err error) {
354
355
355
356
// Write writes directly to the underlying WebSocket connection.
356
357
func (s * stream ) Write (p []byte ) (n int , err error ) {
357
- klog .V (4 ).Infof ("Write() on stream %d" , s .id )
358
- defer klog .V (4 ).Infof ("Write() done on stream %d" , s .id )
358
+ klog .V (8 ).Infof ("Write() on stream %d" , s .id )
359
+ defer klog .V (8 ).Infof ("Write() done on stream %d" , s .id )
359
360
s .connWriteLock .Lock ()
360
361
defer s .connWriteLock .Unlock ()
361
362
if s .conn == nil {
362
363
return 0 , fmt .Errorf ("write on closed stream %d" , s .id )
363
364
}
364
365
err = s .conn .SetWriteDeadline (time .Now ().Add (writeDeadline ))
365
366
if err != nil {
366
- klog .V (7 ).Infof ("Websocket setting write deadline failed %v" , err )
367
+ klog .V (4 ).Infof ("Websocket setting write deadline failed %v" , err )
367
368
return 0 , err
368
369
}
369
370
// Message writer buffers the message data, so we don't need to do that ourselves.
@@ -392,8 +393,8 @@ func (s *stream) Write(p []byte) (n int, err error) {
392
393
393
394
// Close half-closes the stream, indicating this side is finished with the stream.
394
395
func (s * stream ) Close () error {
395
- klog .V (4 ).Infof ("Close() on stream %d" , s .id )
396
- defer klog .V (4 ).Infof ("Close() done on stream %d" , s .id )
396
+ klog .V (6 ).Infof ("Close() on stream %d" , s .id )
397
+ defer klog .V (6 ).Infof ("Close() done on stream %d" , s .id )
397
398
s .connWriteLock .Lock ()
398
399
defer s .connWriteLock .Unlock ()
399
400
if s .conn == nil {
@@ -452,7 +453,7 @@ func newHeartbeat(conn *gwebsocket.Conn, period time.Duration, deadline time.Dur
452
453
// be empty.
453
454
h .conn .SetPongHandler (func (msg string ) error {
454
455
// Push the read deadline into the future.
455
- klog .V (8 ).Infof ("Pong message received (%s)--resetting read deadline" , msg )
456
+ klog .V (6 ).Infof ("Pong message received (%s)--resetting read deadline" , msg )
456
457
err := h .conn .SetReadDeadline (time .Now ().Add (deadline ))
457
458
if err != nil {
458
459
klog .Errorf ("Websocket setting read deadline failed %v" , err )
@@ -487,14 +488,14 @@ func (h *heartbeat) start() {
487
488
for {
488
489
select {
489
490
case <- h .closer :
490
- klog .V (8 ).Infof ("closed channel--returning" )
491
+ klog .V (5 ).Infof ("closed channel--returning" )
491
492
return
492
493
case <- t .C :
493
494
// "WriteControl" does not need to be protected by a mutex. According to
494
495
// gorilla/websockets library docs: "The Close and WriteControl methods can
495
496
// be called concurrently with all other methods."
496
497
if err := h .conn .WriteControl (gwebsocket .PingMessage , h .message , time .Now ().Add (pingReadDeadline )); err == nil {
497
- klog .V (8 ).Infof ("Websocket Ping succeeeded" )
498
+ klog .V (6 ).Infof ("Websocket Ping succeeeded" )
498
499
} else {
499
500
klog .Errorf ("Websocket Ping failed: %v" , err )
500
501
if errors .Is (err , gwebsocket .ErrCloseSent ) {
0 commit comments