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
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
Paul Sokolovsky
7379be3673
extmod/modlwip: Add .write() stream method.
9 years ago
Damien George
4f64f6bfd3
extmod/modlwip: Still process remaining incoming data of a closed socket.
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.
9 years ago
Damien George
6d2e9e70b3
extmod/modlwip: Check for state change during recv busy-wait loop.
For example, the peer may close the connection while recv is waiting for
incoming data.
9 years ago
Paul Sokolovsky
6185dc5f3d
extmod/modlwip: Add stream .read() and .readline() methods.
9 years ago
Paul Sokolovsky
f1919b7c98
extmod/modlwip: Add dummy .makefile() method.
9 years ago
Paul Sokolovsky
c7fb87caff
extmod/modlwip: Add stream protocol read method.
9 years ago
Paul Sokolovsky
ed593780bf
extmod/modlwip: Implement dummy setsockopt().
9 years ago
Paul Sokolovsky
f8d42da104
extmod/modlwip: Add .print() method.
9 years ago
Paul Sokolovsky
04a9ac7f38
extmod/modlwip: Update make_new() arguments for recent refactor.
9 years ago
Paul Sokolovsky
fb7b715b7b
extmod/modlwip: Use _ERR_BADF instead of magic number.
9 years ago
Paul Sokolovsky
bc25545fbb
extmod/modlwip: Avoid magic numeric values in memcpy().
9 years ago
Paul Sokolovsky
722fb2d251
extmod/modlwip: User proper field name and value names for socket state.
9 years ago
Paul Sokolovsky
fff2dd2627
extmod/modlwip: Mark some lwip_socket_obj_t's fields as volatile.
Any fields changed by asynchronous callbacks must be volatile.
9 years ago
Paul Sokolovsky
a63d4a6cc2
extmod/modlwip: tcp_recv: Use more regular and responsive poll pattern.
Polling once in 100ms means dismal performance.
TODO: Propagate this pattern to other polling places.
9 years ago
Galen Hazelwood
af3e45419c
extmod/lwip: Change void pointers to unions, include new mphal.h file
9 years ago
Paul Sokolovsky
4deb4936d5
extmod/modlwip: socket->incoming changed by async callbacks, must be volatile.
Otherwise for code like:
while (socket->incoming == NULL) {
LWIP_DELAY(100);
}
a compiler may cache it in a register and it will be an infinite loop.
9 years ago
Paul Sokolovsky
404dae80a9
unix, stmhal: Introduce mp_hal_delay_ms(), mp_hal_ticks_ms().
These MPHAL functions are intended to replace previously used HAL_Delay(),
HAL_GetTick() to provide better naming and MPHAL separation (they are
fully equivalent otherwise).
Also, refactor extmod/modlwip to use them.
9 years ago
Paul Sokolovsky
858ed6d2f7
extmod/modlwip: Codestyle: no need for () when taking address of primary expr.
Like foo.bar or foo->bar.
9 years ago
Paul Sokolovsky
fa87e90cfa
extmod/modlwip: lwip_tcp_send(): Common subexpression elimination, use MIN().
9 years ago
Paul Sokolovsky
76217064ac
extmod/modlwip.c: Codestyle whitespace changes.
With MicroPython codestyle, with pointer casts, "*" packs with primary type
without space. Few other similar changes too (git diff -b -w is null).
9 years ago
Paul Sokolovsky
e0d7740a22
extmod/modlwip: slip: Use stream protocol and be port-independent.
Based on the original patch by Galen Hazelwood:
https://github.com/micropython/micropython/pull/1517 .
9 years ago
Galen Hazelwood
805c6534f8
extmod/modlwip: Initial commit of the lwip network stack module
9 years ago