Chromium Code Reviews| 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 532 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 543 sock_, reinterpret_cast<sockaddr *>(&remote_sconn), sizeof(remote_sconn)); | 543 sock_, reinterpret_cast<sockaddr *>(&remote_sconn), sizeof(remote_sconn)); |
| 544 if (connect_result < 0 && errno != SCTP_EINPROGRESS) { | 544 if (connect_result < 0 && errno != SCTP_EINPROGRESS) { |
| 545 LOG_ERRNO(LS_ERROR) << debug_name_ << "Failed usrsctp_connect. got errno=" | 545 LOG_ERRNO(LS_ERROR) << debug_name_ << "Failed usrsctp_connect. got errno=" |
| 546 << errno << ", but wanted " << SCTP_EINPROGRESS; | 546 << errno << ", but wanted " << SCTP_EINPROGRESS; |
| 547 CloseSctpSocket(); | 547 CloseSctpSocket(); |
| 548 return false; | 548 return false; |
| 549 } | 549 } |
| 550 // Set the MTU and disable MTU discovery. | 550 // Set the MTU and disable MTU discovery. |
| 551 // We can only do this after usrsctp_connect or it has no effect. | 551 // We can only do this after usrsctp_connect or it has no effect. |
| 552 sctp_paddrparams params = {{0}}; | 552 sctp_paddrparams params = {{0}}; |
| 553 memcpy(reinterpret_cast<sockaddr*>(¶ms.spp_address), | 553 memcpy(reinterpret_cast<sockaddr_conn*>(¶ms.spp_address), &remote_sconn, |
|
skvlad
2016/09/06 18:29:16
Could this be done as an assignment instead? That
Taylor Brandstetter
2016/09/06 20:00:47
Hmm. It seems like that would work, but I see the
honghaiz3
2016/09/06 22:12:09
Does it matter to reinterpret_cast the dest pointe
Taylor Brandstetter
2016/09/06 22:54:29
Maybe not; again, I was copying the pattern used e
| |
| 554 reinterpret_cast<sockaddr*>(&remote_sconn), sizeof(sockaddr)); | 554 sizeof(remote_sconn)); |
| 555 params.spp_flags = SPP_PMTUD_DISABLE; | 555 params.spp_flags = SPP_PMTUD_DISABLE; |
| 556 params.spp_pathmtu = kSctpMtu; | 556 params.spp_pathmtu = kSctpMtu; |
| 557 if (usrsctp_setsockopt(sock_, IPPROTO_SCTP, SCTP_PEER_ADDR_PARAMS, ¶ms, | 557 if (usrsctp_setsockopt(sock_, IPPROTO_SCTP, SCTP_PEER_ADDR_PARAMS, ¶ms, |
| 558 sizeof(params))) { | 558 sizeof(params))) { |
| 559 LOG_ERRNO(LS_ERROR) << debug_name_ | 559 LOG_ERRNO(LS_ERROR) << debug_name_ |
| 560 << "Failed to set SCTP_PEER_ADDR_PARAMS."; | 560 << "Failed to set SCTP_PEER_ADDR_PARAMS."; |
| 561 } | 561 } |
| 562 return true; | 562 return true; |
| 563 } | 563 } |
| 564 | 564 |
| (...skipping 493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1058 } | 1058 } |
| 1059 case MSG_SCTPOUTBOUNDPACKET: { | 1059 case MSG_SCTPOUTBOUNDPACKET: { |
| 1060 std::unique_ptr<OutboundPacketMessage> pdata( | 1060 std::unique_ptr<OutboundPacketMessage> pdata( |
| 1061 static_cast<OutboundPacketMessage*>(msg->pdata)); | 1061 static_cast<OutboundPacketMessage*>(msg->pdata)); |
| 1062 OnPacketFromSctpToNetwork(pdata->data().get()); | 1062 OnPacketFromSctpToNetwork(pdata->data().get()); |
| 1063 break; | 1063 break; |
| 1064 } | 1064 } |
| 1065 } | 1065 } |
| 1066 } | 1066 } |
| 1067 } // namespace cricket | 1067 } // namespace cricket |
| OLD | NEW |