Fix data races in handleProto (observed by @majestrate)

This commit is contained in:
Neil Alexander 2022-07-07 17:03:29 +01:00
parent 42d4298e19
commit 88a0a3e8fb
No known key found for this signature in database
GPG Key ID: A02A2019A2BB0944

View File

@ -65,10 +65,16 @@ func (p *protoHandler) handleProto(from phony.Actor, key keyArray, bs []byte) {
case typeProtoNodeInfoResponse: case typeProtoNodeInfoResponse:
p.nodeinfo.handleRes(p, key, bs[1:]) p.nodeinfo.handleRes(p, key, bs[1:])
case typeProtoDebug: case typeProtoDebug:
p._handleDebug(key, bs[1:]) p.handleDebug(from, key, bs[1:])
} }
} }
func (p *protoHandler) handleDebug(from phony.Actor, key keyArray, bs []byte) {
p.Act(from, func() {
p._handleDebug(key, bs)
})
}
func (p *protoHandler) _handleDebug(key keyArray, bs []byte) { func (p *protoHandler) _handleDebug(key keyArray, bs []byte) {
if len(bs) == 0 { if len(bs) == 0 {
return return