[Python-checkins] cpython (3.2): Issue #16168: Use specified socket type for domain sockets in SysLogHandler.

vinay.sajip python-checkins at python.org
Tue Oct 9 09:23:24 CEST 2012


http://hg.python.org/cpython/rev/f41e6ef3392a
changeset:   79608:f41e6ef3392a
branch:      3.2
parent:      79602:3dd012397b11
user:        Vinay Sajip <vinay_sajip at yahoo.co.uk>
date:        Tue Oct 09 08:19:25 2012 +0100
summary:
  Issue #16168: Use specified socket type for domain sockets in SysLogHandler.

files:
  Lib/logging/handlers.py |  10 ++--------
  1 files changed, 2 insertions(+), 8 deletions(-)


diff --git a/Lib/logging/handlers.py b/Lib/logging/handlers.py
--- a/Lib/logging/handlers.py
+++ b/Lib/logging/handlers.py
@@ -754,18 +754,12 @@
         self.formatter = None
 
     def _connect_unixsocket(self, address):
-        self.socket = socket.socket(socket.AF_UNIX, socket.SOCK_DGRAM)
-        # syslog may require either DGRAM or STREAM sockets
+        self.socket = socket.socket(socket.AF_UNIX, self.socktype)
         try:
             self.socket.connect(address)
         except socket.error:
             self.socket.close()
-            self.socket = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
-            try:
-                self.socket.connect(address)
-            except socket.error:
-                self.socket.close()
-                raise
+            raise
 
     def encodePriority(self, facility, priority):
         """

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list