@@ -547,7 +547,7 @@ static void ondeadlock(client_t client, int argc, xid_t *argv) {
547547 xid_t root = argv [1 ];
548548 Instance * instance = & CLIENT_USERDATA (client )-> instance ;
549549 addSubgraph (instance , & graph , argv + 2 , argc - 2 );
550- bool hasDeadLock = findCycle (& graph , root );
550+ bool hasDeadLock = detectDeadLock (& graph , root );
551551 client_message_shortcut (client , hasDeadLock ? RES_DEADLOCK : RES_OK );
552552}
553553
@@ -595,7 +595,7 @@ static void onmessage(client_t client, size_t len, char *data) {
595595
596596static void usage (char * prog ) {
597597 printf (
598- "Usage: %s [-d DATADIR] [-k] [-a HOST] [-p PORT] [-l LOGFILE]\n"
598+ "Usage: %s [-d DATADIR] [-k] [-a HOST] [-p PORT] [-l LOGFILE] [-m MIN_DEADLOCK_DURATION] \n"
599599 " arbiter will try to kill the other one running at\n"
600600 " the same DATADIR.\n"
601601 " -l : Run as a daemon and write output to LOGFILE.\n"
@@ -688,8 +688,10 @@ int main(int argc, char **argv) {
688688 bool assassin = false;
689689 int listenport = DEFAULT_LISTENPORT ;
690690
691+ initGraph (& graph );
692+
691693 int opt ;
692- while ((opt = getopt (argc , argv , "hd:a:p:l:k" )) != -1 ) {
694+ while ((opt = getopt (argc , argv , "hd:a:p:l:k:m: " )) != -1 ) {
693695 switch (opt ) {
694696 case 'd' :
695697 datadir = optarg ;
@@ -710,6 +712,9 @@ int main(int argc, char **argv) {
710712 case 'k' :
711713 assassin = true;
712714 break ;
715+ case 'm' :
716+ graph .min_deadlock_duration = atoi (optarg );
717+ break ;
713718 default :
714719 usage (argv [0 ]);
715720 return EXIT_FAILURE ;
0 commit comments