KEY-56 - Checkout do_ssl_handshake error and close if fatal

Previously, the first call to do_ssl_handshake was assume to 'work'
(i.e. return WANT_READ or WANT_WRITE) and the error code
was not checked. Added checking of the error code and if it is not
retriable then drop the connection and log the error.
Handle SSL_shutdown returning WANT_READ / WANT_WRITE

Previously, connection_terminate handled SSL_shutdown return codes
poorly and assumed that SSL_shutdown would work (it retried it
once). This could lead to a situation where SSL_shutdown returned
WANT_READ or WANT_WRITE which would be ignored and then the TCP
connection terminated.

Now each connection has a TERMINATING state added and it will
continue to process reads and call SSL_shutdown repeatedly on read
events until the connection has been terminated. Only then will
memory be cleaned up and the TCP connection killed.
Merge pull request #93 from jgrahamc/master

KEY-56 - Checkout do_ssl_handshake error and close if fatal