From 120bf39f55c8df3d70a6263ccd2bff180d5e24e2 Mon Sep 17 00:00:00 2001 From: Wim Date: Wed, 27 Feb 2019 20:52:05 +0100 Subject: [PATCH] Handle file upload/download only once for each message (#742) --- gateway/router.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/gateway/router.go b/gateway/router.go index 7d16b07d..613a2c48 100644 --- a/gateway/router.go +++ b/gateway/router.go @@ -125,6 +125,7 @@ func (r *Router) handleReceive() { r.handleEventGetChannelMembers(&msg) r.handleEventFailure(&msg) r.handleEventRejoinChannels(&msg) + idx := 0 for _, gw := range r.Gateways { // record all the message ID's of the different bridges var msgIDs []*BrMsgID @@ -133,7 +134,9 @@ func (r *Router) handleReceive() { } msg.Timestamp = time.Now() gw.modifyMessage(&msg) - gw.handleFiles(&msg) + if idx == 0 { + gw.handleFiles(&msg) + } for _, br := range gw.Bridges { msgIDs = append(msgIDs, gw.handleMessage(&msg, br)...) } @@ -141,6 +144,7 @@ func (r *Router) handleReceive() { if _, ok := gw.Messages.Get(msg.Protocol + " " + msg.ID); !ok && msg.ID != "" { gw.Messages.Add(msg.Protocol+" "+msg.ID, msgIDs) } + idx++ } } }