Always call the callback outside the plugin's lock.

This commit is contained in:
akwizgran
2011-10-08 13:13:28 +01:00
parent 50e5c51d77
commit 125ae1b640
5 changed files with 38 additions and 64 deletions

View File

@@ -69,14 +69,17 @@ class SimpleSocketPlugin extends SocketPlugin {
@Override
protected void setLocalSocketAddress(SocketAddress s) {
assert started;
Map<String, String> m;
synchronized(this) {
if(!started) return;
m = new TreeMap<String, String>(localProperties);
}
if(!(s instanceof InetSocketAddress))
throw new IllegalArgumentException();
InetSocketAddress i = (InetSocketAddress) s;
String host = i.getAddress().getHostAddress();
String port = String.valueOf(i.getPort());
// FIXME: Special handling for private IP addresses?
Map<String, String> m = new TreeMap<String, String>(localProperties);
m.put("host", host);
m.put("port", port);
callback.setLocalProperties(m);