Commit ad6fb662 authored by daryl herzmann's avatar daryl herzmann

Merge pull request #229 from dwd/moar-deadlock

Do not synchronize on isClosed()
parents 47d44217 389c17c7
...@@ -116,7 +116,7 @@ public class NIOConnection implements Connection { ...@@ -116,7 +116,7 @@ public class NIOConnection implements Connection {
* keep this flag to avoid using the connection between #close was used and the socket is actually * keep this flag to avoid using the connection between #close was used and the socket is actually
* closed. * closed.
*/ */
private State state; private volatile State state;
/** /**
* Lock used to ensure the integrity of the underlying IoSession (refer to * Lock used to ensure the integrity of the underlying IoSession (refer to
...@@ -288,7 +288,7 @@ public class NIOConnection implements Connection { ...@@ -288,7 +288,7 @@ public class NIOConnection implements Connection {
session = owner; session = owner;
} }
public synchronized boolean isClosed() { public boolean isClosed() {
return state == State.CLOSED; return state == State.CLOSED;
} }
...@@ -297,7 +297,7 @@ public class NIOConnection implements Connection { ...@@ -297,7 +297,7 @@ public class NIOConnection implements Connection {
} }
public void deliver(Packet packet) throws UnauthorizedException { public void deliver(Packet packet) throws UnauthorizedException {
if (isClosed()) { if (state != State.RUNNING) {
// OF-857: Do not allow the backup deliverer to recurse // OF-857: Do not allow the backup deliverer to recurse
if (backupDeliverer == null) { if (backupDeliverer == null) {
Log.error("Failed to deliver packet: " + packet.toXML()); Log.error("Failed to deliver packet: " + packet.toXML());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment