coap_openssl.c: client assert error if DTLS error closed socket
coap_openssl.c: client assert error if DTLS error closed socket

For a client, if a DTLS session is closed with ICMP unavailable packet, when
the TLS session is closed in the application with SSL_shutdown(), the OpenSSL
underlying library triggers a BIO_write() which calls coap_dgram_write() which
then 'assert's in coap_session_send().
(sock->flags == COAP_SOCKET_EMPTY && session->endpoint == NULL).

Fix is not to call coap_session_send() from coap_dgram_write() if socket is
closed and this is not an endpoint (not a server).

authmillenon/libcoap,authmillenon/libcoap,authmillenon/libcoap