Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Copy link
Copy Markdown
Member

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 ?

        if (conn.getState() == State.Pending) {
            conn.setState(State.Disconnected);
            _vpnConnectionDao.persist(conn);
        }

Copy link
Copy Markdown
Member Author

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


// Stop and start the connection again
stopVpnConnection(id);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The 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?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The 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;
Expand Down