diff --git a/src/wormhole/_dilation/subchannel.py b/src/wormhole/_dilation/subchannel.py index c2ecae7..1e52e90 100644 --- a/src/wormhole/_dilation/subchannel.py +++ b/src/wormhole/_dilation/subchannel.py @@ -251,7 +251,7 @@ class SubChannel(object): def _deliver_queued_data(self): for data in self._pending_remote_data: self.remote_data(data) - del self._pending_remote_data + del self._pending_remote_data if self._pending_remote_close: self.remote_close() del self._pending_remote_close diff --git a/src/wormhole/test/dilate/test_subchannel.py b/src/wormhole/test/dilate/test_subchannel.py index c1b02cb..45d4d98 100644 --- a/src/wormhole/test/dilate/test_subchannel.py +++ b/src/wormhole/test/dilate/test_subchannel.py @@ -112,11 +112,13 @@ class SubChannelAPI(unittest.TestCase): def test_data_before_open(self): sc, m, scid, hostaddr, peeraddr, p = make_sc(set_protocol=False) - sc.remote_data(b"data") + sc.remote_data(b"data1") + sc.remote_data(b"data2") self.assertEqual(p.mock_calls, []) sc._set_protocol(p) sc._deliver_queued_data() - self.assertEqual(p.mock_calls, [mock.call.dataReceived(b"data")]) + self.assertEqual(p.mock_calls, [mock.call.dataReceived(b"data1"), + mock.call.dataReceived(b"data2")]) p.mock_calls[:] = [] sc.remote_data(b"more") self.assertEqual(p.mock_calls, [mock.call.dataReceived(b"more")])