comparison src/network.c @ 8239:5220e0898252

[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 <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Thu, 12 Feb 2004 17:23:17 +0000
parents f50c059b6384
children 609a62b8e748
comparison
equal deleted inserted replaced
8238:32625c0dbba6 8239:5220e0898252
195 195
196 gaim_debug_info("network", "Listening on port: %hu\n", gaim_network_get_port_from_fd(listenfd)); 196 gaim_debug_info("network", "Listening on port: %hu\n", gaim_network_get_port_from_fd(listenfd));
197 return listenfd; 197 return listenfd;
198 } 198 }
199 199
200 int gaim_network_listen(short portnum) 200 int gaim_network_listen(short start, short end)
201 { 201 {
202 int ret = 0, start, end; 202 int ret = 0;
203 203
204 if (!gaim_prefs_get_bool("/core/network/ports_range_use") || portnum) 204 if (gaim_prefs_get_bool("/core/network/ports_range_use") ||
205 return gaim_network_do_listen(portnum); 205 (start > end) || (start < 1024) || (end < 1024)) {
206 206 start = gaim_prefs_get_int("/core/network/ports_range_start");
207 start = gaim_prefs_get_int("/core/network/ports_range_start"); 207 end = gaim_prefs_get_int("/core/network/ports_range_end");
208 end = gaim_prefs_get_int("/core/network/ports_range_end"); 208 }
209 209
210 for (; start <= end; start++) { 210 for (; start <= end; start++) {
211 ret = gaim_network_do_listen(start); 211 ret = gaim_network_do_listen(start);
212 if (ret >= 0) 212 if (ret >= 0)
213 break; 213 break;