From 04bfaf1c70e4ad201e96772d8960529d2705d0ce Mon Sep 17 00:00:00 2001 From: nathan Date: Wed, 2 Mar 2016 01:27:48 +0100 Subject: [PATCH] fixed issue where registration could beat the check. It is more robust now --- src/dorkbox/network/Client.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/dorkbox/network/Client.java b/src/dorkbox/network/Client.java index 85ae378a..87f5a6ca 100644 --- a/src/dorkbox/network/Client.java +++ b/src/dorkbox/network/Client.java @@ -315,10 +315,12 @@ class Client extends EndPointClient implements Connecti // have to BLOCK // don't want the client to run before registration is complete synchronized (this.registrationLock) { - try { - this.registrationLock.wait(connectionTimeout); - } catch (InterruptedException e) { - throw new IOException("Unable to complete registration within '" + connectionTimeout + "' milliseconds", e); + if (!registrationComplete) { + try { + this.registrationLock.wait(connectionTimeout); + } catch (InterruptedException e) { + throw new IOException("Unable to complete registration within '" + connectionTimeout + "' milliseconds", e); + } } }