mirror of https://github.com/python/cpython
Issue #16168: Use specified socket type for domain sockets in SysLogHandler.
This commit is contained in:
parent
1906c0c992
commit
6ecdb58154
|
@ -764,18 +764,12 @@ 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:
|
try:
|
||||||
self.socket.connect(address)
|
self.socket.connect(address)
|
||||||
except socket.error:
|
except socket.error:
|
||||||
self.socket.close()
|
self.socket.close()
|
||||||
self.socket = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
|
raise
|
||||||
try:
|
|
||||||
self.socket.connect(address)
|
|
||||||
except socket.error:
|
|
||||||
self.socket.close()
|
|
||||||
raise
|
|
||||||
|
|
||||||
# curious: when talking to the unix-domain '/dev/log' socket, a
|
# curious: when talking to the unix-domain '/dev/log' socket, a
|
||||||
# zero-terminator seems to be required. this string is placed
|
# zero-terminator seems to be required. this string is placed
|
||||||
|
|
Loading…
Reference in New Issue