Skip to content

Commit

Permalink
Fix idle websocket connection on logout
Browse files Browse the repository at this point in the history
  • Loading branch information
quexten committed Dec 28, 2023
1 parent cc091ad commit 000f9e5
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions agent/bitwarden/websocket.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 000f9e5

Please sign in to comment.