subchannel: tolerate multiple pre-open inbound DATA messages
This commit is contained in:
parent
327e72e6ac
commit
1c8c2997c7
|
@ -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
|
||||
|
|
|
@ -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")])
|
||||
|
|
Loading…
Reference in New Issue
Block a user