From 88a0a3e8fbdb174938f7222acc1dad41eca76df0 Mon Sep 17 00:00:00 2001 From: Neil Alexander Date: Thu, 7 Jul 2022 17:03:29 +0100 Subject: [PATCH] Fix data races in `handleProto` (observed by @majestrate) --- src/core/proto.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/core/proto.go b/src/core/proto.go index 5af59cc8..3c68c0e3 100644 --- a/src/core/proto.go +++ b/src/core/proto.go @@ -65,10 +65,16 @@ func (p *protoHandler) handleProto(from phony.Actor, key keyArray, bs []byte) { case typeProtoNodeInfoResponse: p.nodeinfo.handleRes(p, key, bs[1:]) 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) { if len(bs) == 0 { return