GithubHelp home page GithubHelp logo

yurivict / tox-defragmenter Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 70 KB

Tox module allowing to send messages of unlimited size.

License: BSD 3-Clause "New" or "Revised" License

Makefile 1.44% C 95.90% Shell 2.66%

tox-defragmenter's Introduction

tox-defragmenter

Tox module allowing to send messages of unlimited size.

Why tox-defragmenter?

Due to the low-level nature of the Tox library, Tox API allows to send messages of size limited to TOX_MAX_MESSAGE_LENGTH, which is 1372 bytes. Tox clients need to split longer messages, such that the individual parts don't exceed 1372 bytes. This causes long messages to appear as a sequence of many messages. This is the undesirable effect, because users expect their messages to be received in the same form they were sent.

How does it work?

tox-defragmenter is between the Tox client and the Tox library. When it sees the long message, it splits it in fragments and adds the special marker to the parts so that they can be identified as fragments, and not an independent messages. On the receiving end, tox-defragmenter recombines the fragments into the original message that it then sends to the client when all fragments have arrived.

API

tox-defragmenter API requires two intialization functions to be called: tox_defragmenter_initialize_api and tox_defragmenter_initialize_db before it can be used. It also requires the function tox_defragmenter_periodic to be called every few seconds, and the function tox_defragmenter_uninitialize to be called in the end.

For clients that don't use SQLite or sqlcipher tox-defragmenter can create in-memory databases. This will lose the ability to send long messages persistently across sessions, and client restart on any end will require to re-send all unfinished messages. In-memory database should be initialized with tox_defragmenter_initialize_db_inmemory.

Dependencies

  • Build-time dependency on the tox library.
  • Expects the caller to depend on SQLite or sqlcipher.

Build

Run 'make TOX_HEADERS=/path/to/tox/headers' command.

Tests

In order to run tests please run the command 'make run-regression-tests'.

Caveats

  • Due to the SQLite blob bug discovered during the development process, tox-defragmenter has to open and close db blobs for each fragment, which causes the performance impact on the receiving end. Until this SQLite bug is fixed, only moderately long messages can be sent.

tox-defragmenter's People

Contributors

yurivict avatar

Watchers

 avatar

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.