summaryrefslogtreecommitdiff
path: root/test/simple-agent
diff options
context:
space:
mode:
Diffstat (limited to 'test/simple-agent')
-rwxr-xr-xtest/simple-agent18
1 files changed, 17 insertions, 1 deletions
diff --git a/test/simple-agent b/test/simple-agent
index f501b1e5..ebb44c57 100755
--- a/test/simple-agent
+++ b/test/simple-agent
@@ -180,7 +180,6 @@ class VpnAgent(dbus.service.Object):
in_signature='', out_signature='')
def Release(self):
print("Release VPN agent")
- mainloop.quit()
def input_cookie(self):
response = {}
@@ -267,6 +266,21 @@ class VpnAgent(dbus.service.Object):
def Cancel(self):
print "Cancel"
+def vpnNameOwnerChanged(proxy):
+ if proxy:
+ print("vpnd is connected to system bus")
+ try:
+ path = "/test/vpn_agent"
+ vpn_manager = dbus.Interface(bus.get_object('net.connman.vpn',
+ "/"),
+ 'net.connman.vpn.Manager')
+ vpn_manager.RegisterAgent(path)
+ except:
+ print "vpn agent registered"
+ else:
+ print("vpnd is disconnected from system bus")
+ vpn_manager = None
+
def print_usage():
print "Usage:"
print "For hidden service:"
@@ -328,6 +342,8 @@ if __name__ == '__main__':
vpn_manager.RegisterAgent(path)
+ bus.watch_name_owner('net.connman.vpn', vpnNameOwnerChanged)
+
mainloop = gobject.MainLoop()
mainloop.run()