Commit Graph

4 Commits

Author SHA1 Message Date
4cc9f98e4c Fix bug 574524: DtlsTransportChannel crashes after SSL closes remotely
When remote side closes, opensslstreamadapter could return SR_EOS which will not trigger upper layer to clean up what's left in the StreamInterfaceChannel. The result of this is when there are more packets coming in, the Write on the StreamInterfaceChannel will overflow the buffer.

The fix here is that when receiving the remote side close signal, we also close the underneath StreamInterfaceChannel which will clean up the queue to prevent overflow.

BUG=574524
TBR=pthatcher@webrtc.org

Review URL: https://codereview.webrtc.org/1566023002

Cr-Commit-Position: refs/heads/master@{#11751}
2016-02-24 19:10:09 +00:00
b01c7816a8 Added functional variants of Buffer::SetData and Buffer::AppendData.
They are invoked with the maximum size of the data to be added, and a
callable that generates that data, like this:

buffer.AppendData(10, [] (rtc::ArrayView<uint8_t> av) {
    for (uint8_t i = 0; i != 5; ++i)
      av[i] = i;

    return 5;
  });

The callable returns the number of bytes actually written, and the
final Buffer size will be adjusted accordingly. SetData and AppendData
both return the number of bytes added (i.e. the return value of the
callable).

These versions will be useful when converting AudioEncoder::Encode to use Buffer rather than raw pointers.

Also added a few tests for the new functionality.

Review URL: https://codereview.webrtc.org/1717273002

Cr-Commit-Position: refs/heads/master@{#11733}
2016-02-24 09:06:02 +00:00
e488a0dbe4 Fix DTLS packet boundary handling in SSLStreamAdapterTests.
The tests were not honoring packet boundaries, thus causing failures
in tests with dropped/broken packets. This CL fixes this and also
re-enables the tests.

R=torbjorng@webrtc.org,pthatcher@webrtc.org,tommi@webrtc.org,juberti@webrtc.org
BUG=webrtc:5005,webrtc:5188

Review URL: https://codereview.webrtc.org/1440193002

Cr-Commit-Position: refs/heads/master@{#10709}
2015-11-19 13:18:04 +00:00
6f2ef74b42 Keep track of DTLS packet sizes to prevent partial reads.
The current use of rtc::FifoBuffer can lead to reading across DTLS packet
boundaries which could cause packets to not being processed correctly.

This CL introduces the new class rtc::BufferQueue and changes the
StreamInterfaceChannel to use it instead of the rtc::FifoBuffer.

BUG=chromium:447431
R=juberti@google.com

Review URL: https://webrtc-codereview.appspot.com/52509004

Cr-Commit-Position: refs/heads/master@{#9254}
2015-05-21 15:51:41 +00:00