Giter VIP home page Giter VIP logo

Comments (6)

MightyPork avatar MightyPork commented on July 17, 2024 2

It's a good idea, I'm only concerned about back compat. If you add it, please make it configurable, so it can be switched off.

from tinyframe.

MightyPork avatar MightyPork commented on July 17, 2024 1

@grantramsay Sounds reasonable to me, this resyncing will work. I'd gladly merge that.

(I don't currently use TF in any active project, so I don't see implementing this myself soon..)

from tinyframe.

mon avatar mon commented on July 17, 2024 1

That would actually be quite an elegant solution, I might try implementing that

from tinyframe.

grantramsay avatar grantramsay commented on July 17, 2024

I might be missing something, but wouldn't a simple back compatible way be to:

  • buffer entire packet when receiving, need to increase buffer size to handle full packet (header + payload + checksum/crc)
  • if checksum/crc fails or len > TF_MAX_PAYLOAD, memmove buffer to next SOF (if present) and reset rx index

This way the state machine will resynchronise on the next valid checksum/crc with no change to the message structure

Edit:
Also TF_ResetParser would reset the rx index, so reliable links without checksum/crc (e.g. TCP) could call it to resync if connection is restarted.
Additionally a timeout could be added to move to the next SOF. For the case where the link fails with a large but not invalid message length, and the next message is short. The state machine would need to receive extra rx data to resync, which may not be timely enough for the application

from tinyframe.

grantramsay avatar grantramsay commented on July 17, 2024

@mon - I had a little go at this the other day.
It got a little more complicated than I'd like, but there might be something helpful here (definitely a "work in progress"):
master...grantramsay:wip/feat-16/sof-resync

from tinyframe.

mon avatar mon commented on July 17, 2024

Hmmm, certainly a little more complex than I expected. I'll experiment a bit over the next few weeks and see how reliable it is.

from tinyframe.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.