本文整理汇总了Python中shadowsocks.shell.log_shadowsocks_version方法的典型用法代码示例。如果您正苦于以下问题:Python shell.log_shadowsocks_version方法的具体用法?Python shell.log_shadowsocks_version怎么用?Python shell.log_shadowsocks_version使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类shadowsocks.shell
的用法示例。
在下文中一共展示了shell.log_shadowsocks_version方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: thread_db
# 需要导入模块: from shadowsocks import shell [as 别名]
# 或者: from shadowsocks.shell import log_shadowsocks_version [as 别名]
def thread_db(obj):
import socket
import time
global db_instance
timeout = 60
socket.setdefaulttimeout(timeout)
last_rows = []
db_instance = obj()
shell.log_shadowsocks_version()
try:
import resource
logging.info(
'current process RLIMIT_NOFILE resource: soft %d hard %d' %
resource.getrlimit(
resource.RLIMIT_NOFILE))
except:
pass
try:
while True:
load_config()
try:
db_instance.push_db_all_user()
rows = db_instance.pull_db_all_user()
db_instance.del_server_out_of_bound_safe(last_rows, rows)
db_instance.detect_text_ischanged = False
db_instance.detect_hex_ischanged = False
last_rows = rows
except Exception as e:
trace = traceback.format_exc()
logging.error(trace)
# logging.warn('db thread except:%s' % e)
if db_instance.event.wait(60) or not db_instance.is_all_thread_alive():
break
if db_instance.has_stopped:
break
except KeyboardInterrupt as e:
pass
db_instance.del_servers()
ServerPool.get_instance().stop()
db_instance = None
示例2: thread_db
# 需要导入模块: from shadowsocks import shell [as 别名]
# 或者: from shadowsocks.shell import log_shadowsocks_version [as 别名]
def thread_db(obj):
import socket
import time
global db_instance
timeout = 60
socket.setdefaulttimeout(timeout)
last_rows = []
db_instance = obj()
ServerPool.get_instance()
shell.log_shadowsocks_version()
try:
import resource
logging.info('current process RLIMIT_NOFILE resource: soft %d hard %d' % resource.getrlimit(resource.RLIMIT_NOFILE))
except:
pass
try:
while True:
load_config()
db_instance.load_cfg()
try:
db_instance.push_db_all_user()
rows = db_instance.pull_db_all_user()
if rows:
db_instance.pull_ok = True
config = shell.get_config(False)
for port in config['additional_ports']:
val = config['additional_ports'][port]
val['port'] = int(port)
val['enable'] = 1
val['transfer_enable'] = 1024 ** 7
val['u'] = 0
val['d'] = 0
if "password" in val:
val["passwd"] = val["password"]
rows.append(val)
db_instance.del_server_out_of_bound_safe(last_rows, rows)
last_rows = rows
except Exception as e:
trace = traceback.format_exc()
logging.error(trace)
#logging.warn('db thread except:%s' % e)
if db_instance.event.wait(get_config().UPDATE_TIME) or not ServerPool.get_instance().thread.is_alive():
break
except KeyboardInterrupt as e:
pass
db_instance.del_servers()
ServerPool.get_instance().stop()
db_instance = None
示例3: thread_db
# 需要导入模块: from shadowsocks import shell [as 别名]
# 或者: from shadowsocks.shell import log_shadowsocks_version [as 别名]
def thread_db(obj):
import socket
import time
import webapi_utils
global db_instance
global webapi
timeout = 60
socket.setdefaulttimeout(timeout)
last_rows = []
db_instance = obj()
webapi = webapi_utils.WebApi()
shell.log_shadowsocks_version()
try:
import resource
logging.info(
'current process RLIMIT_NOFILE resource: soft %d hard %d' %
resource.getrlimit(
resource.RLIMIT_NOFILE))
except:
pass
try:
while True:
load_config()
try:
ping = webapi.getApi('func/ping')
if ping is None:
logging.error(
'something wrong with your http api, please check your config and website status and try again later.')
else:
db_instance.push_db_all_user()
rows = db_instance.pull_db_all_user()
db_instance.del_server_out_of_bound_safe(
last_rows, rows)
last_rows = rows
except Exception as e:
trace = traceback.format_exc()
logging.error(trace)
# logging.warn('db thread except:%s' % e)
if db_instance.event.wait(60) or not db_instance.is_all_thread_alive():
break
if db_instance.has_stopped:
break
except KeyboardInterrupt as e:
pass
db_instance.del_servers()
ServerPool.get_instance().stop()
db_instance = None