Paul Sokolovsky
2534bfdb92
extmod/modussl: Support server-side SSL sockets.
wrap_socket(sock, server_side=True)
9 years ago
Paul Sokolovsky
d54290f6e2
extmod/modussl: Throw Python exceptions in case of errors.
9 years ago
Paul Sokolovsky
480c212009
extmod/modwebsocket: Handle CLOSE control frame.
This fixes situation when clients hangs waiting for disconnect and does
so only on timeout.
9 years ago
Paul Sokolovsky
1c6d91d968
extmod/modlwip: Add print_pcbs() debug function.
This requires lwIP built with LWIP_DEBUG (or it will be no-op).
9 years ago
Damien George
45ac5a85d5
extmod/modlwip: Workaround esp8266 sendto issue where 1 is returned.
9 years ago
Damien George
a63542387d
extmod, stmhal: Fix typo of macro that detects if float is enabled.
9 years ago
Paul Sokolovsky
7a012f4793
extmod/modlwip: Protect recv/accept Python callback against exceptions.
Using usual call_function_*_protected() helper, to avoid NLR jump crashes.
9 years ago
Damien George
624738ca64
extmod/machine_i2c: Allow mp_hal_pin_obj_t to be any type, not a ptr.
9 years ago
Paul Sokolovsky
7d57037906
extmod/modlwip: Add ability to run callback on "recv" and "accept" events.
To use: .setsockopt(SOL_SOCKET, 20, lambda sock: print(sock)). There's a
single underlying callback slot. For normal sockets, it serves as data
received callback, for listening sockets - connection arrived callback.
9 years ago
Paul Sokolovsky
8007f84cca
extmod/modlwip: lwip_tcp_receive(): Full error handling.
9 years ago
Paul Sokolovsky
b830f4c610
extmod/modlwip: lwip_tcp_send(): Full error handling.
9 years ago
Damien George
bcd719ea3a
extmod/fsusermount: In mount/mkfs, deregister VFS object on error.
Should fix issue #1947 .
9 years ago
Paul Sokolovsky
5c1af60e19
extmod/modlwip: More debug messages for various edge conditions.
9 years ago
Paul Sokolovsky
44ab5c3ef1
extmod/modlwip: Start adding debug output.
9 years ago
Paul Sokolovsky
fef0d9818a
extmod/modlwip: lwip_tcp_receive(): Properly handle EOF for non-blocking sock.
9 years ago
Paul Sokolovsky
59a4fee516
extmod/modwebsocket: Another case to propagate EOF.
9 years ago
Paul Sokolovsky
54ea253f56
extmod/moduos_dupterm: Don't swallow exceptions in dupterm's read()/write().
The idea is that if dupterm object can handle exceptions, it will handle
them itself. Otherwise, object state can be compromised and it's better
to terminate dupterm session. For example, disconnected socket will keep
throwing exceptions and dump messages about that.
9 years ago
Damien George
eec8a94f04
extmod/machine_i2c: Implement I2C memory reading/writing.
9 years ago
Damien George
9314b2df4f
extmod/machine_i2c: Fix I2C reading by sending ack/nack at end of byte.
9 years ago
Damien George
d083712224
extmod: Add generic machine.I2C class, with bit-bang I2C.
Should work on any machine that provides the correct pin functions.
9 years ago
Damien George
53ad681ed1
extmod: Add initial framebuf module.
9 years ago
Paul Sokolovsky
f8fb4470a0
extmod/modwebsocket: write(): Support write size beyond 125 bytes.
9 years ago
Paul Sokolovsky
7063210014
extmod/modlwip: Fix for loss of data in unaccepted incoming sockets.
When lwIP creates a incoming connection socket of a listen socket, it
sets its recv callback to one which discards incoming data. We set
proper callback only in accept() call, when we allocate Python-level
socket where we can queue incoming data. So, in lwIP accept callback
be sure to set recv callback to one which tells lwIP to not discard
incoming data.
9 years ago
Paul Sokolovsky
b69f798c92
extmod/modwebsocket.h: Split websocket-related defines for reuse.
9 years ago
Paul Sokolovsky
d6236e85c2
extmod/modwebsocket: Implement MP_STREAM_SET_DATA_OPTS ioctl.
Allows to set fragment type (txt/bin/etc.) for output records.
9 years ago
Paul Sokolovsky
6837dba6b8
extmod/modwebsocket: Allow to get type of last read data using ioctl().
9 years ago
Paul Sokolovsky
f38e8f5217
extmod/modwebsocket: Record current fragment type (binary/text/etc.)
Also, handle continuation frames (untested).
9 years ago
Paul Sokolovsky
5b1c221785
extmod/modwebsocket: Add option for blocking writes to non-blk sockets.
This is strange asymmetry which is sometimes needed, e.g. for WebREPL: we
want to process only available input and no more; but for output, we want
to get rid of all of it, because there's no other place to buffer/store
it. This asymmetry is akin to CPython's asyncio asymmetry, where reads are
asynchronous, but writes are synchronous (asyncio doesn't expect them to
block, instead expects there to be (unlimited) buffering for any sync write
to completely immediately).
9 years ago
Paul Sokolovsky
397b705647
extmod/modwebsocket: Reset mask between packets.
9 years ago
Paul Sokolovsky
7e9182f3aa
extmod/modwebsocket: Make sure to propagate EOF.
9 years ago
Tom Sparks
20d9bc2d76
extmod/modure: re_exec() renamed to ure_exec() due to collison in 4.3BSD.
Addresses issue #1972 .
9 years ago
Paul Sokolovsky
05ba2433f6
extmod/modwebsocket: Properly check number of args to constructor.
9 years ago
Paul Sokolovsky
651a188299
extmod/vfs_fat_diskio: Actually support sectors != 512 with Python blockdevs.
9 years ago
Paul Sokolovsky
91031a75a1
extmod/modlwip: lwip_socket_setsockopt: Handle option value properly.
9 years ago
Paul Sokolovsky
4332d72fd8
extmod/modlwip: Add lwip->POSIX error map for lwIP 1.4.0.
Between 1.4.0 and 1.4.1, lwIP errors were renumbered.
9 years ago
Paul Sokolovsky
de0c84ebf1
extmod/modlwip: lwip_tcp_send: Handle properly send buffer full condition.
Per POSIX http://pubs.opengroup.org/onlinepubs/9699919799/functions/send.html :
"If space is not available at the sending socket to hold the message to be
transmitted, and the socket file descriptor does not have O_NONBLOCK set,
send() shall block until space is available. If space is not available at the
sending socket to hold the message to be transmitted, and the socket file
descriptor does have O_NONBLOCK set, send() shall fail [with EAGAIN]."
9 years ago
Paul Sokolovsky
5e75f335e6
extmod/modlwip: Implement setsocketopt(SO_REUSEADDR).
9 years ago
Paul Sokolovsky
8f1854ad2d
extmod/modlwip: Add SOL_SOCKET and SO_REUSEADDR constants for setsockopt().
9 years ago
Paul Sokolovsky
3dbd2ee926
extmod/modwebsocket: Implement read support.
9 years ago
Paul Sokolovsky
24342dd65e
extmod/modwebsocket: Start module for WebSocket helper functions.
Currently, only write support is implemented (of limited buffer size).
9 years ago
Damien George
b894551772
extmod/uctypes: Change param type from void* to byte*.
9 years ago
Damien George
da161fd9f0
extmod/uctypes: Finish support for FLOAT32 and FLOAT64 types.
9 years ago
Damien George
12154b1774
extmod/uctypes: Use mp_binary_get_val helper when extracting value.
It handles more cases than mp_binary_get_int.
9 years ago
Damien George
0be6359f39
py: When printf'ing an object as a pointer, pass the concrete pointer.
9 years ago
Paul Sokolovsky
0779409d0d
extmod/modlwip: lwip_tcp_receive: Properly map lwIP error to POSIX errno.
9 years ago
Paul Sokolovsky
ba8f7d5171
extmod/modlwip: Add socket.setblocking() method.
9 years ago
Paul Sokolovsky
09ed5bcbbb
extmod/modlwip: Rework getaddrinfo() data passing.
The code is based on Damien George's implementation for esp8266 port,
avoids use of global variables and associated re-entrancy issues, and
fixes returning stale data in some cases.
9 years ago
Paul Sokolovsky
e5b047369b
extmod/modlwip: Use MICROPY_EVENT_POLL_HOOK for event polling if defined.
Instead of just delaying 100ms if event isn't yet ready.
So far applies only to default, "infinite" socket timeout.
9 years ago
Paul Sokolovsky
43d497592f
extmod/modlwip: Factor out "socket connected" check to a function.
Same code repeated for each send*() and recv*() function.
9 years ago
Paul Sokolovsky
fda874e406
extmod/modlwip: Support non-blocking recv().
9 years ago