Fixed isactive function
This commit is contained in:
@@ -44,7 +44,7 @@ class Proxy:
|
|||||||
self.config_file_path = config_file_path
|
self.config_file_path = config_file_path
|
||||||
|
|
||||||
def start(self, in_pause=False):
|
def start(self, in_pause=False):
|
||||||
if self.process is None:
|
if not self.isactive():
|
||||||
self.filter_map = self.compile_filters()
|
self.filter_map = self.compile_filters()
|
||||||
filters_codes = list(self.filter_map.keys()) if not in_pause else []
|
filters_codes = list(self.filter_map.keys()) if not in_pause else []
|
||||||
proxy_binary_path = os.path.join(os.path.dirname(os.path.abspath(__file__)),"./proxy")
|
proxy_binary_path = os.path.join(os.path.dirname(os.path.abspath(__file__)),"./proxy")
|
||||||
@@ -66,8 +66,9 @@ class Proxy:
|
|||||||
finally:
|
finally:
|
||||||
self.__delete_config()
|
self.__delete_config()
|
||||||
|
|
||||||
|
|
||||||
def stop(self):
|
def stop(self):
|
||||||
if self.process:
|
if self.isactive():
|
||||||
self.process.terminate()
|
self.process.terminate()
|
||||||
try:
|
try:
|
||||||
self.process.wait(timeout=3)
|
self.process.wait(timeout=3)
|
||||||
@@ -101,6 +102,8 @@ class Proxy:
|
|||||||
self.trigger_reload_config()
|
self.trigger_reload_config()
|
||||||
|
|
||||||
def isactive(self):
|
def isactive(self):
|
||||||
|
if self.process and not self.process.poll() is None:
|
||||||
|
self.process = None
|
||||||
return True if self.process else False
|
return True if self.process else False
|
||||||
|
|
||||||
def trigger_reload_config(self):
|
def trigger_reload_config(self):
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import React, { useState } from 'react';
|
import React, { useState } from 'react';
|
||||||
import { ActionIcon, Badge, Button, Divider, Group, Image, Menu, Modal, Notification, Space, Switch, TextInput, Tooltip, FloatingTooltip, MediaQuery, PasswordInput } from '@mantine/core';
|
import { ActionIcon, Badge, Button, Divider, Group, Image, Menu, Modal, Notification, Space, Switch, Tooltip, FloatingTooltip, MediaQuery, PasswordInput } from '@mantine/core';
|
||||||
import style from "./Header.module.scss";
|
import style from "./Header.module.scss";
|
||||||
import { changepassword, errorNotify, eventUpdateName, generalstats, logout, okNotify } from '../../js/utils';
|
import { changepassword, errorNotify, eventUpdateName, generalstats, logout, okNotify } from '../../js/utils';
|
||||||
import { ChangePassword, GeneralStats } from '../../js/models';
|
import { ChangePassword, GeneralStats } from '../../js/models';
|
||||||
|
|||||||
Reference in New Issue
Block a user