diff options
author | 2021-06-27 11:46:07 +0200 | |
---|---|---|
committer | 2021-06-27 11:46:07 +0200 | |
commit | 3e6aef00b26e33181e907c9a27357003ad497b82 (patch) | |
tree | b67d0a97b39e54d3b24902b6b333fcc875d5a073 /internal/federation/federator.go | |
parent | remove regex hostname parsing (#67) (diff) | |
download | gotosocial-3e6aef00b26e33181e907c9a27357003ad497b82.tar.xz |
fix the annoying infinite handshake bug (tested) (#69)
Diffstat (limited to 'internal/federation/federator.go')
-rw-r--r-- | internal/federation/federator.go | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/internal/federation/federator.go b/internal/federation/federator.go index 016a6fb68..2ee01697f 100644 --- a/internal/federation/federator.go +++ b/internal/federation/federator.go @@ -21,6 +21,7 @@ package federation import ( "net/http" "net/url" + "sync" "github.com/go-fed/activity/pub" "github.com/sirupsen/logrus" @@ -54,6 +55,8 @@ type Federator interface { // // If username is an empty string, our instance user's credentials will be used instead. GetTransportForUser(username string) (transport.Transport, error) + // Handshaking returns true if the given username is currently in the process of dereferencing the remoteAccountID. + Handshaking(username string, remoteAccountID *url.URL) bool pub.CommonBehavior pub.FederatingProtocol } @@ -67,6 +70,8 @@ type federator struct { transportController transport.Controller actor pub.FederatingActor log *logrus.Logger + handshakes map[string][]*url.URL + handshakeSync *sync.Mutex // mutex to lock/unlock when checking or updating the handshakes map } // NewFederator returns a new federator @@ -81,6 +86,7 @@ func NewFederator(db db.DB, federatingDB federatingdb.DB, transportController tr typeConverter: typeConverter, transportController: transportController, log: log, + handshakeSync: &sync.Mutex{}, } actor := newFederatingActor(f, f, federatingDB, clock) f.actor = actor |