private void repairBrokenSessionWithPreKeyMessage ( OmemoManager . LoggedInOmemoManager managerGuard , OmemoDevice brokenDevice ) { LOGGER . log ( Level . WARNING , "Attempt to repair the session by sending a fresh preKey message to " + brokenDevice ) ; OmemoManager manager = managerGuard . get ( ) ; try { // Create fresh session and send new preKeyMessage. buildFreshSessionWithDevice ( manager . getConnection ( ) , manager . getOwnDevice ( ) , brokenDevice ) ; sendRatchetUpdate ( managerGuard , brokenDevice ) ; } catch ( CannotEstablishOmemoSessionException | CorruptedOmemoKeyException e ) { LOGGER . log ( Level . WARNING , "Unable to repair session with " + brokenDevice , e ) ; } catch ( SmackException . NotConnectedException | InterruptedException | SmackException . NoResponseException e ) { LOGGER . log ( Level . WARNING , "Could not fetch fresh bundle for " + brokenDevice , e ) ; } catch ( CryptoFailedException | NoSuchAlgorithmException e ) { LOGGER . log ( Level . WARNING , "Could not create PreKeyMessage" , e ) ; } }
Fetch and process a fresh bundle and send an empty preKeyMessage in order to establish a fresh session .