mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-01-09 05:14:24 +00:00
Bug 878082 - Move handle generation to after PSM setup r=jesup
This commit is contained in:
parent
ad4c467134
commit
875c9daca2
@ -503,27 +503,6 @@ PeerConnectionImpl::Initialize(IPeerConnectionObserver* aObserver,
|
||||
{
|
||||
nsresult res;
|
||||
|
||||
// Generate a random handle
|
||||
unsigned char handle_bin[8];
|
||||
SECStatus rv;
|
||||
rv = PK11_GenerateRandom(handle_bin, sizeof(handle_bin));
|
||||
if (rv != SECSuccess) {
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
|
||||
char hex[17];
|
||||
PR_snprintf(hex,sizeof(hex),"%.2x%.2x%.2x%.2x%.2x%.2x%.2x%.2x",
|
||||
handle_bin[0],
|
||||
handle_bin[1],
|
||||
handle_bin[2],
|
||||
handle_bin[3],
|
||||
handle_bin[4],
|
||||
handle_bin[5],
|
||||
handle_bin[6],
|
||||
handle_bin[7]);
|
||||
|
||||
mHandle = hex;
|
||||
|
||||
// Invariant: we receive configuration one way or the other but not both (XOR)
|
||||
MOZ_ASSERT(!aConfiguration != !aRTCConfiguration);
|
||||
#ifdef MOZILLA_INTERNAL_API
|
||||
@ -551,6 +530,28 @@ PeerConnectionImpl::Initialize(IPeerConnectionObserver* aObserver,
|
||||
NS_ENSURE_STATE(mWindow);
|
||||
#endif
|
||||
|
||||
// Generate a random handle
|
||||
unsigned char handle_bin[8];
|
||||
SECStatus rv;
|
||||
rv = PK11_GenerateRandom(handle_bin, sizeof(handle_bin));
|
||||
if (rv != SECSuccess) {
|
||||
MOZ_CRASH();
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
|
||||
char hex[17];
|
||||
PR_snprintf(hex,sizeof(hex),"%.2x%.2x%.2x%.2x%.2x%.2x%.2x%.2x",
|
||||
handle_bin[0],
|
||||
handle_bin[1],
|
||||
handle_bin[2],
|
||||
handle_bin[3],
|
||||
handle_bin[4],
|
||||
handle_bin[5],
|
||||
handle_bin[6],
|
||||
handle_bin[7]);
|
||||
|
||||
mHandle = hex;
|
||||
|
||||
res = PeerConnectionCtx::InitializeGlobal(mThread);
|
||||
NS_ENSURE_SUCCESS(res, res);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user