- Changed behaviour of net_recv(), ssl_fetch_input() and ssl_read(). net_recv() now returns 0 on EOF instead of POLARSSL_ERR_NET_CONN_RESET. ssl_fetch_input() returns POLARSSL_ERR_SSL_CONN_EOF on an EOF from its f_recv() function. ssl_read() returns 0 if a POLARSSL_ERR_SSL_CONN_EOF is received after the handshake.

- Network functions now return POLARSSL_ERR_NET_WANT_READ or POLARSSL_ERR_NET_WANT_WRITE instead of the ambiguous POLARSSL_ERR_NET_TRY_AGAIN
This commit is contained in:
Paul Bakker 2011-05-18 13:32:51 +00:00
parent e471cd14bd
commit 831a755d9e
12 changed files with 59 additions and 35 deletions
include/polarssl

View file

@ -38,7 +38,8 @@
#define POLARSSL_ERR_NET_RECV_FAILED -0x004C /**< Reading information from the socket failed. */
#define POLARSSL_ERR_NET_SEND_FAILED -0x004E /**< Sending information through the socket failed. */
#define POLARSSL_ERR_NET_CONN_RESET -0x0050 /**< Connection was reset by peer. */
#define POLARSSL_ERR_NET_TRY_AGAIN -0x0052 /**< Connection was busy, try again. */
#define POLARSSL_ERR_NET_WANT_READ -0x0052 /**< Connection requires a read call. */
#define POLARSSL_ERR_NET_WANT_WRITE -0x0054 /**< Connection requires a write call. */
#ifdef __cplusplus
extern "C" {
@ -123,7 +124,7 @@ void net_usleep( unsigned long usec );
* \param len Maximum length of the buffer
*
* \return This function returns the number of bytes received,
* or a non-zero error code; POLARSSL_ERR_NET_TRY_AGAIN
* or a non-zero error code; POLARSSL_ERR_NET_WANT_READ
* indicates read() is blocking.
*/
int net_recv( void *ctx, unsigned char *buf, size_t len );
@ -137,7 +138,7 @@ int net_recv( void *ctx, unsigned char *buf, size_t len );
* \param len The length of the buffer
*
* \return This function returns the number of bytes sent,
* or a non-zero error code; POLARSSL_ERR_NET_TRY_AGAIN
* or a non-zero error code; POLARSSL_ERR_NET_WANT_WRITE
* indicates write() is blocking.
*/
int net_send( void *ctx, unsigned char *buf, size_t len );