Skip to content

Commit

Permalink
try with a thread
Browse files Browse the repository at this point in the history
  • Loading branch information
tshirtman committed Sep 22, 2019
1 parent 91391d8 commit 13dd4f5
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions tests/test_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -930,13 +930,19 @@ def callback_3000(*values):


def test_close_receiving():
from threading import Thread

osc = OSCThreadServer(encoding='utf8')
osc.listen(default=True)
port = osc.getaddress()[1]

# this should keep the server busy receiving for a while
for i in range(5000):
send_message(b'/flood', [b't' * 60000], 'localhost', port)
def send_messages():
for i in range(5000):
send_message(b'/flood', [b't' * 60000], 'localhost', port, safer=True)

thread = Thread(target=send_messages)
thread.start()

# surprise, let's stop it asap!
osc.stop_all()
thread.join()

0 comments on commit 13dd4f5

Please sign in to comment.