[#270] Android - Fails to reconnect
Summary Android - Fails to reconnect
Queue gloox
Queue Version SVN
Type Bug
State Unconfirmed
Priority 3. High
Requester michael.ayles (at) melrosecomputing (dot) com
Created 07/04/2017 (2349 days ago)
Updated 07/06/2017 (2347 days ago)

07/06/2017 03:08:08 PM michael (dot) ayles (at) melrosecomputing (dot) com Comment #2 Reply to this comment

[Show Quoted Text - 27 lines]
So a couple of things were not quite right.  On cleanup in

I've added:

void OpenSSLBase::cleanup()
     if( !m_mutex.trylock() )

     if (m_ssl) {

     m_secure = false;
     m_valid = false;


Also wasn't setting stream management after disconnect, re-connect 
scenario which was causing another issue.
07/04/2017 04:40:24 PM michael (dot) ayles (at) melrosecomputing (dot) com Comment #1
State ⇒ Unconfirmed
Priority ⇒ 3. High
Type ⇒ Bug
Summary ⇒ Android - Fails to reconnect
Queue ⇒ gloox
Reply to this comment

I'm experiencing issues in a reconnect scenario on Android.  We're 
using OpenSSL and connecting to ejabberd.  If the device loses 
connection (changes from WIFI -> Cell) and tries to reconnect it fails.

In the server logs it results in the following:

:handle_info:194 TLS error = SSL_do_handshake failed: 
error:140760FC:SSL routines:SSL23_GET_CLIENT_HELLO:unknown protocol

Looking at the code for 1.0.20 it looks like we're still using the 
same SSL object even though we have disconnected and tried to connect. 
  In order to try and patch the issue I made a change to the 
disconnect logic to destroy the encryption object.  This had the 
desired effect in allowing us to connect once again with the server.   
However I now get a different error.

  GLOOX: AREA: 131072, <message from=test@test.com type='error' 
xmlns='urn:xmpp:receipts'/><error code='406' 

So I'm assuming there is something persistent across sessions.  Any 
help would be appreciated.