# HG changeset patch # User Mark Doliner # Date 1076606597 0 # Node ID 5220e0898252b0d4287653cb2b0153627abbacb8 # Parent 32625c0dbba63b16398926867f4d1a10db254dd5 [gaim-migrate @ 8962] Methinks prpl's should be able to specify a range of ports. Also, I don't think Gaim should ever try to bind to ports below 1024... Maybe that should be allowed though, I don't know? committer: Tailor Script diff -r 32625c0dbba6 -r 5220e0898252 src/network.c --- a/src/network.c Thu Feb 12 17:02:35 2004 +0000 +++ b/src/network.c Thu Feb 12 17:23:17 2004 +0000 @@ -197,15 +197,15 @@ return listenfd; } -int gaim_network_listen(short portnum) +int gaim_network_listen(short start, short end) { - int ret = 0, start, end; + int ret = 0; - if (!gaim_prefs_get_bool("/core/network/ports_range_use") || portnum) - return gaim_network_do_listen(portnum); - - start = gaim_prefs_get_int("/core/network/ports_range_start"); - end = gaim_prefs_get_int("/core/network/ports_range_end"); + if (gaim_prefs_get_bool("/core/network/ports_range_use") || + (start > end) || (start < 1024) || (end < 1024)) { + start = gaim_prefs_get_int("/core/network/ports_range_start"); + end = gaim_prefs_get_int("/core/network/ports_range_end"); + } for (; start <= end; start++) { ret = gaim_network_do_listen(start); diff -r 32625c0dbba6 -r 5220e0898252 src/network.h --- a/src/network.h Thu Feb 12 17:02:35 2004 +0000 +++ b/src/network.h Thu Feb 12 17:23:17 2004 +0000 @@ -96,13 +96,14 @@ * the listening socket, and add a new watcher on the new socket accept * returned. * - * @param portnum The port number to bind to, or 0, to let the core decide. - * By default, the core will let the kernel pick one at random, - * but users are allowed to specify a range. - * + * @param start The port number to bind to, or 0 to let the core decide. + * By default, the core will let the kernel pick one at random, + * but users are allowed to specify a range. + * @param end The highest possible port in the range of ports to listen on, + * or 0 to let the core decide. * @return The file descriptor of the listening socket. */ -int gaim_network_listen(short portnum); +int gaim_network_listen(short start, short end); /** * Gets a port number from a file descriptor.