Bug 1464917 - Add GetMaxPacketLifeTime and GetMaxRetransmits to DataChannel; r=drno
authorDan Minor <dminor@mozilla.com>
Fri, 01 Jun 2018 08:20:51 -0400
changeset 421140 aadb40090d20
parent 421139 160f7211a241
child 421141 2481a7bf81ea
push id64807
push userdminor@mozilla.com
push dateMon, 04 Jun 2018 13:05:22 +0000
treeherderautoland@2481a7bf81ea [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdrno
bugs1464917
milestone62.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1464917 - Add GetMaxPacketLifeTime and GetMaxRetransmits to DataChannel; r=drno MozReview-Commit-ID: BqukQygumpi
dom/base/nsDOMDataChannel.cpp
netwerk/sctp/datachannel/DataChannel.cpp
netwerk/sctp/datachannel/DataChannel.h
--- a/dom/base/nsDOMDataChannel.cpp
+++ b/dom/base/nsDOMDataChannel.cpp
@@ -134,23 +134,23 @@ bool
 nsDOMDataChannel::Reliable() const
 {
   return mDataChannel->GetType() == mozilla::DataChannelConnection::RELIABLE;
 }
 
 mozilla::dom::Nullable<uint16_t>
 nsDOMDataChannel::GetMaxPacketLifeTime() const
 {
-  return mozilla::dom::Nullable<uint16_t>();
+  return mDataChannel->GetMaxPacketLifeTime();
 }
 
 mozilla::dom::Nullable<uint16_t>
 nsDOMDataChannel::GetMaxRetransmits() const
 {
-  return mozilla::dom::Nullable<uint16_t>();
+  return mDataChannel->GetMaxRetransmits();
 }
 
 bool
 nsDOMDataChannel::Ordered() const
 {
   return mDataChannel->GetOrdered();
 }
 
--- a/netwerk/sctp/datachannel/DataChannel.cpp
+++ b/netwerk/sctp/datachannel/DataChannel.cpp
@@ -3167,16 +3167,34 @@ DataChannel::SendBinaryStream(nsIInputSt
 {
   if (!EnsureValidStream(aRv)) {
     return;
   }
 
   SendErrnoToErrorResult(mConnection->SendBlob(mStream, aBlob), aRv);
 }
 
+dom::Nullable<uint16_t>
+DataChannel::GetMaxPacketLifeTime() const
+{
+  if (mPrPolicy == SCTP_PR_SCTP_TTL) {
+    return dom::Nullable<uint16_t>(mPrValue);
+  }
+  return dom::Nullable<uint16_t>();
+}
+
+dom::Nullable<uint16_t>
+DataChannel::GetMaxRetransmits() const
+{
+  if (mPrPolicy == SCTP_PR_SCTP_RTX) {
+    return dom::Nullable<uint16_t>(mPrValue);
+  }
+  return dom::Nullable<uint16_t>();
+}
+
 // May be called from another (i.e. Main) thread!
 void
 DataChannel::AppReady()
 {
   ENSURE_DATACONNECTION;
 
   MutexAutoLock lock(mConnection->mLock);
 
--- a/netwerk/sctp/datachannel/DataChannel.h
+++ b/netwerk/sctp/datachannel/DataChannel.h
@@ -414,16 +414,20 @@ public:
   // Send a binary message (TypedArray)
   void SendBinaryMsg(const nsACString &aMsg, ErrorResult& aRv);
 
   // Send a binary blob
   void SendBinaryStream(nsIInputStream *aBlob, ErrorResult& aRv);
 
   uint16_t GetType() { return mPrPolicy; }
 
+  dom::Nullable<uint16_t> GetMaxPacketLifeTime() const;
+
+  dom::Nullable<uint16_t> GetMaxRetransmits() const;
+
   bool GetOrdered() { return !(mFlags & DATA_CHANNEL_FLAGS_OUT_OF_ORDER_ALLOWED); }
 
   // Amount of data buffered to send
   uint32_t GetBufferedAmount()
   {
     if (!mConnection) {
       return 0;
     }