|
1 |
| -# Copyright 2001-2013 by Vinay Sajip. All Rights Reserved. |
| 1 | +# Copyright 2001-2014 by Vinay Sajip. All Rights Reserved. |
2 | 2 | #
|
3 | 3 | # Permission to use, copy, modify, and distribute this software and its
|
4 | 4 | # documentation for any purpose and without fee is hereby granted,
|
|
19 | 19 | is based on PEP 282 and comments thereto in comp.lang.python, and influenced
|
20 | 20 | by Apache's log4j system.
|
21 | 21 |
|
22 |
| -Copyright (C) 2001-2013 Vinay Sajip. All Rights Reserved. |
| 22 | +Copyright (C) 2001-2014 Vinay Sajip. All Rights Reserved. |
23 | 23 |
|
24 | 24 | To use, simply 'import logging' and log away!
|
25 | 25 | """
|
26 | 26 |
|
27 |
| -import sys, logging, logging.handlers, struct, traceback, re |
| 27 | +import errno |
28 | 28 | import io
|
| 29 | +import logging |
| 30 | +import logging.handlers |
| 31 | +import re |
| 32 | +import struct |
| 33 | +import sys |
| 34 | +import traceback |
29 | 35 |
|
30 | 36 | try:
|
31 | 37 | import _thread as thread
|
|
38 | 44 |
|
39 | 45 | DEFAULT_LOGGING_CONFIG_PORT = 9030
|
40 | 46 |
|
41 |
| -if sys.platform == "win32": |
42 |
| - RESET_ERROR = 10054 #WSAECONNRESET |
43 |
| -else: |
44 |
| - RESET_ERROR = 104 #ECONNRESET |
| 47 | +RESET_ERROR = errno.ECONNRESET |
45 | 48 |
|
46 | 49 | #
|
47 | 50 | # The following code implements a socket listener for on-the-fly
|
@@ -867,12 +870,8 @@ def handle(self):
|
867 | 870 | if self.server.ready:
|
868 | 871 | self.server.ready.set()
|
869 | 872 | except OSError as e:
|
870 |
| - if not isinstance(e.args, tuple): |
| 873 | + if e.errno != RESET_ERROR: |
871 | 874 | raise
|
872 |
| - else: |
873 |
| - errcode = e.args[0] |
874 |
| - if errcode != RESET_ERROR: |
875 |
| - raise |
876 | 875 |
|
877 | 876 | class ConfigSocketReceiver(ThreadingTCPServer):
|
878 | 877 | """
|
|
0 commit comments