Bug 1239870 - Part 2: Split out NrIceCtx initialization. r=bwc

This splits NrIceCtx initialization into its own function so that the tests
can initialize without having to create a dummy instance.
This commit is contained in:
Eric Rahm 2016-02-24 18:37:18 -08:00
parent 6964ea6946
commit aac78e2895
2 changed files with 21 additions and 9 deletions

View File

@ -396,15 +396,10 @@ void NrIceCtx::trickle_cb(void *arg, nr_ice_ctx *ice_ctx,
s->SignalCandidate(s, candidate_str);
}
RefPtr<NrIceCtx> NrIceCtx::Create(const std::string& name,
bool offerer,
bool allow_loopback,
bool tcp_enabled,
bool allow_link_local,
bool hide_non_default,
Policy policy) {
RefPtr<NrIceCtx> ctx = new NrIceCtx(name, offerer, policy);
void NrIceCtx::Init(bool allow_loopback,
bool tcp_enabled,
bool allow_link_local)
{
// Initialize the crypto callbacks and logging stuff
if (!initialized) {
NR_reg_init(NR_REG_MODE_LOCAL);
@ -477,6 +472,19 @@ RefPtr<NrIceCtx> NrIceCtx::Create(const std::string& name,
NR_reg_set_string((char *)NR_ICE_REG_PREF_FORCE_INTERFACE_NAME, const_cast<char*>(flat.get()));
}
}
}
RefPtr<NrIceCtx> NrIceCtx::Create(const std::string& name,
bool offerer,
bool allow_loopback,
bool tcp_enabled,
bool allow_link_local,
bool hide_non_default,
Policy policy) {
RefPtr<NrIceCtx> ctx = new NrIceCtx(name, offerer, policy);
// Initialize the crypto callbacks and logging stuff
Init(allow_loopback, tcp_enabled, allow_link_local);
// Create the ICE context
int r;

View File

@ -215,6 +215,10 @@ class NrIceCtx {
ICE_POLICY_ALL
};
static void Init(bool allow_loopback = false,
bool tcp_enabled = true,
bool allow_link_local = false);
// TODO(ekr@rtfm.com): Too many bools here. Bug 1193437.
static RefPtr<NrIceCtx> Create(const std::string& name,
bool offerer,