Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright 2013 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2013 The WebRTC Project Authors. All rights reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 72 char padding[4] = {0}; | 72 char padding[4] = {0}; |
| 73 AppendToOutBuffer(padding, pad_bytes); | 73 AppendToOutBuffer(padding, pad_bytes); |
| 74 | 74 |
| 75 int res = FlushOutBuffer(); | 75 int res = FlushOutBuffer(); |
| 76 if (res <= 0) { | 76 if (res <= 0) { |
| 77 // drop packet if we made no progress | 77 // drop packet if we made no progress |
| 78 ClearOutBuffer(); | 78 ClearOutBuffer(); |
| 79 return res; | 79 return res; |
| 80 } | 80 } |
| 81 | 81 |
| 82 rtc::SentPacket sent_packet(options.packet_id, rtc::TimeMillis()); | |
|
juberti1
2017/05/27 23:17:21
This signal should probably only be fired when the
holmer
2017/06/02 07:08:00
Yes, I agree. If I correctly understand how the TC
Taylor Brandstetter
2017/06/02 17:42:43
I guess I don't see how filling a buffer in usersp
| |
| 83 SignalSentPacket(this, sent_packet); | |
| 84 | |
| 82 // We claim to have sent the whole thing, even if we only sent partial | 85 // We claim to have sent the whole thing, even if we only sent partial |
| 83 return static_cast<int>(cb); | 86 return static_cast<int>(cb); |
| 84 } | 87 } |
| 85 | 88 |
| 86 void AsyncStunTCPSocket::ProcessInput(char* data, size_t* len) { | 89 void AsyncStunTCPSocket::ProcessInput(char* data, size_t* len) { |
| 87 rtc::SocketAddress remote_addr(GetRemoteAddress()); | 90 rtc::SocketAddress remote_addr(GetRemoteAddress()); |
| 88 // STUN packet - First 4 bytes. Total header size is 20 bytes. | 91 // STUN packet - First 4 bytes. Total header size is 20 bytes. |
| 89 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | 92 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
| 90 // |0 0| STUN Message Type | Message Length | | 93 // |0 0| STUN Message Type | Message Length | |
| 91 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | 94 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 144 // message (including padding) is (4 + Length) rounded up to the nearest | 147 // message (including padding) is (4 + Length) rounded up to the nearest |
| 145 // multiple of 4. Over UDP, the padding is not required but MAY be | 148 // multiple of 4. Over UDP, the padding is not required but MAY be |
| 146 // included. | 149 // included. |
| 147 if (expected_pkt_len % 4) | 150 if (expected_pkt_len % 4) |
| 148 *pad_bytes = 4 - (expected_pkt_len % 4); | 151 *pad_bytes = 4 - (expected_pkt_len % 4); |
| 149 } | 152 } |
| 150 return expected_pkt_len; | 153 return expected_pkt_len; |
| 151 } | 154 } |
| 152 | 155 |
| 153 } // namespace cricket | 156 } // namespace cricket |
| OLD | NEW |