Skip to content

Commit

Permalink
Update manager.py
Browse files Browse the repository at this point in the history
added one optional buffer_size parameter so to ease up heavvy loaded AMIs .
  • Loading branch information
Francesco Rana committed Aug 28, 2019
1 parent 15c99b7 commit e101b30
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions asterisk/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ def _receive_data(self):
status = False
wait_for_marker = False
eolcount = 0
# loop while we are sill running and connected
# loop while we are still running and connected
while self._running.isSet() and self._connected.isSet():
try:
lines = []
Expand Down Expand Up @@ -456,7 +456,7 @@ def event_dispatch(self):
if callback(ev, self):
break

def connect(self, host, port=5038):
def connect(self, host, port=5038, buffer_size=0):
"""Connect to the manager interface"""

if self._connected.isSet():
Expand All @@ -472,7 +472,7 @@ def connect(self, host, port=5038):
_sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
_sock.connect((host, port))
if PY3:
self._sock = _sock.makefile(mode='rwb', buffering=0)
self._sock = _sock.makefile(mode='rwb', buffering=buffer_size)
else:
self._sock = _sock.makefile()
_sock.close()
Expand Down

0 comments on commit e101b30

Please sign in to comment.