/lists.whatwg.org/pipermail/whatwg-whatwg.org/2010-March/025754.html

https://github.com/whatwg/whatwg.org · HTML · 94 lines · 84 code · 3 blank · 7 comment · 0 complexity · 3c5c633924cf0d5081b94e2e37cb9988 MD5 · raw file

  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
  2. <HTML>
  3. <HEAD>
  4. <TITLE> [whatwg] WebSocket bufferedAmount includes overhead or not
  5. </TITLE>
  6. <LINK REL="Index" HREF="index.html" >
  7. <LINK REL="made" HREF="mailto:whatwg%40lists.whatwg.org?Subject=Re%3A%20%5Bwhatwg%5D%20WebSocket%20bufferedAmount%20includes%20overhead%20or%20not&In-Reply-To=%3Ck2i63df84f1003311557of6e198fesd792b509b8eec285%40mail.gmail.com%3E">
  8. <META NAME="robots" CONTENT="index,nofollow">
  9. <META http-equiv="Content-Type" content="text/html; charset=us-ascii">
  10. <LINK REL="Previous" HREF="025753.html">
  11. <LINK REL="Next" HREF="025737.html">
  12. </HEAD>
  13. <BODY BGCOLOR="#ffffff">
  14. <H1>[whatwg] WebSocket bufferedAmount includes overhead or not</H1>
  15. <!--htdig_noindex-->
  16. <B>Jonas Sicking</B>
  17. <A HREF="mailto:whatwg%40lists.whatwg.org?Subject=Re%3A%20%5Bwhatwg%5D%20WebSocket%20bufferedAmount%20includes%20overhead%20or%20not&In-Reply-To=%3Ck2i63df84f1003311557of6e198fesd792b509b8eec285%40mail.gmail.com%3E"
  18. TITLE="[whatwg] WebSocket bufferedAmount includes overhead or not">jonas at sicking.cc
  19. </A><BR>
  20. <I>Wed Mar 31 15:57:57 PDT 2010</I>
  21. <P><UL>
  22. <LI>Previous message: <A HREF="025753.html">[whatwg] WebSocket bufferedAmount includes overhead or not
  23. </A></li>
  24. <LI>Next message: <A HREF="025737.html">[whatwg] WebSocket bufferedAmount includes overhead or not
  25. </A></li>
  26. <LI> <B>Messages sorted by:</B>
  27. <a href="date.html#25754">[ date ]</a>
  28. <a href="thread.html#25754">[ thread ]</a>
  29. <a href="subject.html#25754">[ subject ]</a>
  30. <a href="author.html#25754">[ author ]</a>
  31. </LI>
  32. </UL>
  33. <HR>
  34. <!--/htdig_noindex-->
  35. <!--beginarticle-->
  36. <PRE>On Wed, Mar 31, 2010 at 3:16 PM, Boris Zbarsky &lt;<A HREF="http://lists.whatwg.org/listinfo.cgi/whatwg-whatwg.org">bzbarsky at mit.edu</A>&gt; wrote:
  37. &gt;<i> On 3/31/10 2:38 AM, Jonas Sicking wrote:
  38. </I>&gt;&gt;<i>
  39. </I>&gt;&gt;<i> I would have expected bufferedAmount to only change as a result of an
  40. </I>&gt;&gt;<i> event being posted to the main event loop. We generally try to avoid
  41. </I>&gt;&gt;<i> &quot;racy&quot; variables since people don't expect them. Consider for example
  42. </I>&gt;&gt;<i>
  43. </I>&gt;&gt;<i> if (ws.bufferedAmount&gt; &#160;X) {
  44. </I>&gt;&gt;<i> &#160; setUpSomeState();
  45. </I>&gt;&gt;<i> }
  46. </I>&gt;&gt;<i>
  47. </I>&gt;&gt;<i> try {
  48. </I>&gt;&gt;<i> &#160; doOtherThings();
  49. </I>&gt;&gt;<i> }
  50. </I>&gt;&gt;<i> finally {
  51. </I>&gt;&gt;<i> &#160; if (ws.bufferedAmount&gt; &#160;X) {
  52. </I>&gt;&gt;<i> &#160; &#160; cleanUpState();
  53. </I>&gt;&gt;<i> &#160; }
  54. </I>&gt;&gt;<i> }
  55. </I>&gt;&gt;<i>
  56. </I>&gt;&gt;<i> I'd imagine most JS developers to expect the cleanup to always happen
  57. </I>&gt;&gt;<i> if the setup did.
  58. </I>&gt;<i>
  59. </I>&gt;<i> Sure, but do they expect the cleanup to happen if the setup did not if
  60. </I>&gt;<i> doOtherThings tried to send() stuff?
  61. </I>&gt;<i>
  62. </I>&gt;<i> More to the point, is send() allowed to actually send anything when called,
  63. </I>&gt;<i> or does it have to buffer it all until the next time you get to the event
  64. </I>&gt;<i> loop?
  65. </I>
  66. I would expect that send() is allowed to start streaming data over the
  67. network as soon as it can, but only update bufferedAmount from the
  68. event loop.
  69. / Jonas
  70. </PRE>
  71. <!--endarticle-->
  72. <!--htdig_noindex-->
  73. <HR>
  74. <P><UL>
  75. <!--threads-->
  76. <LI>Previous message: <A HREF="025753.html">[whatwg] WebSocket bufferedAmount includes overhead or not
  77. </A></li>
  78. <LI>Next message: <A HREF="025737.html">[whatwg] WebSocket bufferedAmount includes overhead or not
  79. </A></li>
  80. <LI> <B>Messages sorted by:</B>
  81. <a href="date.html#25754">[ date ]</a>
  82. <a href="thread.html#25754">[ thread ]</a>
  83. <a href="subject.html#25754">[ subject ]</a>
  84. <a href="author.html#25754">[ author ]</a>
  85. </LI>
  86. </UL>
  87. <hr>
  88. <a href="http://lists.whatwg.org/listinfo.cgi/whatwg-whatwg.org">More information about the whatwg
  89. mailing list</a><br>
  90. <!--/htdig_noindex-->
  91. </body></html>