Fix idle websocket connection on logout
This commit is contained in:
parent
cc091ad488
commit
000f9e515d
@ -94,6 +94,16 @@ func connectToWebsocket(ctx context.Context, vault *vault.Vault, cfg *config.Con
|
|||||||
//handshake required for official bitwarden implementation
|
//handshake required for official bitwarden implementation
|
||||||
c.WriteMessage(1, []byte(`{"protocol":"messagepack","version":1}`))
|
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() {
|
go func() {
|
||||||
defer close(done)
|
defer close(done)
|
||||||
for {
|
for {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user