mirror of
https://github.com/openlibrecommunity/olcrtc.git
synced 2026-06-02 18:39:46 +00:00
refactor: remove debug logging and unused queue monitor
This commit is contained in:
@@ -7,7 +7,6 @@ import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"log"
|
||||
"math/rand/v2"
|
||||
"net/http"
|
||||
"runtime"
|
||||
@@ -379,11 +378,6 @@ func (p *Peer) setupDataChannelHandlers(dcReady chan struct{}, sessionCloseCh ch
|
||||
p.processSendQueue(workerID, sessionCloseCh)
|
||||
}(i)
|
||||
}
|
||||
p.wg.Add(1)
|
||||
go func() {
|
||||
defer p.wg.Done()
|
||||
p.monitorQueue(sessionCloseCh)
|
||||
}()
|
||||
close(dcReady)
|
||||
})
|
||||
|
||||
@@ -1437,26 +1431,6 @@ func (p *Peer) calculateDelay() time.Duration {
|
||||
return minDelay + time.Duration(rand.Int64N(int64(maxDelay-minDelay)))
|
||||
}
|
||||
|
||||
func (p *Peer) monitorQueue(sessionCloseCh <-chan struct{}) {
|
||||
ticker := time.NewTicker(5 * time.Second)
|
||||
defer ticker.Stop()
|
||||
|
||||
for {
|
||||
select {
|
||||
case <-sessionCloseCh:
|
||||
return
|
||||
case <-p.closeCh:
|
||||
return
|
||||
case <-ticker.C:
|
||||
queueLen := len(p.sendQueue)
|
||||
buffered := p.dc.BufferedAmount()
|
||||
if queueLen > 100 || buffered > 1024*1024 {
|
||||
log.Printf("queue=%d buf=%dMB", queueLen, buffered/(1024*1024))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// CanSend checks if data can be sent.
|
||||
func (p *Peer) CanSend() bool {
|
||||
if p.onData == nil {
|
||||
|
||||
@@ -517,16 +517,12 @@ func (p *streamTransport) handleFrame(frame []byte) {
|
||||
return
|
||||
}
|
||||
|
||||
logger.Debugf("videochannel extracted visual payload: len=%d", len(payload))
|
||||
|
||||
decoded, err := decodeTransportFrame(payload)
|
||||
if err != nil {
|
||||
logger.Debugf("videochannel decode transport frame error: %v", err)
|
||||
return
|
||||
}
|
||||
|
||||
logger.Debugf("videochannel transport frame: type=%d seq=%d crc=%x", decoded.typ, decoded.seq, decoded.crc)
|
||||
|
||||
switch decoded.typ {
|
||||
case frameTypeAck:
|
||||
p.resolveAck(decoded.seq, decoded.crc)
|
||||
|
||||
Reference in New Issue
Block a user