All,
I ran across a boundary condition in bellesip/polarssl.
If you select TLS but then connect to a server that does not support it, the socket receives a reset and is closed before bellesip attempts another write. This generates a SIGPIPE signal which brings things to a halt under XCode. (It may be ignored in a release build, I haven't confirmed). There are two solutions:
1. Put in a global handler or global ignore - signal(SIGPIPE, SIG_IGN);
2. Set the options on the socket to ignore SIGPIPE on write.
I choose #2. Attached is a patch for stream_channel.c in stream_channel_connect().
Regards,
Matt.