diff --git a/API.py b/API.py index 0349c20..a95e1c5 100644 --- a/API.py +++ b/API.py @@ -59,6 +59,9 @@ class FD_APIUserDefinedContext(object): def options(self,system,options): self.CONFIG['SYSTEMS'][system]['OPTIONS'] = options + def getoptions(self,system): + return self.CONFIG['SYSTEMS'][system]['OPTIONS'] + def killserver(self): self.CONFIG['GLOBAL']['_KILL_SERVER'] = True @@ -79,7 +82,7 @@ class FD_API(ServiceBase): ###################### #User level API calls# ###################### - @rpc(Unicode,Unicode) + @rpc(UnsignedInteger32,Unicode) def reset(ctx,dmrid,key): system = ctx.udc.validateKey(int(dmrid),key) if system: @@ -95,7 +98,13 @@ class FD_API(ServiceBase): else: raise error.InvalidCredentialsError() - + @rpc(UnsignedInteger32,Unicode) + def getoptions(ctx,dmrid,key): + system = ctx.udc.validateKey(int(dmrid),key) + if system: + return ctx.udc.getoptions(system,options) + else: + raise error.InvalidCredentialsError() ######################## #System level API calls# diff --git a/hotspot_proxy_v2.py b/hotspot_proxy_v2.py index 6874266..fc56d36 100644 --- a/hotspot_proxy_v2.py +++ b/hotspot_proxy_v2.py @@ -362,16 +362,19 @@ if __name__ == '__main__': print('(PROXY)(GLOBAL) SHUTDOWN: PROXY IS TERMINATING WITH SIGNAL {}'.format(str(_signal))) reactor.stop() + def sigt(_signal,_frame): + print('oooh') + #Install signal handlers signal.signal(signal.SIGINT, sig_handler) - signal.signal(signal.SIGTERM, sig_handler) + signal.signal(signal.SIGTERM, sigt) #readState() #If IPv6 is enabled by enivornment variable... if ListenIP == '' and 'FDPROXY_IPV6' in os.environ and bool(os.environ['FDPROXY_IPV6']): ListenIP = '::' - + #Override static config from Environment if 'FDPROXY_STATS' in os.environ: Stats = bool(os.environ['FDPROXY_STATS'])