One more information. Do you use TLS? That is, does iks_is_secure (analizador) return something different than 0 (zero)?
There is no current timeout in the code when using TLS. If that is the case, I have a fix in mind already that will solve the issue.
signature.asc
Description: Digital signature