-
Notifications
You must be signed in to change notification settings - Fork 19
Open
Description
What steps will reproduce the problem?
1. Invoke any method that revolves around sending/receiving data through a
socket (`send_message`, `read_message`, `send_action`, etc.) in ami.py
2. Wait for or force a failure in the connection that will result in a
socket.error exception being raised. Every time, a line like this will try to
catch it:
...
except socket.error as (errno, message):
3. If either errno or message is `None` that line will raise a `ValueError` and
the exception will not be handled, sometimes failing to close the connection
(for instance, line 1111 and 1112 in `read_message` of ami.py)
What is the expected output? What do you see instead?
socket.error exception should raise a new `ManagerSocketError` that would allow
the client to reconnect or shutdown gracefully. Instead, `ValueError` is
raised, the connection is not closed and `is_connected` still returns `True`.
What version of the product are you using? On what operating system?
pystrix trunk on Ubuntu 13.10 (python 2.7)
Please provide any additional information
below.
A simple change to the way socket.error is caught should suffice:
except socket.error as e:
self._close()
raise ManagerSocketError("Connection to Asterisk manager broken while reading data: [{errno}] {error}"
.format(errno=e.errno, error=e.strerror))
Original issue reported on code.google.com by nfantone on 10 Jan 2014 at 2:18