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
This commit is contained in:
Neil Alexander 2020-07-08 14:52:48 +01:00
parent de0f427ddc
commit af6bc47f16
No known key found for this signature in database
GPG key ID: A02A2019A2BB0944
6 changed files with 100 additions and 5 deletions

View file

@ -16,6 +16,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/config"
"github.com/matrix-org/dendrite/internal/httputil"
"github.com/matrix-org/dendrite/internal/setup"
@ -23,6 +24,7 @@ import (
"github.com/matrix-org/dendrite/userapi"
"github.com/matrix-org/gomatrixserverlib"
"github.com/sirupsen/logrus"
"github.com/yggdrasil-network/yggdrasil-go/src/crypto"
)
type DendriteMonolith struct {
@ -158,6 +160,32 @@ func (m *DendriteMonolith) Start() {
base.UseHTTPAPIs,
)
ygg.NotifySessionNew(func(boxPubKey crypto.BoxPubKey) {
serv := gomatrixserverlib.ServerName(boxPubKey.String())
req := &api.PerformServersAliveRequest{
Servers: []gomatrixserverlib.ServerName{serv},
}
res := &api.PerformServersAliveResponse{}
if err := fsAPI.PerformServersAlive(context.TODO(), req, res); err != nil {
logrus.WithError(err).Warnf("Failed to notify server %q alive due to new session", serv)
} else {
logrus.Infof("Notified server %q alive due to new session", serv)
}
})
ygg.NotifyLinkNew(func(boxPubKey crypto.BoxPubKey, linkType, remote string) {
serv := gomatrixserverlib.ServerName(boxPubKey.String())
req := &api.PerformServersAliveRequest{
Servers: []gomatrixserverlib.ServerName{serv},
}
res := &api.PerformServersAliveResponse{}
if err := fsAPI.PerformServersAlive(context.TODO(), req, res); err != nil {
logrus.WithError(err).Warnf("Failed to notify server %q alive due to new peer", serv)
} else {
logrus.Infof("Notified server %q alive due to new peer", serv)
}
})
// Build both ends of a HTTP multiplex.
httpServer := &http.Server{
Addr: ":0",