Commit 83b8570f authored by Denis Bilenko's avatar Denis Bilenko

server: use handle_error instead of traceback.print_exc to log the errors

parent f1536a41
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
"""TCP/SSL server""" """TCP/SSL server"""
import sys import sys
import errno import errno
import traceback
from gevent import socket from gevent import socket
from gevent.baseserver import BaseServer from gevent.baseserver import BaseServer
from gevent.hub import get_hub from gevent.hub import get_hub
...@@ -123,19 +122,12 @@ class StreamServer(BaseServer): ...@@ -123,19 +122,12 @@ class StreamServer(BaseServer):
spawn(self._handle, client_socket, address) spawn(self._handle, client_socket, address)
return return
except: except:
traceback.print_exc() self.loop.handle_error((address, self), *sys.exc_info())
ex = sys.exc_info()[1] ex = sys.exc_info()[1]
if self.is_fatal_error(ex): if self.is_fatal_error(ex):
self.kill() self.kill()
sys.stderr.write('ERROR: %s failed with %s\n' % (self, str(ex) or repr(ex))) sys.stderr.write('ERROR: %s failed with %s\n' % (self, str(ex) or repr(ex)))
return return
try:
if address is None:
sys.stderr.write('%s: Failed.\n' % (self, ))
else:
sys.stderr.write('%s: Failed to handle request from %s\n' % (self, address, ))
except Exception:
traceback.print_exc()
if self.delay >= 0: if self.delay >= 0:
self.stop_accepting() self.stop_accepting()
self._start_accepting_timer = self.loop.timer(self.delay) self._start_accepting_timer = self.loop.timer(self.delay)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment