Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUG #1

Open
puyangsky opened this issue Dec 21, 2017 · 2 comments
Open

BUG #1

puyangsky opened this issue Dec 21, 2017 · 2 comments

Comments

@puyangsky
Copy link

String c = sc.next().trim();
				if(c.equals("c")){
					//TODO: request access here!
					System.out.println("starting two phase commit.");
					coordinator.startCommit();
				}else if(c.equals("e")){
					System.out.println("exiting..");
					sc.close();
					lt.finish();
					return;
				}else if(c.equals("c")){
					System.out.println("Active clients:");
					for (Map.Entry<Socket, Participant> entry : connections.entrySet()) {
						System.out.println(entry.getValue());
					}
				}else{
					System.out.println("unrecognized command.");
				}

Here are two same if statements "c.equals("c")", which I think is a bug.

@lham
Copy link

lham commented Jun 13, 2019

Yeah, this looks wrong.

@yuno-gen
Copy link

while(true){
String c = sc.next().trim();
if(c.equals("c")){
//TODO: request access here!
System.out.println("starting two phase commit.");
coordinator.startCommit();
}else if(c.equals("e")){
System.out.println("exiting..");
sc.close();
lt.finish();
return;
}else if(c.equals("p")){
System.out.println("Active clients:");
for (Map.Entry<Socket, Participant> entry : connections.entrySet()) {
System.out.println(entry.getValue());
}
}else{
System.out.println("unrecognized command.");
}
}

you can always change one of the "c"s just like I did for checking the participants I made it to "p".
This should work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants