mirror of
https://github.com/progval/irctest.git
synced 2025-04-06 23:39:46 +00:00
remove sleep from read loops
recv() should block as necessary up to the 1-second timeout; connection failures will break out of the loop with an exception. There shouldn't be a case where we incur a busy wait.
This commit is contained in:
committed by
Valentin Lorentz
parent
10edb9dd9d
commit
efab101890
@ -49,9 +49,6 @@ class ClientMock:
|
|||||||
if not assert_get_one and not synchronize and data == b"":
|
if not assert_get_one and not synchronize and data == b"":
|
||||||
# Received nothing
|
# Received nothing
|
||||||
return []
|
return []
|
||||||
if self.show_io:
|
|
||||||
print("{:.3f} {}: waiting…".format(time.time(), self.name))
|
|
||||||
time.sleep(0.1)
|
|
||||||
continue
|
continue
|
||||||
except ConnectionResetError:
|
except ConnectionResetError:
|
||||||
raise ConnectionClosed()
|
raise ConnectionClosed()
|
||||||
@ -61,7 +58,6 @@ class ClientMock:
|
|||||||
raise ConnectionClosed()
|
raise ConnectionClosed()
|
||||||
data += new_data
|
data += new_data
|
||||||
if not new_data.endswith(b"\r\n"):
|
if not new_data.endswith(b"\r\n"):
|
||||||
time.sleep(0.1)
|
|
||||||
continue
|
continue
|
||||||
if not synchronize:
|
if not synchronize:
|
||||||
got_pong = True
|
got_pong = True
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
import re
|
import re
|
||||||
import time
|
|
||||||
|
|
||||||
from irctest import cases
|
from irctest import cases
|
||||||
from irctest.numerics import (
|
from irctest.numerics import (
|
||||||
@ -137,7 +136,6 @@ class LusersUnregisteredTestCase(LusersTestCase):
|
|||||||
msg = self.getRegistrationMessage(client_name)
|
msg = self.getRegistrationMessage(client_name)
|
||||||
if msg.command in (ERR_NOTREGISTERED, "PONG"):
|
if msg.command in (ERR_NOTREGISTERED, "PONG"):
|
||||||
break
|
break
|
||||||
time.sleep(0.01)
|
|
||||||
else:
|
else:
|
||||||
assert False, (
|
assert False, (
|
||||||
"Sent a PING before registration, "
|
"Sent a PING before registration, "
|
||||||
|
Reference in New Issue
Block a user