port-hijacking backend tested and fixed
This commit is contained in:
@@ -51,16 +51,17 @@ class ServiceManager:
|
|||||||
self.active = False
|
self.active = False
|
||||||
self.lock = asyncio.Lock()
|
self.lock = asyncio.Lock()
|
||||||
|
|
||||||
async def enable(self,to):
|
async def enable(self):
|
||||||
if (self.status != to):
|
if not self.active:
|
||||||
async with self.lock:
|
async with self.lock:
|
||||||
await self.restart()
|
await self.restart()
|
||||||
|
self._set_status(True)
|
||||||
|
|
||||||
async def disable(self,to):
|
async def disable(self):
|
||||||
if (self.status != to):
|
if self.active:
|
||||||
async with self.lock:
|
async with self.lock:
|
||||||
await self.stop()
|
await self.stop()
|
||||||
self._set_status(to)
|
self._set_status(False)
|
||||||
|
|
||||||
def _set_status(self,active):
|
def _set_status(self,active):
|
||||||
self.active = active
|
self.active = active
|
||||||
|
|||||||
@@ -10,4 +10,4 @@ class Service:
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def from_dict(cls, var: dict):
|
def from_dict(cls, var: dict):
|
||||||
return cls(id=var["service_id"], active=var["active"], public_port=var["public_port"], proxy_port=var["proxy_port"], name=var["name"], proto=var["proto"], ip_int=var["ip_int"])
|
return cls(service_id=var["service_id"], active=var["active"], public_port=var["public_port"], proxy_port=var["proxy_port"], name=var["name"], proto=var["proto"], ip_int=var["ip_int"])
|
||||||
|
|||||||
Reference in New Issue
Block a user