summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorVratko Polak <vrpolak@cisco.com>2019-10-14 13:06:18 +0200
committerAndrew Yourtchenko <ayourtch@gmail.com>2020-03-29 21:59:10 +0000
commit118c4461b3ede5dbc9d118befaf09b5dd2f3204d (patch)
tree07f1f75a529f0ba80583b47137fb66c6fee5d132 /src
parentb70fd4a545cf8e3bb1c3ddbac3fff6a112a8cbbd (diff)
papi: fix socket sendall calls
No point in checking the return value, as .sendall() raises on error (and the previous check was missing "not"). Type: fix Change-Id: I9e07709ddd7093f91ffef87808abbab264b8aa5a Signed-off-by: Vratko Polak <vrpolak@cisco.com> (cherry picked from commit 8921dc675458b238fc03c5aed53d3462bcdbdb3c)
Diffstat (limited to 'src')
-rw-r--r--src/vpp-api/python/vpp_papi/vpp_transport_socket.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/vpp-api/python/vpp_papi/vpp_transport_socket.py b/src/vpp-api/python/vpp_papi/vpp_transport_socket.py
index d50b9b886b6..c881e099e02 100644
--- a/src/vpp-api/python/vpp_papi/vpp_transport_socket.py
+++ b/src/vpp-api/python/vpp_papi/vpp_transport_socket.py
@@ -188,10 +188,12 @@ class VppTransport(object):
# Send header
header = self.header.pack(0, len(buf), 0)
- if self.socket.sendall(header) is None:
- raise VppTransportSocketIOError(1, 'Failed to send')
- if self.socket.sendall(buf) is None:
- raise VppTransportSocketIOError(1, 'Failed to send')
+ try:
+ self.socket.sendall(header)
+ self.socket.sendall(buf)
+ except socket.error as err:
+ raise VppTransportSocketIOError(1, 'Sendall error: {err!r}'.format(
+ err=err))
def _read_fixed(self, size):
"""Repeat receive until fixed size is read. Return empty on error."""