From: David ‘Bombe’ Roden Date: Wed, 3 Nov 2010 04:59:44 +0000 (+0100) Subject: Fix timeout. X-Git-Tag: 0.2-RC1~57 X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=feaefb2cecf0ca30b7d94e126ca0384435546c08;p=Sone.git Fix timeout. --- diff --git a/src/main/java/net/pterodactylus/sone/freenet/wot/WebOfTrustConnector.java b/src/main/java/net/pterodactylus/sone/freenet/wot/WebOfTrustConnector.java index 0a6369f..7127e8f 100644 --- a/src/main/java/net/pterodactylus/sone/freenet/wot/WebOfTrustConnector.java +++ b/src/main/java/net/pterodactylus/sone/freenet/wot/WebOfTrustConnector.java @@ -315,8 +315,13 @@ public class WebOfTrustConnector implements ConnectorListener { synchronized (reply) { pluginConnector.sendRequest(WOT_PLUGIN_NAME, PLUGIN_CONNECTION_IDENTIFIER, fields, data); try { - reply.wait(60000); - throw new PluginException("Timeout waiting for " + targetMessages[0] + "!"); + long now = System.currentTimeMillis(); + while ((reply.getFields() == null) && ((System.currentTimeMillis() - now) < 60000)) { + reply.wait(60000 - (System.currentTimeMillis() - now)); + } + if (reply.getFields() == null) { + throw new PluginException("Timeout waiting for " + targetMessages[0] + "!"); + } } catch (InterruptedException ie1) { logger.log(Level.WARNING, "Got interrupted while waiting for reply on " + targetMessages[0] + ".", ie1); }