mirror of
https://github.com/yggdrasil-network/yggdrasil-go.git
synced 2025-04-28 22:25:07 +03:00
minor performance adjustments
This commit is contained in:
parent
e3d87b8ee6
commit
f929df1ea9
3 changed files with 34 additions and 15 deletions
|
@ -138,7 +138,14 @@ func (r *router) sendPacket(bs []byte) {
|
|||
fallthrough
|
||||
//default: go func() { sinfo.send<-bs }()
|
||||
default:
|
||||
sinfo.send <- bs
|
||||
for {
|
||||
select {
|
||||
case sinfo.send <- bs:
|
||||
return
|
||||
default:
|
||||
util_putBytes(<-sinfo.send)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -189,7 +196,14 @@ func (r *router) handleTraffic(packet []byte) {
|
|||
return
|
||||
}
|
||||
//go func () { sinfo.recv<-&p }()
|
||||
sinfo.recv <- &p
|
||||
for {
|
||||
select {
|
||||
case sinfo.recv <- &p:
|
||||
return
|
||||
default:
|
||||
util_putBytes((<-sinfo.recv).payload)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (r *router) handleProto(packet []byte) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue