2 * See the file LICENSE for redistribution information.
4 * Copyright (c) 2006, 2012 Oracle and/or its affiliates. All rights reserved.
14 // Chainable struct used to store host information.
15 typedef struct RepHostInfoObj{
18 RepHostInfoObj* next; // used for chaining multiple "other" hosts.
25 virtual ~RepConfigInfo();
27 void addOtherHost(char* host, int port);
29 u_int32_t start_policy;
31 bool got_listen_address;
32 REP_HOST_INFO this_host;
35 // used to store a set of optional other hosts.
36 REP_HOST_INFO *other_hosts;
40 RepConfigInfo::RepConfigInfo()
42 start_policy = DB_REP_ELECTION;
44 got_listen_address = false;
50 RepConfigInfo::~RepConfigInfo()
52 // release any other_hosts structs.
53 if (other_hosts != NULL) {
54 REP_HOST_INFO *CurItem = other_hosts;
55 while (CurItem->next != NULL) {
56 REP_HOST_INFO *TmpItem = CurItem->next;
65 void RepConfigInfo::addOtherHost(char* host, int port)
67 REP_HOST_INFO *newinfo;
68 newinfo = (REP_HOST_INFO*)malloc(sizeof(REP_HOST_INFO));
71 if (other_hosts == NULL) {
72 other_hosts = newinfo;
75 newinfo->next = other_hosts;
76 other_hosts = newinfo;