hastd.c (219351) | hastd.c (219354) |
---|---|
1/*- 2 * Copyright (c) 2009-2010 The FreeBSD Foundation 3 * Copyright (c) 2010-2011 Pawel Jakub Dawidek <pawel@dawidek.net> 4 * All rights reserved. 5 * 6 * This software was developed by Pawel Jakub Dawidek under sponsorship from 7 * the FreeBSD Foundation. 8 * --- 15 unchanged lines hidden (view full) --- 24 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28 * SUCH DAMAGE. 29 */ 30 31#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 2009-2010 The FreeBSD Foundation 3 * Copyright (c) 2010-2011 Pawel Jakub Dawidek <pawel@dawidek.net> 4 * All rights reserved. 5 * 6 * This software was developed by Pawel Jakub Dawidek under sponsorship from 7 * the FreeBSD Foundation. 8 * --- 15 unchanged lines hidden (view full) --- 24 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28 * SUCH DAMAGE. 29 */ 30 31#include <sys/cdefs.h> |
32__FBSDID("$FreeBSD: head/sbin/hastd/hastd.c 219351 2011-03-06 22:56:14Z pjd $"); | 32__FBSDID("$FreeBSD: head/sbin/hastd/hastd.c 219354 2011-03-06 23:09:33Z pjd $"); |
33 34#include <sys/param.h> 35#include <sys/linker.h> 36#include <sys/module.h> 37#include <sys/stat.h> 38#include <sys/wait.h> 39 40#include <err.h> --- 317 unchanged lines hidden (view full) --- 358 if (res0->hr_role == HAST_ROLE_INIT || 359 res0->hr_role == HAST_ROLE_SECONDARY) { 360 if (strcmp(res0->hr_remoteaddr, res1->hr_remoteaddr) != 0) 361 return (true); 362 if (res0->hr_replication != res1->hr_replication) 363 return (true); 364 if (res0->hr_checksum != res1->hr_checksum) 365 return (true); | 33 34#include <sys/param.h> 35#include <sys/linker.h> 36#include <sys/module.h> 37#include <sys/stat.h> 38#include <sys/wait.h> 39 40#include <err.h> --- 317 unchanged lines hidden (view full) --- 358 if (res0->hr_role == HAST_ROLE_INIT || 359 res0->hr_role == HAST_ROLE_SECONDARY) { 360 if (strcmp(res0->hr_remoteaddr, res1->hr_remoteaddr) != 0) 361 return (true); 362 if (res0->hr_replication != res1->hr_replication) 363 return (true); 364 if (res0->hr_checksum != res1->hr_checksum) 365 return (true); |
366 if (res0->hr_compression != res1->hr_compression) 367 return (true); |
|
366 if (res0->hr_timeout != res1->hr_timeout) 367 return (true); 368 if (strcmp(res0->hr_exec, res1->hr_exec) != 0) 369 return (true); 370 } 371 return (false); 372} 373 --- 10 unchanged lines hidden (view full) --- 384 return (false); 385 386 if (strcmp(res0->hr_remoteaddr, res1->hr_remoteaddr) != 0) 387 return (true); 388 if (res0->hr_replication != res1->hr_replication) 389 return (true); 390 if (res0->hr_checksum != res1->hr_checksum) 391 return (true); | 368 if (res0->hr_timeout != res1->hr_timeout) 369 return (true); 370 if (strcmp(res0->hr_exec, res1->hr_exec) != 0) 371 return (true); 372 } 373 return (false); 374} 375 --- 10 unchanged lines hidden (view full) --- 386 return (false); 387 388 if (strcmp(res0->hr_remoteaddr, res1->hr_remoteaddr) != 0) 389 return (true); 390 if (res0->hr_replication != res1->hr_replication) 391 return (true); 392 if (res0->hr_checksum != res1->hr_checksum) 393 return (true); |
394 if (res0->hr_compression != res1->hr_compression) 395 return (true); |
|
392 if (res0->hr_timeout != res1->hr_timeout) 393 return (true); 394 if (strcmp(res0->hr_exec, res1->hr_exec) != 0) 395 return (true); 396 return (false); 397} 398 399static void --- 4 unchanged lines hidden (view full) --- 404 405 PJDLOG_ASSERT(res->hr_role == HAST_ROLE_PRIMARY); 406 407 nvout = nv_alloc(); 408 nv_add_uint8(nvout, HASTCTL_RELOAD, "cmd"); 409 nv_add_string(nvout, res->hr_remoteaddr, "remoteaddr"); 410 nv_add_int32(nvout, (int32_t)res->hr_replication, "replication"); 411 nv_add_int32(nvout, (int32_t)res->hr_checksum, "checksum"); | 396 if (res0->hr_timeout != res1->hr_timeout) 397 return (true); 398 if (strcmp(res0->hr_exec, res1->hr_exec) != 0) 399 return (true); 400 return (false); 401} 402 403static void --- 4 unchanged lines hidden (view full) --- 408 409 PJDLOG_ASSERT(res->hr_role == HAST_ROLE_PRIMARY); 410 411 nvout = nv_alloc(); 412 nv_add_uint8(nvout, HASTCTL_RELOAD, "cmd"); 413 nv_add_string(nvout, res->hr_remoteaddr, "remoteaddr"); 414 nv_add_int32(nvout, (int32_t)res->hr_replication, "replication"); 415 nv_add_int32(nvout, (int32_t)res->hr_checksum, "checksum"); |
416 nv_add_int32(nvout, (int32_t)res->hr_compression, "compression"); |
|
412 nv_add_int32(nvout, (int32_t)res->hr_timeout, "timeout"); 413 nv_add_string(nvout, res->hr_exec, "exec"); 414 if (nv_error(nvout) != 0) { 415 nv_free(nvout); 416 pjdlog_error("Unable to allocate header for reload message."); 417 return; 418 } 419 if (hast_proto_send(res, res->hr_ctrl, nvout, NULL, 0) < 0) { --- 143 unchanged lines hidden (view full) --- 563 control_set_role(nres, role); 564 } else if (resource_needs_reload(cres, nres)) { 565 pjdlog_info("Resource %s configuration was modified, reloading it.", 566 cres->hr_name); 567 strlcpy(cres->hr_remoteaddr, nres->hr_remoteaddr, 568 sizeof(cres->hr_remoteaddr)); 569 cres->hr_replication = nres->hr_replication; 570 cres->hr_checksum = nres->hr_checksum; | 417 nv_add_int32(nvout, (int32_t)res->hr_timeout, "timeout"); 418 nv_add_string(nvout, res->hr_exec, "exec"); 419 if (nv_error(nvout) != 0) { 420 nv_free(nvout); 421 pjdlog_error("Unable to allocate header for reload message."); 422 return; 423 } 424 if (hast_proto_send(res, res->hr_ctrl, nvout, NULL, 0) < 0) { --- 143 unchanged lines hidden (view full) --- 568 control_set_role(nres, role); 569 } else if (resource_needs_reload(cres, nres)) { 570 pjdlog_info("Resource %s configuration was modified, reloading it.", 571 cres->hr_name); 572 strlcpy(cres->hr_remoteaddr, nres->hr_remoteaddr, 573 sizeof(cres->hr_remoteaddr)); 574 cres->hr_replication = nres->hr_replication; 575 cres->hr_checksum = nres->hr_checksum; |
576 cres->hr_compression = nres->hr_compression; |
|
571 cres->hr_timeout = nres->hr_timeout; 572 strlcpy(cres->hr_exec, nres->hr_exec, 573 sizeof(cres->hr_exec)); 574 if (cres->hr_workerpid != 0) 575 resource_reload(cres); 576 } 577 } 578 --- 516 unchanged lines hidden --- | 577 cres->hr_timeout = nres->hr_timeout; 578 strlcpy(cres->hr_exec, nres->hr_exec, 579 sizeof(cres->hr_exec)); 580 if (cres->hr_workerpid != 0) 581 resource_reload(cres); 582 } 583 } 584 --- 516 unchanged lines hidden --- |