diff options
| -rw-r--r-- | trace-listen.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/trace-listen.c b/trace-listen.c index e8c9ba9..e60c96b 100644 --- a/trace-listen.c +++ b/trace-listen.c | |||
| @@ -231,13 +231,13 @@ static void process_udp_child(int sfd, const char *host, const char *port, | |||
| 231 | #define MAX_PORT_SEARCH 6000 | 231 | #define MAX_PORT_SEARCH 6000 |
| 232 | 232 | ||
| 233 | static int open_udp(const char *node, const char *port, int *pid, | 233 | static int open_udp(const char *node, const char *port, int *pid, |
| 234 | int cpu, int pagesize) | 234 | int cpu, int pagesize, int start_port) |
| 235 | { | 235 | { |
| 236 | struct addrinfo hints; | 236 | struct addrinfo hints; |
| 237 | struct addrinfo *result, *rp; | 237 | struct addrinfo *result, *rp; |
| 238 | int sfd, s; | 238 | int sfd, s; |
| 239 | char buf[BUFSIZ]; | 239 | char buf[BUFSIZ]; |
| 240 | int num_port = START_PORT_SEARCH; | 240 | int num_port = start_port; |
| 241 | 241 | ||
| 242 | again: | 242 | again: |
| 243 | snprintf(buf, BUFSIZ, "%d", num_port); | 243 | snprintf(buf, BUFSIZ, "%d", num_port); |
| @@ -293,6 +293,7 @@ static void process_client(const char *node, const char *port, int fd) | |||
| 293 | int *port_array; | 293 | int *port_array; |
| 294 | int *pid_array; | 294 | int *pid_array; |
| 295 | int pagesize; | 295 | int pagesize; |
| 296 | int start_port; | ||
| 296 | int udp_port; | 297 | int udp_port; |
| 297 | int options; | 298 | int options; |
| 298 | int size; | 299 | int size; |
| @@ -379,13 +380,17 @@ static void process_client(const char *node, const char *port, int fd) | |||
| 379 | pid_array = malloc_or_die(sizeof(int) * cpus); | 380 | pid_array = malloc_or_die(sizeof(int) * cpus); |
| 380 | memset(pid_array, 0, sizeof(int) * cpus); | 381 | memset(pid_array, 0, sizeof(int) * cpus); |
| 381 | 382 | ||
| 383 | start_port = START_PORT_SEARCH; | ||
| 384 | |||
| 382 | /* Now create a UDP port for each CPU */ | 385 | /* Now create a UDP port for each CPU */ |
| 383 | for (cpu = 0; cpu < cpus; cpu++) { | 386 | for (cpu = 0; cpu < cpus; cpu++) { |
| 384 | udp_port = open_udp(node, port, &pid, cpu, pagesize); | 387 | udp_port = open_udp(node, port, &pid, cpu, pagesize, start_port); |
| 385 | if (udp_port < 0) | 388 | if (udp_port < 0) |
| 386 | goto out_free; | 389 | goto out_free; |
| 387 | port_array[cpu] = udp_port; | 390 | port_array[cpu] = udp_port; |
| 388 | pid_array[cpu] = pid; | 391 | pid_array[cpu] = pid; |
| 392 | /* due to some bugging finding ports, force search after last port */ | ||
| 393 | start_port = udp_port+1; | ||
| 389 | } | 394 | } |
| 390 | 395 | ||
| 391 | /* send the client a comma deliminated set of port numbers */ | 396 | /* send the client a comma deliminated set of port numbers */ |
