OLD | NEW |
1 /* | 1 /* |
2 * libjingle | 2 * libjingle |
3 * Copyright 2012 Google Inc. and Robin Seggelmann | 3 * Copyright 2012 Google Inc. and Robin Seggelmann |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions are met: | 6 * modification, are permitted provided that the following conditions are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright notice, | 8 * 1. Redistributions of source code must retain the above copyright notice, |
9 * this list of conditions and the following disclaimer. | 9 * this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright notice, | 10 * 2. Redistributions in binary form must reproduce the above copyright notice, |
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
370 sending_(false), | 370 sending_(false), |
371 receiving_(false), | 371 receiving_(false), |
372 debug_name_("SctpDataMediaChannel") { | 372 debug_name_("SctpDataMediaChannel") { |
373 } | 373 } |
374 | 374 |
375 SctpDataMediaChannel::~SctpDataMediaChannel() { | 375 SctpDataMediaChannel::~SctpDataMediaChannel() { |
376 CloseSctpSocket(); | 376 CloseSctpSocket(); |
377 } | 377 } |
378 | 378 |
379 void SctpDataMediaChannel::OnSendThresholdCallback() { | 379 void SctpDataMediaChannel::OnSendThresholdCallback() { |
380 DCHECK(rtc::Thread::Current() == worker_thread_); | 380 RTC_DCHECK(rtc::Thread::Current() == worker_thread_); |
381 SignalReadyToSend(true); | 381 SignalReadyToSend(true); |
382 } | 382 } |
383 | 383 |
384 sockaddr_conn SctpDataMediaChannel::GetSctpSockAddr(int port) { | 384 sockaddr_conn SctpDataMediaChannel::GetSctpSockAddr(int port) { |
385 sockaddr_conn sconn = {0}; | 385 sockaddr_conn sconn = {0}; |
386 sconn.sconn_family = AF_CONN; | 386 sconn.sconn_family = AF_CONN; |
387 #ifdef HAVE_SCONN_LEN | 387 #ifdef HAVE_SCONN_LEN |
388 sconn.sconn_len = sizeof(sockaddr_conn); | 388 sconn.sconn_len = sizeof(sockaddr_conn); |
389 #endif | 389 #endif |
390 // Note: conversion from int to uint16_t happens here. | 390 // Note: conversion from int to uint16_t happens here. |
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
651 if (result) { | 651 if (result) { |
652 // Only way out now is success. | 652 // Only way out now is success. |
653 *result = SDR_SUCCESS; | 653 *result = SDR_SUCCESS; |
654 } | 654 } |
655 return true; | 655 return true; |
656 } | 656 } |
657 | 657 |
658 // Called by network interface when a packet has been received. | 658 // Called by network interface when a packet has been received. |
659 void SctpDataMediaChannel::OnPacketReceived( | 659 void SctpDataMediaChannel::OnPacketReceived( |
660 rtc::Buffer* packet, const rtc::PacketTime& packet_time) { | 660 rtc::Buffer* packet, const rtc::PacketTime& packet_time) { |
661 DCHECK(rtc::Thread::Current() == worker_thread_); | 661 RTC_DCHECK(rtc::Thread::Current() == worker_thread_); |
662 LOG(LS_VERBOSE) << debug_name_ << "->OnPacketReceived(...): " | 662 LOG(LS_VERBOSE) << debug_name_ << "->OnPacketReceived(...): " |
663 << " length=" << packet->size() << ", sending: " << sending_; | 663 << " length=" << packet->size() << ", sending: " << sending_; |
664 // Only give receiving packets to usrsctp after if connected. This enables two | 664 // Only give receiving packets to usrsctp after if connected. This enables two |
665 // peers to each make a connect call, but for them not to receive an INIT | 665 // peers to each make a connect call, but for them not to receive an INIT |
666 // packet before they have called connect; least the last receiver of the INIT | 666 // packet before they have called connect; least the last receiver of the INIT |
667 // packet will have called connect, and a connection will be established. | 667 // packet will have called connect, and a connection will be established. |
668 if (sending_) { | 668 if (sending_) { |
669 // Pass received packet to SCTP stack. Once processed by usrsctp, the data | 669 // Pass received packet to SCTP stack. Once processed by usrsctp, the data |
670 // will be will be given to the global OnSctpInboundData, and then, | 670 // will be will be given to the global OnSctpInboundData, and then, |
671 // marshalled by a Post and handled with OnMessage. | 671 // marshalled by a Post and handled with OnMessage. |
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1029 } | 1029 } |
1030 case MSG_SCTPOUTBOUNDPACKET: { | 1030 case MSG_SCTPOUTBOUNDPACKET: { |
1031 rtc::scoped_ptr<OutboundPacketMessage> pdata( | 1031 rtc::scoped_ptr<OutboundPacketMessage> pdata( |
1032 static_cast<OutboundPacketMessage*>(msg->pdata)); | 1032 static_cast<OutboundPacketMessage*>(msg->pdata)); |
1033 OnPacketFromSctpToNetwork(pdata->data().get()); | 1033 OnPacketFromSctpToNetwork(pdata->data().get()); |
1034 break; | 1034 break; |
1035 } | 1035 } |
1036 } | 1036 } |
1037 } | 1037 } |
1038 } // namespace cricket | 1038 } // namespace cricket |
OLD | NEW |