Commit Graph

35 Commits

Author SHA1 Message Date
Stein Magnus Jodal
c4940cbea2 autopep8: Add space after class signature/docstring 2015-04-03 00:05:26 +02:00
Thomas Adamcik
fa8547c397 tests: Add noqa markers for setUp/tearDown 2014-12-30 00:23:01 +01:00
Stein Magnus Jodal
4f428b8601 py3: Move compat module out of utils 2014-12-07 21:36:15 +01:00
Stein Magnus Jodal
58527406c1 py3: Use compat.text_type instead of unicode 2014-12-07 20:17:10 +01:00
Stein Magnus Jodal
496142c201 py3: Use absolute imports by default 2014-12-07 20:17:10 +01:00
Stein Magnus Jodal
7856c14b26 tests: Use with stmt for assertRaises 2014-09-25 23:03:35 +02:00
Trygve Aaberge
15597b3c60 tests: Test call order in test_recv_callback_gets_no_data 2014-08-14 12:43:42 +02:00
Trygve Aaberge
265951bf00 network: disable_recv before telling actor to close connection
As of d62ad96, when the connection can't receive more data from the
client, it tells the actor to stop the connection and calls
disable_recv(). The actor operates in it's own thread and when it stops
the connection, disable_recv is being called again from a different
thread. Since the actor is told to stop the connection before
disable_recv is called, the two calls to disable_recv may happen
simultaneously.

This causes a race condition issue where both threads can reach past the
check that recv_id is not None before either of them set it to None. If
one of them set it to None before the other one tries to use it, an
error is raised.

This commit calls disable_recv before telling the actor to stop the
connection. Since disable_recv is a blocking call, this ensures that
recv_id is being set to None before the actor thread begins to stop the
connection.

Fixes #781
2014-08-14 01:58:48 +02:00
Stein Magnus Jodal
b754885064 Fix all import order warnings 2014-05-07 20:08:43 +02:00
Trygve Aaberge
d62ad966af network: Respond to messages before closing connections
This makes a connection tell the actor to stop the connection, instead
of stopping it itself. This is preferable, because other messages sent
to the actor that is not processed yet, may now send data to the client.

E.g. it makes this work:
$ echo status | nc localhost 6600
2014-04-25 06:11:01 +02:00
Stein Magnus Jodal
c781f77ef3 Rename test files to pattern expected by test runners 2014-01-15 00:01:50 +01:00
Stein Magnus Jodal
52ee456692 tests: Import unittest directly from the stdlib 2013-04-29 19:45:25 +02:00
Stein Magnus Jodal
6acaa490e9 Make all strings unicode by default (fixes #224) 2012-11-13 00:18:47 +01:00
Stein Magnus Jodal
587dde287f Update to work with Pykka 1.0 2012-10-26 22:32:06 +02:00
Stein Magnus Jodal
ac60bcdf8e Fix all flake8 warnings in tests (#211) 2012-10-16 14:43:31 +02:00
Stein Magnus Jodal
63cd153b1b Let NetworkServer pass protocol_kwargs on 2012-09-28 00:48:23 +02:00
Stein Magnus Jodal
66f476e85a Fix typo 2012-09-26 10:08:59 +02:00
Thomas Adamcik
db3a201795 Fix tests and update docs with #150 fix. 2012-09-09 22:09:23 +02:00
Thomas Adamcik
1985b4af76 Switch all tests over to from tests import unittest, which will be unittest2 on < 2.7 and plain unittest otherwise 2011-07-31 22:21:34 +02:00
Thomas Adamcik
cb4f32cb58 Try to send directly in quene_send when we can to prevent uneeded context switches 2011-07-28 22:51:41 +02:00
Thomas Adamcik
3195476421 Rename old send tests to queue_send 2011-07-28 22:44:43 +02:00
Thomas Adamcik
93c16cc2cd Add tests for socket sending 2011-07-28 22:43:54 +02:00
Thomas Adamcik
4f6ddd3532 Add error handling tests for new send method 2011-07-28 22:41:53 +02:00
Thomas Adamcik
43f4f1537e Extract send to seperate method 2011-07-28 22:34:47 +02:00
Thomas Adamcik
13d4510e12 Rename send to send_queue in network.Connection 2011-07-28 22:28:17 +02:00
Thomas Adamcik
035af38b02 Merge branch 'develop' into feature/support-telnet
Conflicts:
	tests/utils/network/lineprotocol_test.py
2011-07-25 17:39:00 +02:00
Thomas Adamcik
9fe4674b36 Update on_received to handle that decode can fail 2011-07-25 01:24:19 +02:00
Thomas Adamcik
4049b23c3f Add concept of delimeter to complemend terminator in LineProtocol 2011-07-25 00:50:41 +02:00
Thomas Adamcik
451b52fde5 Make sure we prevent timeouts when in idle mode 2011-07-24 01:59:32 +02:00
Thomas Adamcik
d07a758f68 Update tests to reflect that server's socket errors should simply not be handeled 2011-07-17 00:42:37 +02:00
Thomas Adamcik
d2a9e3d1ec Make send_callback respect flags from gobject 2011-07-17 00:33:15 +02:00
Thomas Adamcik
c773998fd8 Stop actor if decode or encode fails 2011-07-17 00:26:50 +02:00
Thomas Adamcik
ffd4ae5045 Some more test cleanup and improvement 2011-07-17 00:06:10 +02:00
Thomas Adamcik
91b450bd6b Add tests for line protocol host and port properties 2011-07-16 22:56:43 +02:00
Thomas Adamcik
a1c382666f Split up tests into multiple files 2011-07-15 01:08:29 +02:00