<feed xmlns='http://www.w3.org/2005/Atom'>
<title>suspect-devices/circuitpython/extmod/modlwip.c, branch 6.1.0-beta.2</title>
<subtitle>CircuitPython - a Python implementation for teaching coding with microcontrollers</subtitle>
<id>https://git.suspectdevices.com/suspect-devices/circuitpython/atom?h=6.1.0-beta.2</id>
<link rel='self' href='https://git.suspectdevices.com/suspect-devices/circuitpython/atom?h=6.1.0-beta.2'/>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/'/>
<updated>2020-07-06T18:16:25+00:00</updated>
<entry>
<title>Add license to some obvious files.</title>
<updated>2020-07-06T18:16:25+00:00</updated>
<author>
<name>Diego Elio Pettenò</name>
<email>flameeyes@flameeyes.com</email>
</author>
<published>2020-06-03T22:40:05+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=34b4993d63a6b576f29d624385c681f679b4124c'/>
<id>urn:sha1:34b4993d63a6b576f29d624385c681f679b4124c</id>
<content type='text'>
</content>
</entry>
<entry>
<title>protocols: Allow them to be (optionally) type-safe</title>
<updated>2019-12-04T15:29:57+00:00</updated>
<author>
<name>Jeff Epler</name>
<email>jepler@gmail.com</email>
</author>
<published>2019-12-03T20:50:37+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=238e12123690debaf2cf8488fb2a4d4003a06506'/>
<id>urn:sha1:238e12123690debaf2cf8488fb2a4d4003a06506</id>
<content type='text'>
Protocols are nice, but there is no way for C code to verify whether
a type's "protocol" structure actually implements some particular
protocol.  As a result, you can pass an object that implements the
"vfs" protocol to one that expects the "stream" protocol, and the
opposite of awesomeness ensues.

This patch adds an OPTIONAL (but enabled by default) protocol identifier
as the first member of any protocol structure.  This identifier is
simply a unique QSTR chosen by the protocol designer and used by each
protocol implementer.  When checking for protocol support, instead of
just checking whether the object's type has a non-NULL protocol field,
use `mp_proto_get` which implements the protocol check when possible.

The existing protocols are now named:
    protocol_framebuf
    protocol_i2c
    protocol_pin
    protocol_stream
    protocol_spi
    protocol_vfs
(most of these are unused in CP and are just inherited from MP; vfs and
stream are definitely used though)

I did not find any crashing examples, but here's one to give a flavor of what
is improved, using `micropython_coverage`.  Before the change,
the vfs "ioctl" protocol is invoked, and the result is not intelligible
as json (but it could have resulted in a hard fault, potentially):

    &gt;&gt;&gt; import uos, ujson
    &gt;&gt;&gt; u = uos.VfsPosix('/tmp')
    &gt;&gt;&gt; ujson.load(u)
    Traceback (most recent call last):
      File "&lt;stdin&gt;", line 1, in &lt;module&gt;
    ValueError: syntax error in JSON

After the change, the vfs object is correctly detected as not supporting
the stream protocol:
    &gt;&gt;&gt; ujson.load(p)
    Traceback (most recent call last):
      File "&lt;stdin&gt;", line 1, in &lt;module&gt;
    OSError: stream operation not supported
</content>
</entry>
<entry>
<title>WIP: complete manual inspection of all significant changes</title>
<updated>2018-07-24T01:34:25+00:00</updated>
<author>
<name>Dan Halbert</name>
<email>halbert@halwitz.org</email>
</author>
<published>2018-07-24T01:34:25+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=bc760dd34100099c352a0f185ec54ceae23d036d'/>
<id>urn:sha1:bc760dd34100099c352a0f185ec54ceae23d036d</id>
<content type='text'>
</content>
</entry>
<entry>
<title>extmod/modlwip: Allow to compile with MICROPY_PY_LWIP disabled.</title>
<updated>2018-05-21T06:46:30+00:00</updated>
<author>
<name>Damien George</name>
<email>damien.p.george@gmail.com</email>
</author>
<published>2018-05-21T06:46:30+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=41766ba7e67022d2d15ce78896a730745ea3871f'/>
<id>urn:sha1:41766ba7e67022d2d15ce78896a730745ea3871f</id>
<content type='text'>
</content>
</entry>
<entry>
<title>extmod/modlwip: Set POLLHUP flag for sockets that are new.</title>
<updated>2018-05-17T13:17:36+00:00</updated>
<author>
<name>Damien George</name>
<email>damien.p.george@gmail.com</email>
</author>
<published>2018-05-17T13:17:36+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=1e2a6a84a263e069d7be5f27d73e7fc124413fa5'/>
<id>urn:sha1:1e2a6a84a263e069d7be5f27d73e7fc124413fa5</id>
<content type='text'>
This matches CPython behaviour on Linux: a socket that is new and not
listening or connected is considered "hung up".

Thanks to @rkojedzinszky for the initial patch, PR #3457.
</content>
</entry>
<entry>
<title>extmod/modlwip: Update to work with lwIP v2.0.</title>
<updated>2018-05-17T02:58:34+00:00</updated>
<author>
<name>Damien George</name>
<email>damien.p.george@gmail.com</email>
</author>
<published>2018-05-17T02:58:34+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=9c2044717c8852105df25746a8a7b873fbfc3609'/>
<id>urn:sha1:9c2044717c8852105df25746a8a7b873fbfc3609</id>
<content type='text'>
lwIP v2.0.3 has been tested with this lwip module and it works very well.
</content>
</entry>
<entry>
<title>extmod/modlwip: In ioctl handle case when socket is in an error state.</title>
<updated>2018-05-04T05:15:04+00:00</updated>
<author>
<name>Damien George</name>
<email>damien.p.george@gmail.com</email>
</author>
<published>2018-05-04T05:15:04+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=318f874cda22567a55bb004434ed0ec891fd7d61'/>
<id>urn:sha1:318f874cda22567a55bb004434ed0ec891fd7d61</id>
<content type='text'>
Using MP_STREAM_POLL_HUP for ERR_RST state follows how *nix handles this
case.
</content>
</entry>
<entry>
<title>extmod/modlwip: Check if getaddrinfo() constraints are supported or not.</title>
<updated>2018-04-23T06:38:20+00:00</updated>
<author>
<name>Damien George</name>
<email>damien.p.george@gmail.com</email>
</author>
<published>2018-04-23T06:38:20+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=bdff68db9c1f7e35d0600841647cffac4b1d9ef0'/>
<id>urn:sha1:bdff68db9c1f7e35d0600841647cffac4b1d9ef0</id>
<content type='text'>
In particular don't issue a warning if the passed-in constraints are
actually supported because they are the default values.
</content>
</entry>
<entry>
<title>py/stream: Switch stream close operation from method to ioctl.</title>
<updated>2018-04-10T03:41:32+00:00</updated>
<author>
<name>Damien George</name>
<email>damien.p.george@gmail.com</email>
</author>
<published>2018-03-07T06:48:53+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=cf31d384f1d2ca09f817f154892eaa6860c10144'/>
<id>urn:sha1:cf31d384f1d2ca09f817f154892eaa6860c10144</id>
<content type='text'>
This patch moves the implementation of stream closure from a dedicated
method to the ioctl of the stream protocol, for each type that implements
closing.  The benefits of this are:

1. Rounds out the stream ioctl function, which already includes flush,
   seek and poll (among other things).

2. Makes calling mp_stream_close() on an object slightly more efficient
   because it now no longer needs to lookup the close method and call it,
   rather it just delegates straight to the ioctl function (if it exists).

3. Reduces code size and allows future types that implement the stream
   protocol to be smaller because they don't need a dedicated close method.

Code size reduction is around 200 bytes smaller for x86 archs and around
30 bytes smaller for the bare-metal archs.
</content>
</entry>
<entry>
<title>extmod/modlwip: Commit TCP out data to lower layers if buffer gets full.</title>
<updated>2017-11-24T04:52:32+00:00</updated>
<author>
<name>Damien George</name>
<email>damien.p.george@gmail.com</email>
</author>
<published>2017-10-31T02:50:08+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=48f6990fbc54ac29b15fa765d431244d1dcb5f21'/>
<id>urn:sha1:48f6990fbc54ac29b15fa765d431244d1dcb5f21</id>
<content type='text'>
Dramatically improves TCP sending throughput because without an explicit
call to tcp_output() the data is only sent to the lower layers via the
lwIP slow timer which (by default) ticks every 500ms.
</content>
</entry>
</feed>
