cleanup: cleanup of the ssl code.

Cleaned up the ssl code in the hope to find the reason of the sudden
disconnections. No luck yet.