mirror of
https://github.com/cwinfo/yggdrasil-go.git
synced 2024-11-26 00:11:36 +00:00
Merge branch 'develop' into goodbyewater
This commit is contained in:
commit
328dd6c054
@ -8,7 +8,7 @@ Group=yggdrasil
|
|||||||
ProtectHome=true
|
ProtectHome=true
|
||||||
ProtectSystem=true
|
ProtectSystem=true
|
||||||
SyslogIdentifier=yggdrasil
|
SyslogIdentifier=yggdrasil
|
||||||
CapabilityBoundingSet=CAP_NET_ADMIN
|
CapabilityBoundingSet=CAP_NET_ADMIN CAP_NET_RAW
|
||||||
ExecStartPre=+-/sbin/modprobe tun
|
ExecStartPre=+-/sbin/modprobe tun
|
||||||
ExecStartPre=/bin/sh -ec "if ! test -s /etc/yggdrasil.conf; \
|
ExecStartPre=/bin/sh -ec "if ! test -s /etc/yggdrasil.conf; \
|
||||||
then umask 077; \
|
then umask 077; \
|
||||||
|
@ -64,6 +64,7 @@ type linkInterface struct {
|
|||||||
closeTimer *time.Timer // Fires when the link has been idle so long we need to close it
|
closeTimer *time.Timer // Fires when the link has been idle so long we need to close it
|
||||||
inSwitch bool // True if the switch is tracking this link
|
inSwitch bool // True if the switch is tracking this link
|
||||||
stalled bool // True if we haven't been receiving any response traffic
|
stalled bool // True if we haven't been receiving any response traffic
|
||||||
|
unstalled bool // False if an idle notification to the switch hasn't been sent because we stalled (or are first starting up)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (l *link) init(c *Core) error {
|
func (l *link) init(c *Core) error {
|
||||||
@ -324,11 +325,15 @@ func (intf *linkInterface) notifySent(size int, isLinkTraffic bool) {
|
|||||||
|
|
||||||
// Notify the switch that we're ready for more traffic, assuming we're not in a stalled state
|
// Notify the switch that we're ready for more traffic, assuming we're not in a stalled state
|
||||||
func (intf *linkInterface) _notifySwitch() {
|
func (intf *linkInterface) _notifySwitch() {
|
||||||
if !intf.inSwitch && !intf.stalled {
|
if !intf.inSwitch {
|
||||||
intf.inSwitch = true
|
if intf.stalled {
|
||||||
intf.link.core.switchTable.Act(intf, func() {
|
intf.unstalled = false
|
||||||
intf.link.core.switchTable._idleIn(intf.peer.port)
|
} else {
|
||||||
})
|
intf.inSwitch = true
|
||||||
|
intf.link.core.switchTable.Act(intf, func() {
|
||||||
|
intf.link.core.switchTable._idleIn(intf.peer.port)
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -362,7 +367,10 @@ func (intf *linkInterface) notifyRead(size int) {
|
|||||||
intf.stallTimer = nil
|
intf.stallTimer = nil
|
||||||
}
|
}
|
||||||
intf.stalled = false
|
intf.stalled = false
|
||||||
intf._notifySwitch()
|
if !intf.unstalled {
|
||||||
|
intf._notifySwitch()
|
||||||
|
intf.unstalled = true
|
||||||
|
}
|
||||||
if size > 0 && intf.stallTimer == nil {
|
if size > 0 && intf.stallTimer == nil {
|
||||||
intf.stallTimer = time.AfterFunc(keepAliveTime, intf.notifyDoKeepAlive)
|
intf.stallTimer = time.AfterFunc(keepAliveTime, intf.notifyDoKeepAlive)
|
||||||
}
|
}
|
||||||
|
@ -814,12 +814,12 @@ func (t *switchTable) _handleIdle(port switchPort) bool {
|
|||||||
packet := buf.packets[0]
|
packet := buf.packets[0]
|
||||||
coords := switch_getPacketCoords(packet.bytes)
|
coords := switch_getPacketCoords(packet.bytes)
|
||||||
priority := float64(now.Sub(packet.time)) / float64(buf.size)
|
priority := float64(now.Sub(packet.time)) / float64(buf.size)
|
||||||
if priority > bestPriority && t.portIsCloser(coords, port) {
|
if priority >= bestPriority && t.portIsCloser(coords, port) {
|
||||||
best = streamID
|
best = streamID
|
||||||
bestPriority = priority
|
bestPriority = priority
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if bestPriority != 0 {
|
if best != "" {
|
||||||
buf := t.queues.bufs[best]
|
buf := t.queues.bufs[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
|
||||||
|
Loading…
Reference in New Issue
Block a user