Bug 876167: backout temporary fix for SCTP library bug (now fixed) r=tuexen

This commit is contained in:
Randell Jesup 2014-03-12 20:14:59 -04:00
parent fe2bc5a3f5
commit a7dda06114
2 changed files with 14 additions and 26 deletions

View File

@ -255,41 +255,32 @@ DataChannelConnection::Destroy()
// we can deregister this DataChannelConnection without leaking.
ClearResets();
MOZ_ASSERT(mSTS);
ASSERT_WEBRTC(NS_IsMainThread());
// Finish Destroy on STS thread to avoid bug 876167 - once that's fixed,
// the usrsctp_close() calls can move back here (and just proxy the
// disconnect_all())
RUN_ON_THREAD(mSTS, WrapRunnable(nsRefPtr<DataChannelConnection>(this),
&DataChannelConnection::DestroyOnSTS,
mSocket, mMasterSocket),
NS_DISPATCH_NORMAL);
if (mSocket && mSocket != mMasterSocket)
usrsctp_close(mSocket);
if (mMasterSocket)
usrsctp_close(mMasterSocket);
// These will be released on STS
mSocket = nullptr;
mMasterSocket = nullptr; // also a flag that we've Destroyed this connection
// Must do this in Destroy() since we may then delete this object
if (mUsingDtls) {
usrsctp_deregister_address(static_cast<void *>(this));
LOG(("Deregistered %p from the SCTP stack.", static_cast<void *>(this)));
}
// We can't get any more new callbacks from the SCTP library
// All existing callbacks have refs to DataChannelConnection
// nsDOMDataChannel objects have refs to DataChannels that have refs to us
}
void DataChannelConnection::DestroyOnSTS(struct socket *aMasterSocket,
struct socket *aSocket)
{
if (aSocket && aSocket != aMasterSocket)
usrsctp_close(aSocket);
if (aMasterSocket)
usrsctp_close(aMasterSocket);
disconnect_all();
if (mTransportFlow) {
MOZ_ASSERT(mSTS);
ASSERT_WEBRTC(NS_IsMainThread());
RUN_ON_THREAD(mSTS, WrapRunnable(nsRefPtr<DataChannelConnection>(this),
&DataChannelConnection::disconnect_all),
NS_DISPATCH_NORMAL);
// don't release mTransportFlow until we are destroyed in case
// runnables are in flight. We may well have packets to send as the
// SCTP lib may have sent a shutdown.
}
}
NS_IMPL_ISUPPORTS1(DataChannelConnection,

View File

@ -123,9 +123,6 @@ public:
bool Init(unsigned short aPort, uint16_t aNumStreams, bool aUsingDtls);
void Destroy(); // So we can spawn refs tied to runnables in shutdown
// Finish Destroy on STS to avoid SCTP race condition with ABORT from far end
void DestroyOnSTS(struct socket *aMasterSocket,
struct socket *aSocket);
#ifdef ALLOW_DIRECT_SCTP_LISTEN_CONNECT
// These block; they require something to decide on listener/connector