Skip to content

Commit

Permalink
Fix Orchid deadlock 3
Browse files Browse the repository at this point in the history
  • Loading branch information
devrandom committed Aug 23, 2014
1 parent 5bd4a71 commit a65662e
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions orchid/src/com/subgraph/orchid/connections/ConnectionImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -289,29 +289,33 @@ private void processCell(Cell cell) {
}

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() {
Expand Down

0 comments on commit a65662e

Please sign in to comment.