mirror of
https://mau.dev/mautrix/go.git
synced 2026-03-14 14:25:53 +01:00
bridgev2: add optional stop method for network connectors
This commit is contained in:
parent
efc532bfb2
commit
965008e846
2 changed files with 8 additions and 0 deletions
|
|
@ -216,6 +216,9 @@ func (br *Bridge) Stop() {
|
|||
}
|
||||
wg.Wait()
|
||||
br.cacheLock.Unlock()
|
||||
if stopNet, ok := br.Network.(StoppableNetwork); ok {
|
||||
stopNet.Stop()
|
||||
}
|
||||
err := br.DB.Close()
|
||||
if err != nil {
|
||||
br.Log.Warn().Err(err).Msg("Failed to close database")
|
||||
|
|
|
|||
|
|
@ -229,6 +229,11 @@ type NetworkConnector interface {
|
|||
CreateLogin(ctx context.Context, user *User, flowID string) (LoginProcess, error)
|
||||
}
|
||||
|
||||
type StoppableNetwork interface {
|
||||
// Stop is called when the bridge is stopping, after all network clients have been disconnected.
|
||||
Stop()
|
||||
}
|
||||
|
||||
// DirectMediableNetwork is an optional interface that network connectors can implement to support direct media access.
|
||||
//
|
||||
// If the Matrix connector has direct media enabled, SetUseDirectMedia will be called
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue