Fix order of setting/saving state in VpnService.

and also refactor code making sure a thread won't grab two locks (which
may cause deadlocks in some corner cases).
1 file changed