mirror of
https://github.com/nishiki/manage-password.git
synced 2025-02-17 08:30:04 +00:00
disable sync if connect fail
This commit is contained in:
parent
213743bad2
commit
90086f3262
1 changed files with 12 additions and 0 deletions
12
lib/Sync.rb
12
lib/Sync.rb
|
@ -39,6 +39,10 @@ class Sync
|
|||
end
|
||||
|
||||
def get(gpg_password)
|
||||
if !@sync
|
||||
return nil
|
||||
end
|
||||
|
||||
send_msg = {:action => 'get',
|
||||
:gpg_key => @gpg_key,
|
||||
:password => @password,
|
||||
|
@ -72,6 +76,10 @@ class Sync
|
|||
end
|
||||
|
||||
def update(data)
|
||||
if !@sync
|
||||
return true
|
||||
end
|
||||
|
||||
send_msg = {:action => 'update',
|
||||
:gpg_key => @gpg_key,
|
||||
:password => @password,
|
||||
|
@ -99,6 +107,10 @@ class Sync
|
|||
end
|
||||
|
||||
def close()
|
||||
if !@sync
|
||||
return
|
||||
end
|
||||
|
||||
send_msg = {:action => 'close'}
|
||||
@socket.puts send_msg.to_json
|
||||
end
|
||||
|
|
Loading…
Add table
Reference in a new issue