250 |
250 |
251 static gconstpointer new(void) |
251 static gconstpointer new(void) |
252 { |
252 { |
253 JingleS5B *js5b = g_new0(JingleS5B, 1); |
253 JingleS5B *js5b = g_new0(JingleS5B, 1); |
254 |
254 |
255 |
|
256 js5b->mode = JINGLE_S5B_TCP; |
255 js5b->mode = JINGLE_S5B_TCP; |
257 js5b->sid = gen_random_sid(); |
256 js5b->sid = gen_random_sid(); |
258 // the user can manually specify a port range to use in for format: |
|
259 // portstart-portend |
|
260 |
|
261 |
257 |
262 js5b->ourcandidates = get_our_candidates(get_port()); |
258 js5b->ourcandidates = get_our_candidates(get_port()); |
263 |
259 |
264 return js5b; |
260 return js5b; |
265 } |
261 } |
350 g_inet_address_to_string(cand->host), |
346 g_inet_address_to_string(cand->host), |
351 cand->port, |
347 cand->port, |
352 err->message != NULL ? err->message : "(no message)"); |
348 err->message != NULL ? err->message : "(no message)"); |
353 goto cleancontinue; |
349 goto cleancontinue; |
354 } |
350 } |
355 g_object_unref(saddr); |
|
356 |
351 |
357 if (!g_socket_listen(cand->sock, &err)) { |
352 if (!g_socket_listen(cand->sock, &err)) { |
358 scr_LogPrint(LPRINT_LOGNORM, "Jingle S5B: Unable to listen on %s port %u: %s", |
353 scr_LogPrint(LPRINT_LOGNORM, "Jingle S5B: Unable to listen on %s port %u: %s", |
359 g_inet_address_to_string(cand->host), |
354 g_inet_address_to_string(cand->host), |
360 cand->port, |
355 cand->port, |
361 err->message != NULL ? err->message : "(no message)"); |
356 err->message != NULL ? err->message : "(no message)"); |
362 goto cleancontinue; |
357 goto cleancontinue; |
363 } |
358 } |
364 |
359 |
365 if (!g_socket_listener_add_socket(js5b->listener, cand->sock, NULL, &err)) { |
360 if (!g_socket_listener_add_socket(js5b->listener, cand->sock, NULL, &err)) { |
366 scr_LogPrint(LPRINT_LOGNORM, "Jingle S5B: Error while to the host: %s", |
361 scr_LogPrint(LPRINT_LOGNORM, "Jingle S5B: Unable to add our socket to the" |
|
362 " GSocketListener: %s", |
367 err->message != NULL ? err->message : "(no message)"); |
363 err->message != NULL ? err->message : "(no message)"); |
368 goto cleancontinue; |
364 goto cleancontinue; |
369 } |
365 } |
370 |
366 |
|
367 scr_LogPrint(LPRINT_LOGNORM, "Jingle S5B: Listening on %s:%u", |
|
368 g_inet_address_to_string(cand->host), |
|
369 cand->port); |
371 ++numlistening; |
370 ++numlistening; |
372 |
371 |
373 cleancontinue: |
372 cleancontinue: |
374 g_object_unref(saddr); |
373 g_object_unref(saddr); |
375 g_object_unref(cand->sock); |
374 g_object_unref(cand->sock); |