add more log
This commit is contained in:
parent
a185e1671b
commit
816592b674
3 changed files with 14 additions and 4 deletions
|
@ -202,6 +202,8 @@ class EventLoop(object):
|
||||||
continue
|
continue
|
||||||
else:
|
else:
|
||||||
logging.error(e)
|
logging.error(e)
|
||||||
|
import traceback
|
||||||
|
traceback.print_exc()
|
||||||
continue
|
continue
|
||||||
for handler in self._handlers:
|
for handler in self._handlers:
|
||||||
# TODO when there are a lot of handlers
|
# TODO when there are a lot of handlers
|
||||||
|
@ -209,6 +211,8 @@ class EventLoop(object):
|
||||||
handler(events)
|
handler(events)
|
||||||
except (OSError, IOError) as e:
|
except (OSError, IOError) as e:
|
||||||
logging.error(e)
|
logging.error(e)
|
||||||
|
import traceback
|
||||||
|
traceback.print_exc()
|
||||||
|
|
||||||
|
|
||||||
# from tornado
|
# from tornado
|
||||||
|
|
|
@ -69,6 +69,8 @@ def main():
|
||||||
loop.run()
|
loop.run()
|
||||||
except (KeyboardInterrupt, IOError, OSError) as e:
|
except (KeyboardInterrupt, IOError, OSError) as e:
|
||||||
logging.error(e)
|
logging.error(e)
|
||||||
|
import traceback
|
||||||
|
traceback.print_exc()
|
||||||
os._exit(0)
|
os._exit(0)
|
||||||
|
|
||||||
if int(config['workers']) > 1:
|
if int(config['workers']) > 1:
|
||||||
|
|
|
@ -26,6 +26,7 @@ import socket
|
||||||
import errno
|
import errno
|
||||||
import struct
|
import struct
|
||||||
import logging
|
import logging
|
||||||
|
import traceback
|
||||||
import encrypt
|
import encrypt
|
||||||
import eventloop
|
import eventloop
|
||||||
from common import parse_header
|
from common import parse_header
|
||||||
|
@ -152,6 +153,7 @@ class TCPRelayHandler(object):
|
||||||
uncomplete = True
|
uncomplete = True
|
||||||
else:
|
else:
|
||||||
logging.error(e)
|
logging.error(e)
|
||||||
|
traceback.print_exc()
|
||||||
self.destroy()
|
self.destroy()
|
||||||
return False
|
return False
|
||||||
if uncomplete:
|
if uncomplete:
|
||||||
|
@ -202,6 +204,7 @@ class TCPRelayHandler(object):
|
||||||
self.destroy()
|
self.destroy()
|
||||||
else:
|
else:
|
||||||
logging.error(e)
|
logging.error(e)
|
||||||
|
traceback.print_exc()
|
||||||
self.destroy()
|
self.destroy()
|
||||||
|
|
||||||
def _handle_stage_hello(self, data):
|
def _handle_stage_hello(self, data):
|
||||||
|
@ -277,8 +280,8 @@ class TCPRelayHandler(object):
|
||||||
self._stage = STAGE_REPLY
|
self._stage = STAGE_REPLY
|
||||||
self._update_stream(STREAM_UP, WAIT_STATUS_READWRITING)
|
self._update_stream(STREAM_UP, WAIT_STATUS_READWRITING)
|
||||||
self._update_stream(STREAM_DOWN, WAIT_STATUS_READING)
|
self._update_stream(STREAM_DOWN, WAIT_STATUS_READING)
|
||||||
except Exception:
|
except Exception as e:
|
||||||
import traceback
|
logging.error(e)
|
||||||
traceback.print_exc()
|
traceback.print_exc()
|
||||||
# TODO use logging when debug completed
|
# TODO use logging when debug completed
|
||||||
self.destroy()
|
self.destroy()
|
||||||
|
@ -336,8 +339,8 @@ class TCPRelayHandler(object):
|
||||||
data = self._encryptor.encrypt(data)
|
data = self._encryptor.encrypt(data)
|
||||||
try:
|
try:
|
||||||
self._write_to_sock(data, self._local_sock)
|
self._write_to_sock(data, self._local_sock)
|
||||||
except Exception:
|
except Exception as e:
|
||||||
import traceback
|
logging.error(e)
|
||||||
traceback.print_exc()
|
traceback.print_exc()
|
||||||
# TODO use logging when debug completed
|
# TODO use logging when debug completed
|
||||||
self.destroy()
|
self.destroy()
|
||||||
|
@ -540,6 +543,7 @@ class TCPRelay(object):
|
||||||
continue
|
continue
|
||||||
else:
|
else:
|
||||||
logging.error(e)
|
logging.error(e)
|
||||||
|
traceback.print_exc()
|
||||||
else:
|
else:
|
||||||
if sock:
|
if sock:
|
||||||
handler = self._fd_to_handlers.get(fd, None)
|
handler = self._fd_to_handlers.get(fd, None)
|
||||||
|
|
Loading…
Reference in a new issue