@@ -128,7 +128,7 @@ static int ticket_dangerous(struct booth_config *conf_ptr,
128128 if (!is_time_set (& tk -> delay_commit ))
129129 return 0 ;
130130
131- if (is_past (& tk -> delay_commit ) || all_sites_replied (tk )) {
131+ if (is_past (& tk -> delay_commit ) || all_sites_replied (conf_ptr , tk )) {
132132 if (tk -> leader == local ) {
133133 tk_log_info ("%s, committing to CIB" ,
134134 is_past (& tk -> delay_commit ) ?
@@ -702,7 +702,8 @@ int ticket_answer_list(struct booth_config *conf_ptr, int fd)
702702 if (rv < 0 )
703703 goto out ;
704704
705- init_header (& hdr .header , CL_LIST , 0 , 0 , RLT_SUCCESS , 0 , sizeof (hdr ) + olen );
705+ init_header (conf_ptr , & hdr .header , CL_LIST , 0 , 0 , RLT_SUCCESS , 0 ,
706+ sizeof (hdr ) + olen );
706707 rv = send_header_plus (conf_ptr , fd , & hdr , data , olen );
707708
708709out :
@@ -769,7 +770,7 @@ int process_client_request(struct booth_config *conf_ptr,
769770 }
770771
771772reply_now :
772- init_ticket_msg (& omsg , CL_RESULT , 0 , rv , 0 , tk );
773+ init_ticket_msg (conf_ptr , & omsg , CL_RESULT , 0 , rv , 0 , tk );
773774 send_client_msg (conf_ptr , req_client -> fd , & omsg );
774775 return rc ;
775776}
@@ -794,7 +795,7 @@ int notify_client(struct booth_config *conf_ptr, struct ticket_config *tk,
794795 }
795796 tk_log_debug ("notifying client %d (request %s)" ,
796797 client_fd , state_to_string (cmd ));
797- init_ticket_msg (& omsg , CL_RESULT , 0 , rv , 0 , tk );
798+ init_ticket_msg (conf_ptr , & omsg , CL_RESULT , 0 , rv , 0 , tk );
798799 rc = send_client_msg (conf_ptr , client_fd , & omsg );
799800
800801 if (rc == 0 && ((rv == RLT_MORE ) ||
@@ -827,7 +828,7 @@ int ticket_broadcast(struct booth_config *conf_ptr,
827828{
828829 struct boothc_ticket_msg msg ;
829830
830- init_ticket_msg (& msg , cmd , 0 , res , reason , tk );
831+ init_ticket_msg (conf_ptr , & msg , cmd , 0 , res , reason , tk );
831832 tk_log_debug ("broadcasting '%s' (term=%d, valid=%d)" ,
832833 state_to_string (cmd ),
833834 ntohl (msg .ticket .term ),
@@ -963,7 +964,7 @@ static void handle_resends(struct booth_config *conf_ptr,
963964 goto just_resend ;
964965 }
965966
966- if (!majority_of_bits (tk , tk -> acks_received )) {
967+ if (!majority_of_bits (conf_ptr , tk , tk -> acks_received )) {
967968 ack_cnt = count_bits (tk -> acks_received ) - 1 ;
968969 if (!ack_cnt ) {
969970 tk_log_warn ("no answers to our request (try #%d), "
@@ -1130,7 +1131,7 @@ static void next_action(struct booth_config *conf_ptr,
11301131 /* timeout or ticket renewal? */
11311132 if (tk -> acks_expected ) {
11321133 handle_resends (conf_ptr , tk );
1133- if (majority_of_bits (tk , tk -> acks_received )) {
1134+ if (majority_of_bits (conf_ptr , tk , tk -> acks_received )) {
11341135 leader_update_ticket (conf_ptr , tk );
11351136 }
11361137 } else {
@@ -1240,12 +1241,10 @@ void tickets_log_info(struct booth_config *conf_ptr)
12401241 }
12411242}
12421243
1243- static void update_acks (
1244- struct ticket_config * tk ,
1245- struct booth_site * sender ,
1246- struct booth_site * leader ,
1247- struct boothc_ticket_msg * msg
1248- )
1244+
1245+ static void update_acks (struct booth_config * conf_ptr , struct ticket_config * tk ,
1246+ struct booth_site * sender , struct booth_site * leader ,
1247+ struct boothc_ticket_msg * msg )
12491248{
12501249 uint32_t cmd ;
12511250 uint32_t req ;
@@ -1260,7 +1259,7 @@ static void update_acks(
12601259 /* got an ack! */
12611260 tk -> acks_received |= sender -> bitmask ;
12621261
1263- if (all_replied (tk ) ||
1262+ if (all_replied (conf_ptr , tk ) ||
12641263 /* we just stepped down, need only one site to start
12651264 * elections */
12661265 (cmd == OP_REQ_VOTE && tk -> last_request == OP_VOTE_FOR )) {
@@ -1296,7 +1295,7 @@ int ticket_recv(struct booth_config *conf_ptr, void *buf,
12961295 return - EINVAL ;
12971296 }
12981297
1299- update_acks (tk , source , leader , msg );
1298+ update_acks (conf_ptr , tk , source , leader , msg );
13001299
13011300 return raft_answer (conf_ptr , tk , source , leader , msg );
13021301}
@@ -1440,6 +1439,7 @@ char *state_to_string(uint32_t state_ho)
14401439 return cur -> c ;
14411440}
14421441
1442+
14431443int send_reject (struct booth_config * conf_ptr , struct booth_site * dest ,
14441444 struct ticket_config * tk , cmd_result_t code ,
14451445 struct boothc_ticket_msg * in_msg )
@@ -1449,7 +1449,7 @@ int send_reject(struct booth_config *conf_ptr, struct booth_site *dest,
14491449
14501450 tk_log_debug ("sending reject to %s" ,
14511451 site_string (dest ));
1452- init_ticket_msg (& msg , OP_REJECTED , req , code , 0 , tk );
1452+ init_ticket_msg (conf_ptr , & msg , OP_REJECTED , req , code , 0 , tk );
14531453 return booth_udp_send_auth (conf_ptr , dest , & msg , sendmsglen (& msg ));
14541454}
14551455
@@ -1475,6 +1475,6 @@ int send_msg(struct booth_config *conf_ptr, int cmd, struct ticket_config *tk,
14751475 if (in_msg )
14761476 req = ntohl (in_msg -> header .cmd );
14771477
1478- init_ticket_msg (& msg , cmd , req , RLT_SUCCESS , 0 , valid_tk );
1478+ init_ticket_msg (conf_ptr , & msg , cmd , req , RLT_SUCCESS , 0 , valid_tk );
14791479 return booth_udp_send_auth (conf_ptr , dest , & msg , sendmsglen (& msg ));
14801480}
0 commit comments