log file
This commit is contained in:
2
msw.py
2
msw.py
@@ -27,7 +27,7 @@ for name in plugins_list:
|
||||
with open('plugins/__init__.py', 'w') as f:
|
||||
f.write(plugins_import_script)
|
||||
print('%s plugins will be import' % (len(plugins_realname_list)))
|
||||
print('They are: %s' % str(plugins_realname_list))
|
||||
print('Plugins list: %s' % str(plugins_realname_list))
|
||||
|
||||
|
||||
global_config['plugins_realname_list'] = plugins_realname_list
|
||||
|
||||
@@ -1,12 +1,19 @@
|
||||
import threading
|
||||
from mswp import Datapack
|
||||
from forwarder import receive_queues
|
||||
from config import dprint as print
|
||||
receive_queue = receive_queues[__name__]
|
||||
|
||||
def main():
|
||||
while True:
|
||||
dp = receive_queue.get()
|
||||
print('Writedown log: %s' % dp.body.decode())
|
||||
|
||||
if dp.method == 'file':
|
||||
word = dp.head.get('filename')
|
||||
else:
|
||||
word = dp.body.decode()
|
||||
|
||||
print('Writedown log: %s' % (word), dp)
|
||||
with open('logger.log', 'a') as f:
|
||||
if dp.head.get('from'):
|
||||
from_app_name = dp.head.get('from')
|
||||
|
||||
@@ -82,7 +82,7 @@ class Network_controller: # manage id and connection
|
||||
|
||||
def process_command(self, dp):
|
||||
if dp.body == b'status':
|
||||
print('Online %s' % self.id_dict)
|
||||
print('Online %s' % str(list(self.id_dict.keys())))
|
||||
|
||||
|
||||
def start_sending_dp(self):
|
||||
@@ -145,7 +145,7 @@ class Network_controller: # manage id and connection
|
||||
self.id_dict[id] = []
|
||||
self.id_dict[id].append(connection)
|
||||
self.all_connection_list.append(connection)
|
||||
print('%s has connected' % id)
|
||||
print('%s connected' % id)
|
||||
|
||||
|
||||
def del_connection(self, id, connection):
|
||||
@@ -172,7 +172,6 @@ class Connection:
|
||||
self.thread_recv.start()
|
||||
|
||||
|
||||
|
||||
def _init(self): # init to check connection id, threading
|
||||
err_code, flag = self.check_id()
|
||||
if err_code:
|
||||
@@ -264,8 +263,11 @@ class Connection:
|
||||
'''
|
||||
if self.positive:
|
||||
self.send_id()
|
||||
|
||||
try:
|
||||
data = self.conn.recv(BUFFSIZE)
|
||||
except ConnectionResetError:
|
||||
print('One connection failed before ID check')
|
||||
|
||||
if not data:
|
||||
return 2, ''
|
||||
|
||||
|
||||
Reference in New Issue
Block a user