Fix Orchid deadlock 3

https://github.com/subgraph/Orchid/pull/10
This commit is contained in:
Devrandom 2014-08-23 14:19:27 -07:00 committed by Mike Hearn
parent 2bc8f952e2
commit 50ad0e7666

View File

@ -289,29 +289,33 @@ public class ConnectionImpl implements Connection, DashboardRenderable {
}
private void processRelayCell(Cell cell) {
Circuit circuit;
circuitsLock.lock();
try {
final Circuit circuit = circuitMap.get(cell.getCircuitId());
circuit = circuitMap.get(cell.getCircuitId());
if(circuit == null) {
logger.warning("Could not deliver relay cell for circuit id = "+ cell.getCircuitId() +" on connection "+ this +". Circuit not found");
return;
}
circuit.deliverRelayCell(cell);
} finally {
circuitsLock.unlock();
}
circuit.deliverRelayCell(cell);
}
private void processControlCell(Cell cell) {
Circuit circuit;
circuitsLock.lock();
try {
final Circuit circuit = circuitMap.get(cell.getCircuitId());
if(circuit != null) {
circuit.deliverControlCell(cell);
}
circuit = circuitMap.get(cell.getCircuitId());
} finally {
circuitsLock.unlock();
}
if(circuit != null) {
circuit.deliverControlCell(cell);
}
}
void idleCloseCheck() {