Merge pull request #309 from seemethere/fix_write_error_loop
Fixes write_error loop from bail_out function
This commit is contained in:
commit
5a6fb679c9
|
@ -1,4 +1,5 @@
|
||||||
import asyncio
|
import asyncio
|
||||||
|
import traceback
|
||||||
from functools import partial
|
from functools import partial
|
||||||
from inspect import isawaitable
|
from inspect import isawaitable
|
||||||
from signal import SIGINT, SIGTERM
|
from signal import SIGINT, SIGTERM
|
||||||
|
@ -189,6 +190,12 @@ class HttpProtocol(asyncio.Protocol):
|
||||||
"Writing error failed, connection closed {}".format(e))
|
"Writing error failed, connection closed {}".format(e))
|
||||||
|
|
||||||
def bail_out(self, message):
|
def bail_out(self, message):
|
||||||
|
if self.transport.is_closing():
|
||||||
|
log.error(
|
||||||
|
"Connection closed before error was sent to user @ {}".format(
|
||||||
|
self.transport.get_extra_info('peername')))
|
||||||
|
log.debug('Error experienced:\n{}'.format(traceback.format_exc()))
|
||||||
|
else:
|
||||||
exception = ServerError(message)
|
exception = ServerError(message)
|
||||||
self.write_error(exception)
|
self.write_error(exception)
|
||||||
log.error(message)
|
log.error(message)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user