Skip to content

Commit

Permalink
handle not set session identifiers in case of failed handshake
Browse files Browse the repository at this point in the history
  • Loading branch information
sjucker committed Oct 5, 2012
1 parent a1e9774 commit f7fb32a
Showing 1 changed file with 10 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -464,13 +464,17 @@ private DTLSSession getSessionByIdentifier(byte[] sessionID) {
if (sessionID == null) {
return null;
}

for (Entry<String, DTLSSession> entry : dtlsSessions.entrySet()) {
byte[] id = entry.getValue().getSessionIdentifier().getSessionId();
if (id == null) {
return null;
}
if (Arrays.equals(sessionID, id)) {
return entry.getValue();
// FIXME session identifiers may not be set, when the handshake failed after the initial message
// these sessions must be deleted when this happens
try {
byte[] id = entry.getValue().getSessionIdentifier().getSessionId();
if (Arrays.equals(sessionID, id)) {
return entry.getValue();
}
} catch (Exception e) {
continue;
}
}

Expand Down

0 comments on commit f7fb32a

Please sign in to comment.