correctly call peer.sendPacketsFrom in the switch

This commit is contained in:
Arceliar 2019-08-24 16:04:05 -05:00
parent 8c7e9ec7c0
commit 209d2ffea5
2 changed files with 5 additions and 6 deletions

View file

@ -224,9 +224,9 @@ func (p *peer) _handlePacket(packet []byte) {
}
switch pType {
case wire_Traffic:
p._handleTraffic(packet, pTypeLen)
p._handleTraffic(packet)
case wire_ProtocolTraffic:
p._handleTraffic(packet, pTypeLen)
p._handleTraffic(packet)
case wire_LinkProtocolTraffic:
p._handleLinkTraffic(packet)
default:
@ -236,7 +236,7 @@ func (p *peer) _handlePacket(packet []byte) {
// Called to handle traffic or protocolTraffic packets.
// In either case, this reads from the coords of the packet header, does a switch lookup, and forwards to the next node.
func (p *peer) _handleTraffic(packet []byte, pTypeLen int) {
func (p *peer) _handleTraffic(packet []byte) {
table := p.core.switchTable.getTable()
if _, isIn := table.elems[p.port]; !isIn && p.port != 0 {
// Drop traffic if the peer isn't in the switch