Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -151,10 +151,12 @@ public <E> E getState(Class<E> stateType) {
@Override
public boolean handleEvent(StateEvent event) throws InternalException, OverloadException {
ServerRoSessionState newState = null;
ServerRoSessionState state = sessionData.getServerRoSessionState();
try {
sendAndStateLock.lock();

// Get state after lock acquiring
ServerRoSessionState state = sessionData.getServerRoSessionState();

// Can be null if there is no state transition, transition to IDLE state should terminate this app session
Event localEvent = (Event) event;

Expand Down Expand Up @@ -224,6 +226,10 @@ public boolean handleEvent(StateEvent event) throws InternalException, OverloadE
case RECEIVED_TERMINATE:
Answer errorAnswer = ((Request) localEvent.getRequest().getMessage()).createAnswer(ResultCode.UNKNOWN_SESSION_ID);
session.send(errorAnswer);

// release this session
release();

logger.debug("Received an UPDATE or TERMINATE for a new session. Answering with 5002 (UNKNOWN_SESSION_ID) and terminating session.");
// and let it throw exception anyway ...
default:
Expand Down