aboutsummaryrefslogtreecommitdiff
path: root/cmd/dendrite-demo-yggdrasil/main.go
diff options
context:
space:
mode:
authorNeil Alexander <neilalexander@users.noreply.github.com>2020-07-08 14:52:48 +0100
committerNeil Alexander <neilalexander@users.noreply.github.com>2020-07-08 14:52:48 +0100
commitaf6bc47f1654cfcb6b4834da08308fe4c6291d36 (patch)
tree1161d0b87a6a624440e9623cbb9b2ee8e2a4b8b9 /cmd/dendrite-demo-yggdrasil/main.go
parentde0f427ddc1053e8c5eb9203c0ad0b5589895cd8 (diff)
Squashed commit of the following:
commit b4cb47aa1329d2ada10ae6426fd9d2a69f47536a Author: Neil Alexander <neilalexander@users.noreply.github.com> Date: Wed Jul 8 14:13:27 2020 +0100 Restrict transaction send context time commit 7c28205cdb5d842071d46b1ec599d09cca708e57 Author: Neil Alexander <neilalexander@users.noreply.github.com> Date: Wed Jul 8 14:00:06 2020 +0100 Add to gobind build commit d9e2c72e0576a2eb0ce6ac48eed6cc9d4761a0ea Author: Neil Alexander <neilalexander@users.noreply.github.com> Date: Wed Jul 8 13:43:21 2020 +0100 Wake up destination queues for new sessions/links commit 21766c6c52bd00511d28981457e9034358c32a8d Author: Neil Alexander <neilalexander@users.noreply.github.com> Date: Wed Jul 8 13:17:18 2020 +0100 Tweak QUIC parameters
Diffstat (limited to 'cmd/dendrite-demo-yggdrasil/main.go')
-rw-r--r--cmd/dendrite-demo-yggdrasil/main.go26
1 files changed, 26 insertions, 0 deletions
diff --git a/cmd/dendrite-demo-yggdrasil/main.go b/cmd/dendrite-demo-yggdrasil/main.go
index b2d40f4f..f64bb251 100644
--- a/cmd/dendrite-demo-yggdrasil/main.go
+++ b/cmd/dendrite-demo-yggdrasil/main.go
@@ -32,6 +32,7 @@ import (
"github.com/matrix-org/dendrite/eduserver"
"github.com/matrix-org/dendrite/eduserver/cache"
"github.com/matrix-org/dendrite/federationsender"
+ "github.com/matrix-org/dendrite/federationsender/api"
"github.com/matrix-org/dendrite/internal"
"github.com/matrix-org/dendrite/internal/config"
"github.com/matrix-org/dendrite/internal/httputil"
@@ -39,6 +40,7 @@ import (
"github.com/matrix-org/dendrite/roomserver"
"github.com/matrix-org/dendrite/userapi"
"github.com/matrix-org/gomatrixserverlib"
+ "github.com/yggdrasil-network/yggdrasil-go/src/crypto"
"github.com/sirupsen/logrus"
)
@@ -150,6 +152,30 @@ func main() {
base.UseHTTPAPIs,
)
+ ygg.NotifySessionNew(func(boxPubKey crypto.BoxPubKey) {
+ req := &api.PerformServersAliveRequest{
+ Servers: []gomatrixserverlib.ServerName{
+ gomatrixserverlib.ServerName(boxPubKey.String()),
+ },
+ }
+ res := &api.PerformServersAliveResponse{}
+ if err := fsAPI.PerformServersAlive(context.TODO(), req, res); err != nil {
+ logrus.WithError(err).Warn("Failed to notify server alive due to new session")
+ }
+ })
+
+ ygg.NotifyLinkNew(func(boxPubKey crypto.BoxPubKey, linkType, remote string) {
+ req := &api.PerformServersAliveRequest{
+ Servers: []gomatrixserverlib.ServerName{
+ gomatrixserverlib.ServerName(boxPubKey.String()),
+ },
+ }
+ res := &api.PerformServersAliveResponse{}
+ if err := fsAPI.PerformServersAlive(context.TODO(), req, res); err != nil {
+ logrus.WithError(err).Warn("Failed to notify server alive due to new link")
+ }
+ })
+
// Build both ends of a HTTP multiplex.
httpServer := &http.Server{
Addr: ":0",