From f705480cf09d8abd8c6e43c51048f6c4bc57e861 Mon Sep 17 00:00:00 2001 From: Mark Haines Date: Tue, 27 Jun 2017 14:51:29 +0100 Subject: [PATCH] Constants and comments --- .../dendrite/federationapi/writers/send.go | 2 +- .../matrix-org/dendrite/roomserver/api/input.go | 4 ++++ .../matrix-org/dendrite/roomserver/api/output.go | 16 ++++++++-------- 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/src/github.com/matrix-org/dendrite/federationapi/writers/send.go b/src/github.com/matrix-org/dendrite/federationapi/writers/send.go index 8109ccb3b..a6013cea2 100644 --- a/src/github.com/matrix-org/dendrite/federationapi/writers/send.go +++ b/src/github.com/matrix-org/dendrite/federationapi/writers/send.go @@ -159,7 +159,7 @@ func (t *txnReq) processEvent(e gomatrixserverlib.Event) error { // TODO: Check that the event is allowed by its auth_events. // pass the event to the roomserver - if err := t.producer.SendEvents([]gomatrixserverlib.Event{e}, ""); err != nil { + if err := t.producer.SendEvents([]gomatrixserverlib.Event{e}, api.DoNotSendToOtherServers); err != nil { return err } diff --git a/src/github.com/matrix-org/dendrite/roomserver/api/input.go b/src/github.com/matrix-org/dendrite/roomserver/api/input.go index e3d8518f2..4d576aefc 100644 --- a/src/github.com/matrix-org/dendrite/roomserver/api/input.go +++ b/src/github.com/matrix-org/dendrite/roomserver/api/input.go @@ -40,6 +40,10 @@ const ( KindBackfill = 4 ) +// DoNotSendToOtherServers tells us not to send the event to other matrix +// servers. +const DoNotSendToOtherServers = "" + // InputRoomEvent is a matrix room event to add to the room server database. // TODO: Implement UnmarshalJSON/MarshalJSON in a way that does something sensible with the event JSON. type InputRoomEvent struct { diff --git a/src/github.com/matrix-org/dendrite/roomserver/api/output.go b/src/github.com/matrix-org/dendrite/roomserver/api/output.go index bc01e38f9..b6efad2e1 100644 --- a/src/github.com/matrix-org/dendrite/roomserver/api/output.go +++ b/src/github.com/matrix-org/dendrite/roomserver/api/output.go @@ -70,14 +70,14 @@ type OutputRoomEvent struct { // Or empty if this event shouldn't be pushed to other servers. // // This is used by the federation sender component. We need to tell it what - // event is needs to send because it can't tell on its own. Normally we - // if an event was created on this server then we are responsible for - // sending. However there are a couple of exceptions. The first is that - // when the server joins a remote room through another matrix server, it - // is the job of the other matrix server to send the event over federation. - // The second is the reverse of the first, that is when a remote server - // joins a room that we are in over federation using our server it is our - // responsibility to send the join event to other matrix server. + // event is needs to send because it can't tell on its own. Normally if an + // event was created on this server then we are responsible for sending it. + // However there are a couple of exceptions. The first is that when the + // server joins a remote room through another matrix server, it is the job + // of the other matrix server to send the event over federation. The second + // is the reverse of the first, that is when a remote server joins a room + // that we are in over federation using our server it is our responsibility + // to send the join event to other matrix servers. // // We encode the server name that the event should be sent using here to // future proof the API for virtual hosting.