diff options
author | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2016-04-28 17:29:11 +0300 |
---|---|---|
committer | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2016-04-28 17:29:11 +0300 |
commit | ba61480df52e3d79349492a589a5bd999cd8ccbd (patch) | |
tree | 39366158f4837216434609e1efdae12c76cb5953 /extmod/modussl.c | |
parent | 2534bfdb928105202e672d249e7d420771b8366a (diff) | |
download | micropython-ba61480df52e3d79349492a589a5bd999cd8ccbd.tar.gz micropython-ba61480df52e3d79349492a589a5bd999cd8ccbd.zip |
extmod/modussl: SSL_OK from ssl_read() means "no user data so far".
SSL_OK is numeric 0, and it's *not* an EOF. So, should keep reading.
Diffstat (limited to 'extmod/modussl.c')
-rw-r--r-- | extmod/modussl.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/extmod/modussl.c b/extmod/modussl.c index b697bbdd66..51f4fead81 100644 --- a/extmod/modussl.c +++ b/extmod/modussl.c @@ -87,6 +87,11 @@ STATIC mp_uint_t socket_read(mp_obj_t o_in, void *buf, mp_uint_t size, int *errc while (o->bytes_left == 0) { mp_int_t r = ssl_read(o->ssl_sock, &o->buf); + if (r == SSL_OK) { + // SSL_OK from ssl_read() means "everything is ok, but there's + // not user data yet. So, we just keep reading. + continue; + } if (r < 0) { if (r == SSL_CLOSE_NOTIFY || r == SSL_ERROR_CONN_LOST) { // EOF |