Module: check_mk
Branch: master
Commit: 89c46c91b85931ade5ef782b519bc49236781448
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=89c46c91b85931…
Author: Sven Panne <sp(a)mathias-kettner.de>
Date: Thu Jun 2 08:45:39 2016 +0200
Use sendall instead of send to handle partial writes.
---
bin/mkeventd | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/bin/mkeventd b/bin/mkeventd
index 7ff0b8d..c5722b6 100755
--- a/bin/mkeventd
+++ b/bin/mkeventd
@@ -497,7 +497,7 @@ def livestatus_query(query):
try:
livesock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
livesock.connect(g_livestatus_socket)
- livesock.send(query)
+ livesock.sendall(query)
livesock.shutdown(socket.SHUT_WR)
return livesock.recv(10000000)
except Exception, e:
@@ -2660,7 +2660,7 @@ class StatusServer:
log("Error handling client %s: %s" % (addr_info, e))
if client_socket:
try:
- client_socket.send("ERROR: %s\n" % e)
+ client_socket.sendall("ERROR: %s\n" % e)
except:
pass # avoid next exception because of broken pipe!
@@ -2699,11 +2699,11 @@ class StatusServer:
if output_format == "plain":
for line in response:
- socket.send("\t".join([to_utf8(quote_tab(c)) for c in
line]))
- socket.send("\n")
+ socket.sendall("\t".join([to_utf8(quote_tab(c)) for c
in line]))
+ socket.sendall("\n")
else:
- socket.send(repr(response))
- socket.send("\n")
+ socket.sendall(repr(response))
+ socket.sendall("\n")
socket.close()
@@ -3740,7 +3740,7 @@ def get_state_from_master():
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.settimeout(repl_settings["connect_timeout"])
sock.connect(repl_settings["master"])
- sock.send("REPLICATE %d\n" % (g_slave_status["last_sync"] and
g_slave_status["last_sync"] or 0))
+ sock.sendall("REPLICATE %d\n" % (g_slave_status["last_sync"]
and g_slave_status["last_sync"] or 0))
response_text = ""
while True: