Good lord, more bugs

This commit is contained in:
Tony Garnock-Jones 2017-01-23 13:58:10 -05:00
parent a8d69e9778
commit 999280176b
1 changed files with 2 additions and 2 deletions

View File

@ -30,14 +30,14 @@ public class chat {
public synchronized void connect(String user, Consumer<String> callback) {
for (Map.Entry<String, Consumer<String>> e : members.entrySet()) {
try { callback.accept(e.getKey() + " arrived"); }
catch (Exception ex) { disconnect(e.getKey()); }
callback.accept(e.getKey() + " arrived");
}
members.put(user, callback);
announce(user + " arrived");
}
public synchronized void disconnect(String user) {
if (!members.containsKey(user)) return;
members.remove(user);
announce(user + " left");
}