summaryrefslogtreecommitdiffstatshomepage
path: root/extmod/modlwip.c
Commit message (Collapse)AuthorAge
* extmod/modlwip: ioctl POLL: Fix handling of peer closed socket.Paul Sokolovsky2017-05-01
| | | | | | | | | | Peer-closed socket is both readable and writable: read will return EOF, write - error. Without this poll will hang on such socket. Note that we don't return POLLHUP, based on argumentation in http://www.greenend.org.uk/rjk/tech/poll.html that it should apply to deeper disconnects, for example for networking, that would be link layer disconnect (e.g. WiFi went down).
* extmod/modlwip: getaddrinfo: Allow to accept all 6 standard params.Paul Sokolovsky2017-04-29
| | | | But warn if anything else but host/port is passed.
* all: Use full path name when including mp-readline/timeutils/netutils.Damien George2017-03-31
| | | | | | | This follows the pattern of how all other headers are now included, and makes it explicit where the header file comes from. This patch also removes -I options from Makefile's that specify the mp-readline/timeutils/ netutils directories, which are no longer needed.
* extmod/modlwip: Use mp_obj_str_get_str instead of mp_obj_str_get_data.Damien George2017-03-26
|
* extmod/modlwip: Add my copyright.Paul Sokolovsky2017-02-15
| | | | | | | | | Per: $ git log modlwip.c |grep ^Auth | sort | uniq -c 9 Author: Damien George 2 Author: Galen Hazelwood 43 Author: Paul Sokolovsky
* extmod/modlwip: Add socket.readinto() method.Damien George2017-01-27
|
* all: Consistently update signatures of .make_new and .call methods.Paul Sokolovsky2017-01-04
| | | | | Otherwise, they serve reoccurring source of copy-paste mistakes and breaking nanbox build.
* extmod/modlwip: Add ioctl method to socket, with poll implementation.Damien George2016-12-02
| | | | | Implementation of polling may need further fine tuning, but basic functionality works (tested on esp8266).
* extmod/modlwip: Use mp_raise_OSError helper function.Damien George2016-10-07
| | | | Reduces esp8266 code size by about 230 bytes.
* all: Remove 'name' member from mp_obj_module_t struct.Damien George2016-09-22
| | | | One can instead lookup __name__ in the modules dict to get the value.
* extmod/modlwip: Store a chain of incoming pbufs, instead of only one.Paul Sokolovsky2016-06-19
| | | | | | | | | | | | | | | | | | | | | | Storing a chain of pbuf was an original design of @pfalcon's lwIP socket module. The problem with storing just one, like modlwip does is that "peer closed connection" notification is completely asynchronous and out of band. So, there may be following sequence of actions: 1. pbuf #1 arrives, and stored in a socket. 2. pbuf #2 arrives, and rejected, which causes lwIP to put it into a queue to re-deliver later. 3. "Peer closed connection" is signaled, and socket is set at such status. 4. pbuf #1 is processed. 5. There's no stored pbufs in teh socket, and socket status is "peer closed connection", so EOF is returned to a client. 6. pbuf #2 gets redelivered. Apparently, there's no easy workaround for this, except to queue all incoming pbufs in a socket. This may lead to increased memory pressure, as number of pending packets would be regulated only by TCP/IP flow control, whereas with previous setup lwIP had a global overlook of number packets waiting for redelivery and could regulate them centrally.
* all: Rename mp_obj_type_t::stream_p to protocol.Paul Sokolovsky2016-06-18
| | | | | It's now used for more than just stream protocol (e.g. pin protocol), so don't use false names.
* extmod/modlwip: Rework how Python accept callback is called.Paul Sokolovsky2016-05-15
| | | | | | | | | | | Calling it from lwIP accept callback will lead incorrect functioning and/or packet leaks if Python callback has any networking calls, due to lwIP non-reentrancy. So, instead schedule "poll" callback to do that, which will be called by lwIP when it does not perform networking activities. "Poll" callback is called infrequently though (docs say every 0.5s by default), so for better performance, lwIP needs to be patched to call poll callback soon after accept callback, but when current packet is already processed.
* extmod/modlwip: Convert errno's to use MP_Exxx symbols.Damien George2016-05-12
|
* extmod/modlwip: Implement sendall() method for TCP sockets.Paul Sokolovsky2016-05-03
|
* extmod/modlwip: Add print_pcbs() debug function.Paul Sokolovsky2016-04-26
| | | | This requires lwIP built with LWIP_DEBUG (or it will be no-op).
* extmod/modlwip: Workaround esp8266 sendto issue where 1 is returned.Damien George2016-04-26
|
* extmod, stmhal: Fix typo of macro that detects if float is enabled.Damien George2016-04-26
|
* extmod/modlwip: Protect recv/accept Python callback against exceptions.Paul Sokolovsky2016-04-25
| | | | Using usual call_function_*_protected() helper, to avoid NLR jump crashes.
* extmod/modlwip: Add ability to run callback on "recv" and "accept" events.Paul Sokolovsky2016-04-17
| | | | | | 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.
* extmod/modlwip: lwip_tcp_receive(): Full error handling.Paul Sokolovsky2016-04-17
|
* extmod/modlwip: lwip_tcp_send(): Full error handling.Paul Sokolovsky2016-04-17
|
* extmod/modlwip: More debug messages for various edge conditions.Paul Sokolovsky2016-04-15
|
* extmod/modlwip: Start adding debug output.Paul Sokolovsky2016-04-14
|
* extmod/modlwip: lwip_tcp_receive(): Properly handle EOF for non-blocking sock.Paul Sokolovsky2016-04-14
|
* extmod/modlwip: Fix for loss of data in unaccepted incoming sockets.Paul Sokolovsky2016-04-11
| | | | | | | | | 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.
* extmod/modlwip: lwip_socket_setsockopt: Handle option value properly.Paul Sokolovsky2016-03-25
|
* extmod/modlwip: Add lwip->POSIX error map for lwIP 1.4.0.Paul Sokolovsky2016-03-25
| | | | Between 1.4.0 and 1.4.1, lwIP errors were renumbered.
* extmod/modlwip: lwip_tcp_send: Handle properly send buffer full condition.Paul Sokolovsky2016-03-25
| | | | | | | | | 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]."
* extmod/modlwip: Implement setsocketopt(SO_REUSEADDR).Paul Sokolovsky2016-03-25
|
* extmod/modlwip: Add SOL_SOCKET and SO_REUSEADDR constants for setsockopt().Paul Sokolovsky2016-03-25
|
* extmod/modlwip: lwip_tcp_receive: Properly map lwIP error to POSIX errno.Paul Sokolovsky2016-03-12
|
* extmod/modlwip: Add socket.setblocking() method.Paul Sokolovsky2016-03-12
|
* extmod/modlwip: Rework getaddrinfo() data passing.Paul Sokolovsky2016-03-12
| | | | | | 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.
* extmod/modlwip: Use MICROPY_EVENT_POLL_HOOK for event polling if defined.Paul Sokolovsky2016-03-11
| | | | | | Instead of just delaying 100ms if event isn't yet ready. So far applies only to default, "infinite" socket timeout.
* extmod/modlwip: Factor out "socket connected" check to a function.Paul Sokolovsky2016-03-09
| | | | Same code repeated for each send*() and recv*() function.
* extmod/modlwip: Support non-blocking recv().Paul Sokolovsky2016-03-09
|
* extmod/modlwip: Add .write() stream method.Paul Sokolovsky2016-03-09
|
* extmod/modlwip: Still process remaining incoming data of a closed socket.Damien George2016-03-09
| | | | | | | | | It can happen that a socket gets closed while the pbuf is not completely drained by the application. It can also happen that a new pbuf comes in via the recv callback, and then a "peer closed" event comes via the same callback (pbuf=NULL) before the previous event has been handled. In both cases the socket is closed but there is remaining data. This patch makes sure such data is passed to the application.
* extmod/modlwip: Check for state change during recv busy-wait loop.Damien George2016-03-09
| | | | | For example, the peer may close the connection while recv is waiting for incoming data.
* extmod/modlwip: Add stream .read() and .readline() methods.Paul Sokolovsky2016-03-09
|
* extmod/modlwip: Add dummy .makefile() method.Paul Sokolovsky2016-03-09
|
* extmod/modlwip: Add stream protocol read method.Paul Sokolovsky2016-03-09
|
* extmod/modlwip: Implement dummy setsockopt().Paul Sokolovsky2016-03-08
|
* extmod/modlwip: Add .print() method.Paul Sokolovsky2016-03-08
|
* extmod/modlwip: Update make_new() arguments for recent refactor.Paul Sokolovsky2016-03-08
|
* extmod/modlwip: Use _ERR_BADF instead of magic number.Paul Sokolovsky2015-12-30
|
* extmod/modlwip: Avoid magic numeric values in memcpy().Paul Sokolovsky2015-12-30
|
* extmod/modlwip: User proper field name and value names for socket state.Paul Sokolovsky2015-12-30
|
* extmod/modlwip: Mark some lwip_socket_obj_t's fields as volatile.Paul Sokolovsky2015-12-29
| | | | Any fields changed by asynchronous callbacks must be volatile.