Просмотр исходного кода

fixes segfault when ctrl-c pressed with new totemmrp code

git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@789 fd59a12c-fef9-0310-b244-a6a79926bd2f
Steven Dake 20 лет назад
Родитель
Сommit
ece2c68fe1
2 измененных файлов с 14 добавлено и 3 удалено
  1. 2 2
      exec/main.c
  2. 12 1
      exec/totemsrp.c

+ 2 - 2
exec/main.c

@@ -753,7 +753,7 @@ error_disconnect:
 	return (res);
 }
 
-extern void print_stats (void);
+extern void print_stats (totemsrp_handle totemsrp_handle);
 
 void sigintr_handler (int signum)
 {
@@ -773,7 +773,7 @@ void sigintr_handler (int signum)
 #endif
 
 	totempg_finalize ();
-	print_stats ();
+	print_stats (totemsrp_handle_in);
 	ais_done (AIS_DONE_EXIT);
 }
 

+ 12 - 1
exec/totemsrp.c

@@ -3596,16 +3596,27 @@ static void memb_ring_id_store (
 	instance->token_ring_id_seq = instance->my_ring_id.seq;
 }
 
-void print_stats (struct totemsrp_instance *instance)
+void print_stats (totemsrp_handle handle)
 {
 	struct timeval tv_end;
+	struct totemsrp_instance *instance;
+	SaAisErrorT error;
+
 	gettimeofday (&tv_end, NULL);
 	
+	error = saHandleInstanceGet (&totemsrp_instance_database, handle,
+		(void *)&instance);
+	if (error != SA_OK) {
+		return;
+	}
+
 	instance->totemsrp_log_printf (instance->totemsrp_log_level_notice, "Bytes recv %d\n", instance->stats_recv);
 	instance->totemsrp_log_printf (instance->totemsrp_log_level_notice, "Bytes sent %d\n", instance->stats_sent);
 	instance->totemsrp_log_printf (instance->totemsrp_log_level_notice, "Messages delivered %d\n", instance->stats_delv);
 	instance->totemsrp_log_printf (instance->totemsrp_log_level_notice, "Re-Mcasts %d\n", instance->stats_remcasts);
 	instance->totemsrp_log_printf (instance->totemsrp_log_level_notice, "Tokens process %d\n", instance->stats_orf_token);
+
+	saHandleInstancePut (&totemsrp_instance_database, handle);
 }
 
 int totemsrp_callback_token_create (