mirror of
https://github.com/yggdrasil-network/yggdrasil-go.git
synced 2025-04-28 22:25:07 +03:00
simplify how blocking is detected and packets are dequeued
This commit is contained in:
parent
38dcbb1e2f
commit
1df305d31c
3 changed files with 11 additions and 22 deletions
|
@ -326,7 +326,6 @@ func (intf *link) handler() error {
|
|||
type linkInterface interface {
|
||||
out([][]byte)
|
||||
linkOut([]byte)
|
||||
notifyQueued(uint64)
|
||||
close()
|
||||
// These next ones are only used by the API
|
||||
name() string
|
||||
|
@ -355,15 +354,6 @@ func (intf *link) linkOut(bs []byte) {
|
|||
})
|
||||
}
|
||||
|
||||
func (intf *link) notifyQueued(seq uint64) {
|
||||
// This is the part where we want non-nil 'from' fields
|
||||
intf.Act(intf.peer, func() {
|
||||
if intf.isSending {
|
||||
intf.peer.dropFromQueue(intf, seq)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
func (intf *link) close() {
|
||||
intf.Act(nil, func() { intf.msgIO.close() })
|
||||
}
|
||||
|
@ -398,6 +388,7 @@ func (intf *link) notifySending(size int) {
|
|||
intf.isSending = true
|
||||
intf.sendTimer = time.AfterFunc(sendTime, intf.notifyBlockedSend)
|
||||
intf._cancelStallTimer()
|
||||
intf.peer.notifyBlocked(intf)
|
||||
})
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue