mirror of
https://github.com/python/cpython.git
synced 2025-12-09 10:37:17 +00:00
Issue #16168: Use specified socket type for domain sockets in SysLogHandler.
This commit is contained in:
parent
470ee39883
commit
b5ca932be2
1 changed files with 2 additions and 8 deletions
|
|
@ -754,18 +754,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
|
|
||||||
|
|
||||||
def encodePriority(self, facility, priority):
|
def encodePriority(self, facility, priority):
|
||||||
"""
|
"""
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue