summaryrefslogtreecommitdiffstats
path: root/gateway
diff options
context:
space:
mode:
authorWim <wim@42.be>2019-02-27 20:52:05 +0100
committerGitHub <noreply@github.com>2019-02-27 20:52:05 +0100
commit120bf39f55c8df3d70a6263ccd2bff180d5e24e2 (patch)
tree2994d85130de6b7c329f8e904d78a0bd9a59882d /gateway
parent26a7e35f2777b8424477eef1838125a6ae55fe48 (diff)
downloadmatterbridge-msglm-120bf39f55c8df3d70a6263ccd2bff180d5e24e2.tar.gz
matterbridge-msglm-120bf39f55c8df3d70a6263ccd2bff180d5e24e2.tar.bz2
matterbridge-msglm-120bf39f55c8df3d70a6263ccd2bff180d5e24e2.zip
Handle file upload/download only once for each message (#742)
Diffstat (limited to 'gateway')
-rw-r--r--gateway/router.go6
1 files changed, 5 insertions, 1 deletions
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++
}
}
}