prevent PMTUVerfied handling from blocking

...due to blocking on sending the pmtu to the forwarder, because the
forwarder has terminated.

Fixes #464.
This commit is contained in:
Matthias Radestock committed 2015-03-29 14:04:28 +01:00
1 parent fc22f9664e
commit d708cb7d4e
2 files changed
+34 -20

No files matched your search

+11 -2
View File
@@ -53,7 +53,6 @@ type LocalConnection struct {
fragTest *time.Ticker
forwarder *Forwarder
forwarderDF *Forwarder
verifyPMTU chan<- int
Decryptor Decryptor
Router *Router
uid uint64
@@ -166,6 +165,16 @@ func (conn *LocalConnection) setStackFrag(frag bool) {
conn.stackFrag = frag
}
// Called by the connection's TCP receiver process.
func (conn *LocalConnection) pmtuVerified(pmtu int) {
conn.RLock()
fwd := conn.forwarderDF
conn.RUnlock()
if fwd != nil {
fwd.PMTUVerified(pmtu)
}
}
// Send directly, not via the Actor. If it goes via the Actor we can
// get a deadlock where LocalConnection is blocked talking to
// LocalPeer and LocalPeer is blocked trying send a ProtocolMsg via
@@ -440,7 +449,7 @@ func (conn *LocalConnection) handleProtocolMsg(tag ProtocolTag, payload []byte)
}
conn.Decryptor.ReceiveNonce(payload)
case ProtocolPMTUVerified:
conn.verifyPMTU <- int(binary.BigEndian.Uint16(payload))
conn.pmtuVerified(int(binary.BigEndian.Uint16(payload)))
case ProtocolGossipUnicast:
return conn.Router.handleGossip(payload, deliverGossipUnicast)
case ProtocolGossipBroadcast: