Skip to content

Commit 3efa8c4

Browse files
committed
Always send a response
Previously, if data was None, we'd not send a reply. This can lead to clients hanging when they are expecting a reply.
1 parent fd83797 commit 3efa8c4

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

networking_mlnx/eswitchd/eswitch_daemon.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,15 +80,20 @@ def _handle_msg(self):
8080
if msg:
8181
data = jsonutils.loads(msg)
8282

83-
msg = None
83+
result = {
84+
"status": "FAIL",
85+
"action": data.get("action", "UNKNOWN"),
86+
"reason": "UNKNOWN"
87+
}
8488
if data:
8589
try:
8690
result = self.dispatcher.handle_msg(data)
87-
msg = jsonutils.dumps(result)
8891
except Exception as e:
8992
LOG.exception("Exception during message handling - %s", e)
90-
msg = jsonutils.dumps(str(e))
91-
sender.send_string(msg)
93+
result["reason"] = str(e)
94+
95+
msg = jsonutils.dumps(result)
96+
sender.send_string(msg)
9297

9398
def daemon_loop(self):
9499
LOG.info("Daemon Started!")

0 commit comments

Comments
 (0)