| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: master.c,v 1.9 2015/10/21 23:03:17 joerg Exp $ */ | | 1 | /* $NetBSD: master.c,v 1.10 2015/10/22 19:57:47 joerg Exp $ */ |
2 | | | 2 | |
3 | /*- | | 3 | /*- |
4 | * Copyright (c) 2007, 2009 Joerg Sonnenberger <joerg@NetBSD.org>. | | 4 | * Copyright (c) 2007, 2009 Joerg Sonnenberger <joerg@NetBSD.org>. |
5 | * All rights reserved. | | 5 | * All rights reserved. |
6 | * | | 6 | * |
7 | * This code was developed as part of Google's Summer of Code 2007 program. | | 7 | * This code was developed as part of Google's Summer of Code 2007 program. |
8 | * | | 8 | * |
9 | * Redistribution and use in source and binary forms, with or without | | 9 | * Redistribution and use in source and binary forms, with or without |
10 | * modification, are permitted provided that the following conditions | | 10 | * modification, are permitted provided that the following conditions |
11 | * are met: | | 11 | * are met: |
12 | * | | 12 | * |
13 | * 1. Redistributions of source code must retain the above copyright | | 13 | * 1. Redistributions of source code must retain the above copyright |
14 | * notice, this list of conditions and the following disclaimer. | | 14 | * notice, this list of conditions and the following disclaimer. |
| @@ -152,28 +152,27 @@ send_job_path(void *arg) | | | @@ -152,28 +152,27 @@ send_job_path(void *arg) |
152 | strlen(peer->job->pkg_location), peer, recv_output_len, | | 152 | strlen(peer->job->pkg_location), peer, recv_output_len, |
153 | kill_peer); | | 153 | kill_peer); |
154 | } | | 154 | } |
155 | | | 155 | |
156 | static void | | 156 | static void |
157 | shutdown_master(void) | | 157 | shutdown_master(void) |
158 | { | | 158 | { |
159 | struct timeval tv; | | 159 | struct timeval tv; |
160 | struct scan_peer *peer; | | 160 | struct scan_peer *peer; |
161 | | | 161 | |
162 | event_del(&listen_event); | | 162 | event_del(&listen_event); |
163 | (void)close(listen_event_socket); | | 163 | (void)close(listen_event_socket); |
164 | LIST_FOREACH(peer, &inactive_peers, peer_link) { | | 164 | LIST_FOREACH(peer, &inactive_peers, peer_link) { |
165 | (void)shutdown(peer->fd, SHUT_RDWR); | | 165 | uint16_t net_job_len = htons(0); |
166 | uint16_t net_job_len = htons(job_len); | | | |
167 | (void)memcpy(peer->tmp_buf, &net_job_len, 2); | | 166 | (void)memcpy(peer->tmp_buf, &net_job_len, 2); |
168 | | | 167 | |
169 | deferred_write(peer->fd, peer->tmp_buf, 2, peer, do_nothing, | | 168 | deferred_write(peer->fd, peer->tmp_buf, 2, peer, do_nothing, |
170 | kill_peer); | | 169 | kill_peer); |
171 | } | | 170 | } |
172 | tv.tv_sec = 1; | | 171 | tv.tv_sec = 1; |
173 | tv.tv_usec = 0; | | 172 | tv.tv_usec = 0; |
174 | event_loopexit(&tv); | | 173 | event_loopexit(&tv); |
175 | } | | 174 | } |
176 | | | 175 | |
177 | static void | | 176 | static void |
178 | assign_job(struct scan_peer *peer) | | 177 | assign_job(struct scan_peer *peer) |
179 | { | | 178 | { |