Skip to content

Commit cf0026e

Browse files
Move creation socket object out of the try block
Moved the getting of the socket object out of the try/except block so that a failure on that will not call close on the None s in the finally block.
1 parent d328cee commit cf0026e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

xymon/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@ def send_message(self, message):
7373
7474
See the xymon(1) man page for message syntax.
7575
"""
76+
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
7677
try:
77-
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
7878
server_ip = socket.gethostbyname(self.server)
7979
message = message + '\n'
8080
s.connect((server_ip, self.port))

0 commit comments

Comments
 (0)