User Tools

Site Tools


changes_features_fixes

This is an old revision of the document!


Upcoming Changes, Features and Fixes

Changes

Install php to use this new change.

Rewrote socket library so we don't need to use the normal and big buffer sizes. pilight can know handle socket messages of any size. Please notice that this commit will break all externally developed apps. Please check the various language examples to. see how the new implementation works.

Until pilight 2.1 two fixed socket buffers were used. One with the size of 1024 bytes and one with the size of 102400 bytes. This distinction has been dropped.

pilight will now send all streams in 1024 chunks. If these streams are shorter than 1024, everything was sent at once. If a stream is 1024 bytes, then you'll know it's a chunk of a bigger stream. In that case, read until you encounter the end of streams delimiter which is currently made up of two new lines \n\n.

If multiple streams were buffered somewhere, you can also distinct them by the double new line delimiters. However, be aware of the C end-of-line character. An example: ``` {“message”: “test”}\0\n\n {“message”: “test”}\0\n\n {“message”: “test”}\n\n ``` As you can see. pilight wanted to send three messages, but the TCP sockets concencated them to one.

The pilight socket_read function takes care of these buffered messages by comparing the output of `strlen` (which stops at the first `\0`) to the actual received buffer. If the received buffer is larger than the `strlen` we know the socket concencated multiple streams. pilight will then convert these messages back so the output is just big stream separated by single newlines: ``` {“message”: “test”}\n {“message”: “test”}\n {“message”: “test”}\n\0 ``` If you don't take care of these buffered streams but only check against the pilight dual newline delimiter you get this output: ``` {“message”: “test”}\0 {“message”: “test”}\0 {“message”: “test”} ```

You can check the various code example for more clarity.

Fixes & improvements

changes_features_fixes.1392825854.txt.gz · Last modified: 2015/11/27 21:08 (external edit)