Commit 6ecdb581 authored by Vinay Sajip's avatar Vinay Sajip

Issue #16168: Use specified socket type for domain sockets in SysLogHandler.

parent 1906c0c9
...@@ -764,13 +764,7 @@ class SysLogHandler(logging.Handler): ...@@ -764,13 +764,7 @@ class SysLogHandler(logging.Handler):
self.formatter = None self.formatter = None
def _connect_unixsocket(self, address): def _connect_unixsocket(self, address):
self.socket = socket.socket(socket.AF_UNIX, socket.SOCK_DGRAM) self.socket = socket.socket(socket.AF_UNIX, self.socktype)
# syslog may require either DGRAM or STREAM sockets
try:
self.socket.connect(address)
except socket.error:
self.socket.close()
self.socket = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
try: try:
self.socket.connect(address) self.socket.connect(address)
except socket.error: except socket.error:
......
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