<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Word 14 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri","sans-serif";}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Hello,<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">For the following discussion reference noPoll test code at:<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">https://github.com/rpkale/test-nopoll<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">One issue I had trouble with is the significance of the 'final' flag when a
<o:p></o:p></p>
<p class="MsoNormal">message is received. The client tries to collect message of a known fixed
<o:p></o:p></p>
<p class="MsoNormal">size that it expects to arrive from the server. Initially I tried to use the
<o:p></o:p></p>
<p class="MsoNormal">'final' flag (nopoll_msg_is_final(msg)) to detect that the last part of  full
<o:p></o:p></p>
<p class="MsoNormal">message has arrived. However this flag was not always set reliably. Sometimes
<o:p></o:p></p>
<p class="MsoNormal">the flag would be set even before a complete message has been collected.
<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">What I observed is that if a message gets fragmented, the total length of all<o:p></o:p></p>
<p class="MsoNormal">the message fragments always adds up perfectly to the expected message length.<o:p></o:p></p>
<p class="MsoNormal">The final flag is also always set on the last fragment. But the final flag is
<o:p></o:p></p>
<p class="MsoNormal">also sometimes unexpectedly set on intermediate fragments.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Due to this I could not implement the client side getResponse() function
<o:p></o:p></p>
<p class="MsoNormal">using just the 'final' flag. Eventually I ended up implementing the detection<o:p></o:p></p>
<p class="MsoNormal">of a complete message based on length seen so far and knowing the expected<o:p></o:p></p>
<p class="MsoNormal">length.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">I feel that something is not quite right here. You mention that real
<o:p></o:p></p>
<p class="MsoNormal">implementations should always treat the data as a byte stream and not depend
<o:p></o:p></p>
<p class="MsoNormal">on fragmentation. But in this test case, there is no other intermediary doing
<o:p></o:p></p>
<p class="MsoNormal">additional fragmentation (only noPoll library involved). And the logic is
<o:p></o:p></p>
<p class="MsoNormal">only trying to catch the is_final() condition and not the is_fragment()
<o:p></o:p></p>
<p class="MsoNormal">condition. Should not this flag be set reliably on the server and retrieved
<o:p></o:p></p>
<p class="MsoNormal">reliably on the client on the last fragment? Otherwise what is the purpose of
<o:p></o:p></p>
<p class="MsoNormal">this flag in the websocket specification?<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">You can reproduce the issue by enabling debug log (export <o:p>
</o:p></p>
<p class="MsoNormal">NOPOLL_TEST_DEBUG=1) and running one client instance against a server. Look
<o:p></o:p></p>
<p class="MsoNormal">for "Final flag set arbitrarily??" in the output.<o:p></o:p></p>
<p class="MsoNormal"><o:p></o:p></p>
<p class="MsoNormal">There is another condition that I try to catch and output "Final flag not set??".<o:p></o:p></p>
<p class="MsoNormal">This does not happen with the latest noPoll build but I used to see this with the<o:p></o:p></p>
<p class="MsoNormal">earlier builds.<o:p></o:p></p>
<p class="MsoNormal"><o:p></o:p></p>
<p class="MsoNormal">Would really appreciate if you could shed some light on this.<o:p></o:p></p>
<p class="MsoNormal">Is my assumption wrong? Or is there an implementation problem<o:p></o:p></p>
<p class="MsoNormal">in the test code?<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Regards,<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Rahul<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Rahul Kale<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">IP Video Systems<o:p></o:p></p>
<p class="MsoNormal">Barco, Inc<o:p></o:p></p>
<p class="MsoNormal">1287 Anvilwood Ave<o:p></o:p></p>
<p class="MsoNormal">Sunnyvale, CA  94089<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Tel  +1 408 400 4238<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
This message is subject to the following terms and conditions: <a href="http://www.barco.com/en/maildisclaimer">
MAIL DISCLAIMER</a>
</body>
</html>