OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 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 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
277 // TODO(ldixon): Consider turning this on/off. | 277 // TODO(ldixon): Consider turning this on/off. |
278 // Add a blackhole sysctl. Setting it to 1 results in no ABORTs | 278 // Add a blackhole sysctl. Setting it to 1 results in no ABORTs |
279 // being sent in response to INITs, setting it to 2 results | 279 // being sent in response to INITs, setting it to 2 results |
280 // in no ABORTs being sent for received OOTB packets. | 280 // in no ABORTs being sent for received OOTB packets. |
281 // This is similar to the TCP sysctl. | 281 // This is similar to the TCP sysctl. |
282 // | 282 // |
283 // See: http://lakerest.net/pipermail/sctp-coders/2012-January/009438.html | 283 // See: http://lakerest.net/pipermail/sctp-coders/2012-January/009438.html |
284 // See: http://svnweb.freebsd.org/base?view=revision&revision=229805 | 284 // See: http://svnweb.freebsd.org/base?view=revision&revision=229805 |
285 // usrsctp_sysctl_set_sctp_blackhole(2); | 285 // usrsctp_sysctl_set_sctp_blackhole(2); |
286 | 286 |
287 // Set the number of default outgoing streams. This is the number we'll | 287 // Set the number of default outgoing streams. This is the number we'll |
288 // send in the SCTP INIT message. The 'appropriate default' in the | 288 // send in the SCTP INIT message. |
289 // second paragraph of | 289 usrsctp_sysctl_set_sctp_nr_outgoing_streams_default(kMaxSctpStreams); |
290 // http://tools.ietf.org/html/draft-ietf-rtcweb-data-channel-05#section-6.2 | |
291 // is kMaxSctpSid. | |
292 usrsctp_sysctl_set_sctp_nr_outgoing_streams_default(kMaxSctpSid); | |
293 } | 290 } |
294 | 291 |
295 void UninitializeUsrSctp() { | 292 void UninitializeUsrSctp() { |
296 LOG(LS_INFO) << __FUNCTION__; | 293 LOG(LS_INFO) << __FUNCTION__; |
297 // usrsctp_finish() may fail if it's called too soon after the channels are | 294 // usrsctp_finish() may fail if it's called too soon after the channels are |
298 // closed. Wait and try again until it succeeds for up to 3 seconds. | 295 // closed. Wait and try again until it succeeds for up to 3 seconds. |
299 for (size_t i = 0; i < 300; ++i) { | 296 for (size_t i = 0; i < 300; ++i) { |
300 if (usrsctp_finish() == 0) { | 297 if (usrsctp_finish() == 0) { |
301 return; | 298 return; |
302 } | 299 } |
(...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
744 << " len=" << buffer.size() << " before SetReceive(true)."; | 741 << " len=" << buffer.size() << " before SetReceive(true)."; |
745 } | 742 } |
746 } | 743 } |
747 | 744 |
748 bool SctpDataMediaChannel::AddStream(const StreamParams& stream) { | 745 bool SctpDataMediaChannel::AddStream(const StreamParams& stream) { |
749 if (!stream.has_ssrcs()) { | 746 if (!stream.has_ssrcs()) { |
750 return false; | 747 return false; |
751 } | 748 } |
752 | 749 |
753 const uint32_t ssrc = stream.first_ssrc(); | 750 const uint32_t ssrc = stream.first_ssrc(); |
754 if (ssrc >= kMaxSctpSid) { | 751 if (ssrc >= kMaxSctpStreams) { |
755 LOG(LS_WARNING) << debug_name_ << "->Add(Send|Recv)Stream(...): " | 752 LOG(LS_WARNING) << debug_name_ << "->Add(Send|Recv)Stream(...): " |
756 << "Not adding data stream '" << stream.id | 753 << "Not adding data stream '" << stream.id |
757 << "' with ssrc=" << ssrc | 754 << "' with sid=" << ssrc << " because sid is too high."; |
758 << " because stream ssrc is too high."; | |
759 return false; | 755 return false; |
760 } else if (open_streams_.find(ssrc) != open_streams_.end()) { | 756 } else if (open_streams_.find(ssrc) != open_streams_.end()) { |
761 LOG(LS_WARNING) << debug_name_ << "->Add(Send|Recv)Stream(...): " | 757 LOG(LS_WARNING) << debug_name_ << "->Add(Send|Recv)Stream(...): " |
762 << "Not adding data stream '" << stream.id | 758 << "Not adding data stream '" << stream.id |
763 << "' with ssrc=" << ssrc | 759 << "' with sid=" << ssrc |
764 << " because stream is already open."; | 760 << " because stream is already open."; |
765 return false; | 761 return false; |
766 } else if (queued_reset_streams_.find(ssrc) != queued_reset_streams_.end() | 762 } else if (queued_reset_streams_.find(ssrc) != queued_reset_streams_.end() |
767 || sent_reset_streams_.find(ssrc) != sent_reset_streams_.end()) { | 763 || sent_reset_streams_.find(ssrc) != sent_reset_streams_.end()) { |
768 LOG(LS_WARNING) << debug_name_ << "->Add(Send|Recv)Stream(...): " | 764 LOG(LS_WARNING) << debug_name_ << "->Add(Send|Recv)Stream(...): " |
769 << "Not adding data stream '" << stream.id | 765 << "Not adding data stream '" << stream.id |
770 << "' with ssrc=" << ssrc | 766 << "' with sid=" << ssrc |
771 << " because stream is still closing."; | 767 << " because stream is still closing."; |
772 return false; | 768 return false; |
773 } | 769 } |
774 | 770 |
775 open_streams_.insert(ssrc); | 771 open_streams_.insert(ssrc); |
776 return true; | 772 return true; |
777 } | 773 } |
778 | 774 |
779 bool SctpDataMediaChannel::ResetStream(uint32_t ssrc) { | 775 bool SctpDataMediaChannel::ResetStream(uint32_t ssrc) { |
780 // We typically get this called twice for the same stream, once each for | 776 // We typically get this called twice for the same stream, once each for |
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1068 } | 1064 } |
1069 case MSG_SCTPOUTBOUNDPACKET: { | 1065 case MSG_SCTPOUTBOUNDPACKET: { |
1070 std::unique_ptr<OutboundPacketMessage> pdata( | 1066 std::unique_ptr<OutboundPacketMessage> pdata( |
1071 static_cast<OutboundPacketMessage*>(msg->pdata)); | 1067 static_cast<OutboundPacketMessage*>(msg->pdata)); |
1072 OnPacketFromSctpToNetwork(pdata->data().get()); | 1068 OnPacketFromSctpToNetwork(pdata->data().get()); |
1073 break; | 1069 break; |
1074 } | 1070 } |
1075 } | 1071 } |
1076 } | 1072 } |
1077 } // namespace cricket | 1073 } // namespace cricket |
OLD | NEW |