diff options
-rw-r--r-- | trace-listen.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/trace-listen.c b/trace-listen.c index 47e98f4..9a1981b 100644 --- a/trace-listen.c +++ b/trace-listen.c | |||
@@ -126,15 +126,19 @@ static void process_udp_child(int sfd, const char *host, const char *port, | |||
126 | if (use_tcp) { | 126 | if (use_tcp) { |
127 | if (listen(sfd, backlog) < 0) | 127 | if (listen(sfd, backlog) < 0) |
128 | die("listen"); | 128 | die("listen"); |
129 | peer_addr_len = sizeof(peer_addr); | ||
129 | cfd = accept(sfd, (struct sockaddr *)&peer_addr, &peer_addr_len); | 130 | cfd = accept(sfd, (struct sockaddr *)&peer_addr, &peer_addr_len); |
131 | if (cfd < 0) | ||
132 | die("accept"); | ||
130 | close(sfd); | 133 | close(sfd); |
131 | sfd = cfd; | 134 | sfd = cfd; |
132 | } | 135 | } |
133 | 136 | ||
134 | do { | 137 | do { |
135 | peer_addr_len = sizeof(peer_addr); | ||
136 | /* TODO, make this copyless! */ | 138 | /* TODO, make this copyless! */ |
137 | n = read(sfd, buf, page_size); | 139 | n = read(sfd, buf, page_size); |
140 | if (n < 0) | ||
141 | die("reading client"); | ||
138 | if (!n) | 142 | if (!n) |
139 | break; | 143 | break; |
140 | /* UDP requires that we get the full size in one go */ | 144 | /* UDP requires that we get the full size in one go */ |
@@ -287,6 +291,9 @@ static void process_client(const char *node, const char *port, int fd) | |||
287 | return; | 291 | return; |
288 | } | 292 | } |
289 | 293 | ||
294 | if (use_tcp) | ||
295 | printf("Using TCP for live connection\n"); | ||
296 | |||
290 | /* Create the client file */ | 297 | /* Create the client file */ |
291 | snprintf(buf, BUFSIZ, "%s.%s:%s.dat", output_file, node, port); | 298 | snprintf(buf, BUFSIZ, "%s.%s:%s.dat", output_file, node, port); |
292 | 299 | ||