Skip to content
Snippets Groups Projects
  1. May 17, 2016
    • Paul Sokolovsky's avatar
      py/stream: Support both "exact size" and "one underlying call" operations. · 7f7c84b1
      Paul Sokolovsky authored
      Both read and write operations support variants where either a) a single
      call is made to the undelying stream implementation and returned buffer
      length may be less than requested, or b) calls are repeated until requested
      amount of data is collected, shorter amount is returned only in case of
      EOF or error.
      
      These operations are available from the level of C support functions to be
      used by other C modules to implementations of Python methods to be used in
      user-facing objects.
      
      The rationale of these changes is to allow to write concise and robust
      code to work with *blocking* streams of types prone to short reads, like
      serial interfaces and sockets. Particular object types may select "exact"
      vs "once" types of methods depending on their needs. E.g., for sockets,
      revc() and send() methods continue to be "once", while read() and write()
      thus converted to "exactly" versions.
      
      These changes don't affect non-blocking handling, e.g. trying "exact"
      method on the non-blocking socket will return as much data as available
      without blocking. No data available is continued to be signaled as None
      return value to read() and write().
      
      From the point of view of CPython compatibility, this model is a cross
      between its io.RawIOBase and io.BufferedIOBase abstract classes. For
      blocking streams, it works as io.BufferedIOBase model (guaranteeing
      lack of short reads/writes), while for non-blocking - as io.RawIOBase,
      returning None in case of lack of data (instead of raising expensive
      exception, as required by io.BufferedIOBase). Such a cross-behavior
      should be optimal for MicroPython needs.
      7f7c84b1
    • Paul Sokolovsky's avatar
      unix/mpconfigport_coverage.h: Add dedicated config file for coverage build. · 92a342a0
      Paul Sokolovsky authored
      This allows to enable the options which aren't enabled in the normal unix
      config (as unix port is no longer an enable-all port).
      92a342a0
  2. May 16, 2016
  3. May 15, 2016
    • Paul Sokolovsky's avatar
      extmod/modlwip: Rework how Python accept callback is called. · afce978a
      Paul Sokolovsky authored
      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.
      afce978a
  4. May 14, 2016
  5. May 13, 2016
  6. May 12, 2016
  7. May 11, 2016
  8. May 10, 2016
Loading