Funnily enough that clear_for_send was still decremented at the wrong location

This commit is contained in:
Gina Häußge committed 2014-11-07 14:26:40 +01:00
1 parent eae4153158
commit 4bab1975c8
2 files changed
+7 -5

No files matched your search

@@ -125,7 +125,7 @@ class RepRapProtocol(Protocol):
self._send_queue = CommandQueue()
self._clear_for_send = CountedEvent()
self._clear_for_send = CountedEvent(max=20)
self._force_checksum = True
self._wait_for_start = False
@@ -808,10 +808,9 @@ class RepRapProtocol(Protocol):
# we just got a send timeout, so we'll just try again on the next loop iteration
continue
# decrease the clear_for_send counter
self._clear_for_send.clear()
if not sent or self._rx_cache_size <= 0:
# decrease the clear_for_send counter
self._clear_for_send.clear()
self._clear_for_send.wait()
def _send_from_queue(self):
+4 -1
View File
@@ -284,8 +284,9 @@ def address_for_client(host, port):
class CountedEvent(object):
def __init__(self, value=0):
def __init__(self, value=0, max=None):
self._counter = 0
self._max = max
self._mutex = threading.Lock()
self._event = threading.Event()
@@ -315,6 +316,8 @@ class CountedEvent(object):
self._counter = 0
self._event.clear()
else:
if self._max is not None and self._counter > self._max:
self._counter = self._max
self._event.set()