Fix idle websocket connection on logout

This commit is contained in:
Bernd Schoolmann 2023-12-28 01:05:15 +01:00
parent cc091ad488
commit 000f9e515d
No known key found for this signature in database

View File

@ -94,6 +94,16 @@ func connectToWebsocket(ctx context.Context, vault *vault.Vault, cfg *config.Con
//handshake required for official bitwarden implementation
c.WriteMessage(1, []byte(`{"protocol":"messagepack","version":1}`))
go func() {
for {
time.Sleep(5 * time.Second)
if vault.Keyring.IsLocked() || cfg.IsLocked() || !cfg.IsLoggedIn() {
c.Close()
return
}
}
}()
go func() {
defer close(done)
for {