This commit is contained in:
Arceliar 2018-07-04 21:43:42 -05:00
parent 7539c0e4fe
commit 5261bac1d8

View file

@ -589,7 +589,6 @@ func (t *switchTable) handleIn(packet []byte, idle map[switchPort]struct{}) bool
// Info about a buffered packet // Info about a buffered packet
type switch_packetInfo struct { type switch_packetInfo struct {
bytes []byte bytes []byte
//time time.Time // Timestamp of when the packet arrived
} }
// Used to keep track of buffered packets // Used to keep track of buffered packets
@ -634,12 +633,10 @@ func (t *switchTable) handleIdle(port switchPort, buffs map[string]switch_buffer
} }
} }
if bestSize != 0 { if bestSize != 0 {
t.core.log.Println("DEBUG:", []byte(best), bestSize)
buf := buffs[best] buf := buffs[best]
var packet switch_packetInfo var packet switch_packetInfo
// TODO decide if this should be LIFO or FIFO // TODO decide if this should be LIFO or FIFO
packet, buf.packets = buf.packets[0], buf.packets[1:] packet, buf.packets = buf.packets[0], buf.packets[1:]
//buf.count-- // Force flooding connections to eventually yield
if len(buf.packets) == 0 { if len(buf.packets) == 0 {
delete(buffs, best) delete(buffs, best)
} else { } else {
@ -676,7 +673,7 @@ func (t *switchTable) doWorker() {
streamID := switch_getPacketStreamID(packet) streamID := switch_getPacketStreamID(packet)
buf := buffs[streamID] buf := buffs[streamID]
t.cleanBuffer(&buf) t.cleanBuffer(&buf)
pinfo := switch_packetInfo{packet/*, time.Now()*/} pinfo := switch_packetInfo{packet}
buf.packets = append(buf.packets, pinfo) buf.packets = append(buf.packets, pinfo)
buf.count++ buf.count++
buffs[streamID] = buf buffs[streamID] = buf