maniac103/ems-collector — pull request #9 by moosy (2014-02-24 23:00:35+00:00)
Title: Some fixes with continueRequest()

continueRequest() continues until the requested amount of data is received, even though if there is not that much data to deliver.
Added mechanism to detect identical subsequent queries (i.e. those with the same offset in the same request) and stop requesting over and over again.
This became obvious when testing the raw read feature, which is naturally used to discover unknown telegrams and is quite unusable if the daemon hangs every time one byte too many is requested.
The second issue regards the "data" field and continueRequest().
In the data field there only is the data from the last (sub-)query, therefore it has to be processed in *every* processing cycle. raw read was affected here again.
Furthermore getcontactinfo was affected, thus only displaying the last few bytes of the second line, omitting the first line and the first few bytes of the second line.
The approach to collect all of the 42 bytes in a buffer would require a buffer above the scope of the handlePCMessage() method, for example in the active Connection.
As only getcontactinfo seems to be affected, it seems much easier to get both text lines one after the other, which eases parsing and output and needs two EMS requests, just like if using continueRequest().