Paul Sokolovsky
cfc94bec9f
extmod/modlwip: Implement sendall() method for TCP sockets.
9 years ago
Paul Sokolovsky
b8468d12a1
extmod/modwebrepl: Get rid of using strncpy().
9 years ago
Paul Sokolovsky
859e4e94f3
extmod/modwebrepl: Add support for password.
Request for password then becomes mandatory part of the protocol.
9 years ago
Paul Sokolovsky
18775d3807
extmod/modwebrepl: Set debugging by default to off.
That's production setting. Also, extra UART output may affect behavior of
(subpar) network drivers.
9 years ago
Paul Sokolovsky
b0f3ae58e7
extmod/modwebrepl: Add rate-limiting workaround for broken network drivers.
Like ESP8266 has.
9 years ago
Paul Sokolovsky
8811b0af9c
extmod/modwebrepl: Use bigger socket receive buffer.
The smaller chunks we send (and receive), the more packets there to
receive, and higher chance to git internal packet buffer overflow in
WiFi driver.
9 years ago
Paul Sokolovsky
b3bc2ee1b9
extmod/modwebrepl: More detailed debug output.
So detailed that even commented by default.
9 years ago
Paul Sokolovsky
473b639845
extmod/modwebrepl: GET_FILE: Send length-prefix chunk with one write().
A bit of optimization.
9 years ago
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.
9 years ago
Paul Sokolovsky
6514ff6160
extmod/modwebrepl: Initial implementation of "get file" operation.
9 years ago
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.
9 years ago
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.
9 years ago
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