diff options
| author | Paul Sokolovsky | 2016-07-30 00:25:06 +0300 |
|---|---|---|
| committer | Paul Sokolovsky | 2016-07-30 00:25:06 +0300 |
| commit | 4f1b0292dbc5920457673a31cadfd894239cc1b9 (patch) | |
| tree | 9473bc94102eadf7ad917971dd8250947c9256a3 /extmod | |
| parent | abd5a57ea1e9f756690f6bad9ddc915cf30de42e (diff) | |
py/stream: Add adapter methods with POSIX-compatible signatures.
Previoussly such read() and write() methods were used by modussl_axtls,
move to py/stream for reuse.
Diffstat (limited to 'extmod')
| -rw-r--r-- | extmod/modussl_axtls.c | 30 |
1 files changed, 0 insertions, 30 deletions
diff --git a/extmod/modussl_axtls.c b/extmod/modussl_axtls.c index 2ef122fa6..ce86263c2 100644 --- a/extmod/modussl_axtls.c +++ b/extmod/modussl_axtls.c @@ -200,34 +200,4 @@ const mp_obj_module_t mp_module_ussl = { .globals = (mp_obj_dict_t*)&mp_module_ssl_globals, }; - -// These functions might be split to stream_posix.c. They are referenced by -// axtls os_port.h . -ssize_t mp_stream_posix_write(void *sock_obj, const void *buf, size_t len); -ssize_t mp_stream_posix_read(void *sock_obj, void *buf, size_t len); - -int mp_stream_errno; - -ssize_t mp_stream_posix_write(void *sock_obj, const void *buf, size_t len) { - struct _mp_obj_base_t *o = (struct _mp_obj_base_t *)sock_obj; - const mp_stream_p_t *stream_p = o->type->protocol; - mp_uint_t out_sz = stream_p->write(o, buf, len, &mp_stream_errno); - if (out_sz == MP_STREAM_ERROR) { - return -1; - } else { - return out_sz; - } -} - -ssize_t mp_stream_posix_read(void *sock_obj, void *buf, size_t len) { - struct _mp_obj_base_t *o = (struct _mp_obj_base_t *)sock_obj; - const mp_stream_p_t *stream_p = o->type->protocol; - mp_uint_t out_sz = stream_p->read(o, buf, len, &mp_stream_errno); - if (out_sz == MP_STREAM_ERROR) { - return -1; - } else { - return out_sz; - } -} - #endif // MICROPY_PY_USSL |
