mirror of
https://github.com/mautrix/signal.git
synced 2025-03-14 14:15:36 +00:00
client: consume unauth websocket status in ConnectBackground
This commit is contained in:
parent
e55601d0e0
commit
074a2a9bef
2 changed files with 15 additions and 2 deletions
|
@ -225,7 +225,7 @@ func (s *SignalClient) Connect(ctx context.Context) {
|
|||
|
||||
func (s *SignalClient) ConnectBackground(ctx context.Context, _ *bridgev2.ConnectBackgroundParams) error {
|
||||
s.queueEmptyWaiter.Clear()
|
||||
ch, _, err := s.Client.StartWebsockets(ctx)
|
||||
ch, unauthCh, err := s.Client.StartWebsockets(ctx)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -251,6 +251,19 @@ func (s *SignalClient) ConnectBackground(ctx context.Context, _ *bridgev2.Connec
|
|||
case web.SignalWebsocketConnectionEventCleanShutdown:
|
||||
log.Info().Msg("Authed websocket clean shutdown")
|
||||
}
|
||||
case status := <-unauthCh:
|
||||
switch status.Event {
|
||||
case web.SignalWebsocketConnectionEventConnected:
|
||||
log.Info().Msg("Unauthed websocket connected")
|
||||
case web.SignalWebsocketConnectionEventDisconnected:
|
||||
log.Err(status.Err).Msg("Unauthed websocket disconnected")
|
||||
case web.SignalWebsocketConnectionEventLoggedOut:
|
||||
log.Err(status.Err).Msg("Unauthed websocket logged out")
|
||||
case web.SignalWebsocketConnectionEventError:
|
||||
log.Err(status.Err).Msg("Unauthed websocket error")
|
||||
case web.SignalWebsocketConnectionEventCleanShutdown:
|
||||
log.Info().Msg("Unauthed websocket clean shutdown")
|
||||
}
|
||||
case <-ctx.Done():
|
||||
log.Warn().Msg("Context finished before queue empty event")
|
||||
if didConnect {
|
||||
|
|
|
@ -280,7 +280,7 @@ func (cli *Client) incomingRequestHandler(ctx context.Context, req *signalpb.Web
|
|||
Str("handler", "incoming request handler").
|
||||
Str("verb", *req.Verb).
|
||||
Str("path", *req.Path).
|
||||
Uint64("request_id", *req.Id).
|
||||
Uint64("incoming_request_id", *req.Id).
|
||||
Logger()
|
||||
ctx = log.WithContext(ctx)
|
||||
if *req.Verb == http.MethodPut && *req.Path == "/api/v1/message" {
|
||||
|
|
Loading…
Add table
Reference in a new issue