Catch SLL and socket errors in imap_loop.