5.2.23
12/09/2023

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

History
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
tlsopensslbase.cpp

I've added:

void OpenSSLBase::cleanup()
   {
     if( !m_mutex.trylock() )
       return;


     if (m_ssl) {
       SSL_shutdown(m_ssl);
       SSL_clear(m_ssl);
     }

     m_secure = false;
     m_valid = false;

     m_mutex.unlock();
   }

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
Hi,

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' 
id='2678af4260c9ef376bb893d0c632293424ad01fe00000013'><request 
xmlns='urn:xmpp:receipts'/><error code='406' 
type='modify'><not-acceptable 
xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/></error><body>123</body></message>

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