diff options
author | Ben Pfaff <blp@nicira.com> | 2010-01-07 13:58:49 -0800 |
---|---|---|
committer | Ben Pfaff <blp@nicira.com> | 2010-01-07 15:00:51 -0800 |
commit | 2b494771fdaa05eeea2c9789b36e455e46468d41 (patch) | |
tree | bf8ee2a49cf688eece785d780ae8f5c4493587d8 /lib/stream-ssl.c | |
parent | 5e4641a147c3e450a56b199b9066f1af75c2f779 (diff) |
stream-ssl: Fix ssl_recv() and ssl_send() return value semantics.
These functions' return value semantics did not match those documented
in stream-provider.h.
Diffstat (limited to 'lib/stream-ssl.c')
-rw-r--r-- | lib/stream-ssl.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/lib/stream-ssl.c b/lib/stream-ssl.c index 436dc7b2..6839341c 100644 --- a/lib/stream-ssl.c +++ b/lib/stream-ssl.c @@ -549,7 +549,8 @@ ssl_recv(struct stream *stream, void *buffer, size_t n) if (error == SSL_ERROR_ZERO_RETURN) { return 0; } else { - return interpret_ssl_error("SSL_read", ret, error, &sslv->rx_want); + return -interpret_ssl_error("SSL_read", ret, error, + &sslv->rx_want); } } } @@ -597,7 +598,7 @@ ssl_send(struct stream *stream, const void *buffer, size_t n) struct ssl_stream *sslv = ssl_stream_cast(stream); if (sslv->txbuf) { - return EAGAIN; + return -EAGAIN; } else { int error; @@ -606,13 +607,13 @@ ssl_send(struct stream *stream, const void *buffer, size_t n) switch (error) { case 0: ssl_clear_txbuf(sslv); - return 0; + return n; case EAGAIN: leak_checker_claim(buffer); - return 0; + return n; default: sslv->txbuf = NULL; - return error; + return -error; } } } |