Deleted Added
full compact
hastd.c (209177) hastd.c (209185)
1/*-
2 * Copyright (c) 2009-2010 The FreeBSD Foundation
3 * All rights reserved.
4 *
5 * This software was developed by Pawel Jakub Dawidek under sponsorship from
6 * the FreeBSD Foundation.
7 *
8 * Redistribution and use in source and binary forms, with or without

--- 14 unchanged lines hidden (view full) ---

23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 */
29
30#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 2009-2010 The FreeBSD Foundation
3 * All rights reserved.
4 *
5 * This software was developed by Pawel Jakub Dawidek under sponsorship from
6 * the FreeBSD Foundation.
7 *
8 * Redistribution and use in source and binary forms, with or without

--- 14 unchanged lines hidden (view full) ---

23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 */
29
30#include <sys/cdefs.h>
31__FBSDID("$FreeBSD: head/sbin/hastd/hastd.c 209177 2010-06-14 21:18:58Z pjd $");
31__FBSDID("$FreeBSD: head/sbin/hastd/hastd.c 209185 2010-06-14 21:46:48Z pjd $");
32
33#include <sys/param.h>
34#include <sys/linker.h>
35#include <sys/module.h>
36#include <sys/wait.h>
37
38#include <assert.h>
39#include <err.h>

--- 155 unchanged lines hidden (view full) ---

195
196 if (proto_accept(cfg->hc_listenconn, &conn) < 0) {
197 pjdlog_errno(LOG_ERR, "Unable to accept connection %s", laddr);
198 return;
199 }
200
201 proto_local_address(conn, laddr, sizeof(laddr));
202 proto_remote_address(conn, raddr, sizeof(raddr));
32
33#include <sys/param.h>
34#include <sys/linker.h>
35#include <sys/module.h>
36#include <sys/wait.h>
37
38#include <assert.h>
39#include <err.h>

--- 155 unchanged lines hidden (view full) ---

195
196 if (proto_accept(cfg->hc_listenconn, &conn) < 0) {
197 pjdlog_errno(LOG_ERR, "Unable to accept connection %s", laddr);
198 return;
199 }
200
201 proto_local_address(conn, laddr, sizeof(laddr));
202 proto_remote_address(conn, raddr, sizeof(raddr));
203 pjdlog_info("Connection from %s to %s.", laddr, raddr);
203 pjdlog_info("Connection from %s to %s.", raddr, laddr);
204
205 /* Error in setting timeout is not critical, but why should it fail? */
206 if (proto_timeout(conn, HAST_TIMEOUT) < 0)
207 pjdlog_errno(LOG_WARNING, "Unable to set connection timeout");
208
209 nvin = nvout = nverr = NULL;
210
211 /*

--- 69 unchanged lines hidden (view full) ---

281 "Remote node acts as %s for the resource and not as %s.",
282 role2str(res->hr_role), role2str(HAST_ROLE_SECONDARY));
283 goto fail;
284 }
285 /* Does token (if exists) match? */
286 if (token != NULL && memcmp(token, res->hr_token,
287 sizeof(res->hr_token)) != 0) {
288 pjdlog_error("Token received from %s doesn't match.", raddr);
204
205 /* Error in setting timeout is not critical, but why should it fail? */
206 if (proto_timeout(conn, HAST_TIMEOUT) < 0)
207 pjdlog_errno(LOG_WARNING, "Unable to set connection timeout");
208
209 nvin = nvout = nverr = NULL;
210
211 /*

--- 69 unchanged lines hidden (view full) ---

281 "Remote node acts as %s for the resource and not as %s.",
282 role2str(res->hr_role), role2str(HAST_ROLE_SECONDARY));
283 goto fail;
284 }
285 /* Does token (if exists) match? */
286 if (token != NULL && memcmp(token, res->hr_token,
287 sizeof(res->hr_token)) != 0) {
288 pjdlog_error("Token received from %s doesn't match.", raddr);
289 nv_add_stringf(nverr, "errmsg", "Toke doesn't match.");
289 nv_add_stringf(nverr, "errmsg", "Token doesn't match.");
290 goto fail;
291 }
292 /*
293 * If there is no token, but we have half-open connection
294 * (only remotein) or full connection (worker process is running)
295 * we have to cancel those and accept the new connection.
296 */
297 if (token == NULL) {

--- 237 unchanged lines hidden ---
290 goto fail;
291 }
292 /*
293 * If there is no token, but we have half-open connection
294 * (only remotein) or full connection (worker process is running)
295 * we have to cancel those and accept the new connection.
296 */
297 if (token == NULL) {

--- 237 unchanged lines hidden ---