Paul Sokolovsky
f41e1f1bb7
extmod/modwebrepl: Keep reading data when there's something to read.
...
EAGAIN should be returned only if underlying socket returned it. Wrap
existing read function into external loop to process all data available.
2016-04-29 01:05:02 +03:00
Paul Sokolovsky
6514ff6160
extmod/modwebrepl: Initial implementation of "get file" operation.
2016-04-29 01:02:39 +03:00
Paul Sokolovsky
25d0f7d59d
extmod/modwebrepl: Module to handle WebREPL protocol.
...
While just a websocket is enough for handling terminal part of WebREPL,
handling file transfer operations requires demultiplexing and acting
upon, which is encapsulated in _webrepl class provided by this module,
which wraps a websocket object.
2016-04-29 00:52:52 +03:00
Paul Sokolovsky
ba61480df5
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.
2016-04-28 17:29:11 +03:00
Paul Sokolovsky
2534bfdb92
extmod/modussl: Support server-side SSL sockets.
...
wrap_socket(sock, server_side=True)
2016-04-28 17:27:20 +03:00
Paul Sokolovsky
d54290f6e2
extmod/modussl: Throw Python exceptions in case of errors.
2016-04-28 00:49:54 +03:00
Paul Sokolovsky
480c212009
extmod/modwebsocket: Handle CLOSE control frame.
...
This fixes situation when clients hangs waiting for disconnect and does
so only on timeout.
2016-04-27 12:49:30 +03:00
Paul Sokolovsky
1c6d91d968
extmod/modlwip: Add print_pcbs() debug function.
...
This requires lwIP built with LWIP_DEBUG (or it will be no-op).
2016-04-26 16:30:13 +03:00
Damien George
45ac5a85d5
extmod/modlwip: Workaround esp8266 sendto issue where 1 is returned.
2016-04-26 13:19:08 +01:00
Damien George
a63542387d
extmod, stmhal: Fix typo of macro that detects if float is enabled.
2016-04-26 12:47:24 +01:00
Paul Sokolovsky
7a012f4793
extmod/modlwip: Protect recv/accept Python callback against exceptions.
...
Using usual call_function_*_protected() helper, to avoid NLR jump crashes.
2016-04-25 21:27:55 +03:00
Damien George
624738ca64
extmod/machine_i2c: Allow mp_hal_pin_obj_t to be any type, not a ptr.
2016-04-22 09:56:02 +01:00
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.
2016-04-17 18:06:45 +03:00
Paul Sokolovsky
8007f84cca
extmod/modlwip: lwip_tcp_receive(): Full error handling.
2016-04-17 02:22:26 +03:00
Paul Sokolovsky
b830f4c610
extmod/modlwip: lwip_tcp_send(): Full error handling.
2016-04-17 02:20:05 +03:00
Damien George
bcd719ea3a
extmod/fsusermount: In mount/mkfs, deregister VFS object on error.
...
Should fix issue #1947 .
2016-04-14 23:36:25 +01:00
Paul Sokolovsky
5c1af60e19
extmod/modlwip: More debug messages for various edge conditions.
2016-04-15 00:37:12 +03:00
Paul Sokolovsky
44ab5c3ef1
extmod/modlwip: Start adding debug output.
2016-04-14 01:15:52 +03:00
Paul Sokolovsky
fef0d9818a
extmod/modlwip: lwip_tcp_receive(): Properly handle EOF for non-blocking sock.
2016-04-14 00:59:09 +03:00
Paul Sokolovsky
59a4fee516
extmod/modwebsocket: Another case to propagate EOF.
2016-04-13 22:17:09 +03:00
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.
2016-04-13 16:34:11 +03:00
Damien George
eec8a94f04
extmod/machine_i2c: Implement I2C memory reading/writing.
2016-04-12 15:52:17 +01:00
Damien George
9314b2df4f
extmod/machine_i2c: Fix I2C reading by sending ack/nack at end of byte.
2016-04-12 15:46:13 +01:00
Damien George
d083712224
extmod: Add generic machine.I2C class, with bit-bang I2C.
...
Should work on any machine that provides the correct pin functions.
2016-04-12 14:06:54 +01:00
Damien George
53ad681ed1
extmod: Add initial framebuf module.
2016-04-12 14:06:53 +01:00
Paul Sokolovsky
f8fb4470a0
extmod/modwebsocket: write(): Support write size beyond 125 bytes.
2016-04-11 14:07:57 +03:00
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.
2016-04-11 01:21:34 +03:00
Paul Sokolovsky
b69f798c92
extmod/modwebsocket.h: Split websocket-related defines for reuse.
2016-04-10 13:42:51 +03:00
Paul Sokolovsky
d6236e85c2
extmod/modwebsocket: Implement MP_STREAM_SET_DATA_OPTS ioctl.
...
Allows to set fragment type (txt/bin/etc.) for output records.
2016-04-10 13:19:26 +03:00
Paul Sokolovsky
6837dba6b8
extmod/modwebsocket: Allow to get type of last read data using ioctl().
2016-04-10 12:50:46 +03:00
Paul Sokolovsky
f38e8f5217
extmod/modwebsocket: Record current fragment type (binary/text/etc.)
...
Also, handle continuation frames (untested).
2016-04-09 16:14:47 +03:00
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).
2016-04-09 16:03:38 +03:00
Paul Sokolovsky
397b705647
extmod/modwebsocket: Reset mask between packets.
2016-04-09 12:29:18 +03:00
Paul Sokolovsky
7e9182f3aa
extmod/modwebsocket: Make sure to propagate EOF.
2016-04-08 20:26:54 +03:00
Tom Sparks
20d9bc2d76
extmod/modure: re_exec() renamed to ure_exec() due to collison in 4.3BSD.
...
Addresses issue #1972 .
2016-04-08 20:12:03 +03:00
Paul Sokolovsky
05ba2433f6
extmod/modwebsocket: Properly check number of args to constructor.
2016-04-08 16:05:48 +03:00
Paul Sokolovsky
651a188299
extmod/vfs_fat_diskio: Actually support sectors != 512 with Python blockdevs.
2016-03-27 14:21:06 +03:00
Paul Sokolovsky
91031a75a1
extmod/modlwip: lwip_socket_setsockopt: Handle option value properly.
2016-03-25 20:53:52 +02:00
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.
2016-03-25 20:32:01 +02:00
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]."
2016-03-25 18:38:13 +02:00
Paul Sokolovsky
5e75f335e6
extmod/modlwip: Implement setsocketopt(SO_REUSEADDR).
2016-03-25 17:44:24 +02:00
Paul Sokolovsky
8f1854ad2d
extmod/modlwip: Add SOL_SOCKET and SO_REUSEADDR constants for setsockopt().
2016-03-25 15:06:12 +02:00
Paul Sokolovsky
3dbd2ee926
extmod/modwebsocket: Implement read support.
2016-03-25 00:51:51 +02:00
Paul Sokolovsky
24342dd65e
extmod/modwebsocket: Start module for WebSocket helper functions.
...
Currently, only write support is implemented (of limited buffer size).
2016-03-24 19:16:00 +02:00
Damien George
b894551772
extmod/uctypes: Change param type from void* to byte*.
2016-03-19 22:13:17 +00:00
Damien George
da161fd9f0
extmod/uctypes: Finish support for FLOAT32 and FLOAT64 types.
2016-03-19 21:59:42 +00:00
Damien George
12154b1774
extmod/uctypes: Use mp_binary_get_val helper when extracting value.
...
It handles more cases than mp_binary_get_int.
2016-03-19 21:41:01 +00:00
Damien George
0be6359f39
py: When printf'ing an object as a pointer, pass the concrete pointer.
2016-03-14 22:41:14 +00:00
Paul Sokolovsky
0779409d0d
extmod/modlwip: lwip_tcp_receive: Properly map lwIP error to POSIX errno.
2016-03-12 11:42:15 +07:00
Paul Sokolovsky
ba8f7d5171
extmod/modlwip: Add socket.setblocking() method.
2016-03-12 10:52:50 +07:00