fix: up/down traffic stats being mixed up

This commit is contained in:
WofWca 2023-01-12 08:54:59 +00:00 committed by itchyonion
parent 990fcb4127
commit 5cc849e186
No known key found for this signature in database
GPG key ID: 4B87B720348500EA
2 changed files with 2 additions and 2 deletions

View file

@ -41,7 +41,7 @@ func (p *logEventLogger) OnNewSnowflakeEvent(e event.SnowflakeEvent) {
func (p *logEventLogger) logTick() error {
inbound, inboundUnit := formatTraffic(p.inboundSum)
outbound, outboundUnit := formatTraffic(p.outboundSum)
p.logger.Printf("In the last %v, there were %v connections. Traffic Relayed ↑ %v %v, ↓ %v %v.\n",
p.logger.Printf("In the last %v, there were %v connections. Traffic Relayed ↓ %v %v, ↑ %v %v.\n",
p.logPeriod.String(), p.connectionCount, inbound, inboundUnit, outbound, outboundUnit)
p.outboundSum = 0
p.inboundSum = 0

View file

@ -80,7 +80,7 @@ func (b *bytesSyncLogger) ThroughputSummary() string {
outbound, outUnit := formatTraffic(outbound)
t := time.Now()
return fmt.Sprintf("Traffic throughput (up|down): %d %s|%d %s -- (%d OnMessages, %d Sends, over %d seconds)", inbound, inUnit, outbound, outUnit, b.outEvents, b.inEvents, int(t.Sub(b.start).Seconds()))
return fmt.Sprintf("Traffic throughput (down|up): %d %s|%d %s -- (%d OnMessages, %d Sends, over %d seconds)", inbound, inUnit, outbound, outUnit, b.outEvents, b.inEvents, int(t.Sub(b.start).Seconds()))
}
func (b *bytesSyncLogger) GetStat() (in int64, out int64) { return b.inbound, b.outbound }