- From: Jonas Sicking <jonas@sicking.cc>
- Date: Fri, 2 Apr 2010 10:43:57 -0700
On Thu, Apr 1, 2010 at 8:15 PM, Boris Zbarsky <bzbarsky at mit.edu> wrote: > On 3/31/10 6:57 PM, Jonas Sicking wrote: >> >> I would expect that send() is allowed to start streaming data over the >> network as soon as it can, but only update bufferedAmount from the >> event loop. > > Maybe I'm not being clear. ?Let's say bufferedAmount were to reflect the > number of UTF-8-encoded bytes to be sent, for the sake of argument. > > I wait until bufferedAmount is 0, then call send("My text"). > > What are possible values of bufferedAmount if I examine it right after the > send() call? ?Is 0 a valid possible value? ?What about 1? ?2? 3? 4? 5? 6? 7? > > Presumably the value will be somewhere in the integer range [0,7], right? > ?Or will it always be 7 after that call in that situation? In order to archive maximum interoperability and predictability I think it should always be 7. So bufferedAmount is always adjusted synchronously upwards by the length of the sent message by send(), and always adjusted downwards from events posted to the main event loop. Though it's possible that this is overengineering given how people are likely to use bufferedAmount. Interested to hear opinions. / Jonas
Received on Friday, 2 April 2010 10:43:57 UTC