-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Persist vpn connection state before restarting #4635
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -610,13 +610,12 @@ public Site2SiteVpnConnection resetVpnConnection(ResetVpnConnectionCmd cmd) thro | |
| } | ||
| _accountMgr.checkAccess(caller, null, false, conn); | ||
|
|
||
| if (conn.getState() == State.Pending) { | ||
| conn.setState(State.Disconnected); | ||
| } | ||
| if (conn.getState() == State.Connected || conn.getState() == State.Error | ||
| || conn.getState() == State.Disconnected || conn.getState() == State.Connecting) { | ||
| stopVpnConnection(id); | ||
| } | ||
| // Set vpn state to disconnected | ||
| conn.setState(State.Disconnected); | ||
| _vpnConnectionDao.persist(conn); | ||
|
|
||
| // Stop and start the connection again | ||
| stopVpnConnection(id); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would without checking for the current conn state cause any issue @ravening ? For example, try to stop vpn connection when VR has errors is powered off etc or in other transitional state?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @rhtyd probably no as this involves updating the state in db |
||
| startVpnConnection(id); | ||
| conn = _vpnConnectionDao.findById(id); | ||
| return conn; | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not just persist DB only when state is pending ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@weizhouapache since we are restting the connection, it should transit to disconnect state irrecpective of the previous state. since we are stopping and starting the vpn connection, checking for pending state or any other state doesnt matter