Be careful about passing NULL to AsyncWait.  That results in your
callback occuring on a background thread.  You probably want to pass
the main thread's nsIEventQueue instead to route the callback to the
main thread.

-Darin




On 3/21/06, Jon Smirl <[EMAIL PROTECTED]> wrote:
> On 3/21/06, doug b <[EMAIL PROTECTED]> wrote:
> > Jon Smirl wrote:
> >
> > > http://xulplanet.com/references/xpcomref/ifaces/nsIAsyncOutputStream.html
> > > http://www.xulplanet.com/references/xpcomref/ifaces/nsIOutputStreamCallback.html
> > >
> > > When you get NS_BASE_STREAM_WOULD_BLOCK call AsyncWait and then
> > > continue writing from the OnOutputStreamReady notification.
> > >
> >
> > Thanks, but how is AsyncOutputStream implemented? Right now, I take an
> > nsITransport object and call openOutputStream - how do I get an
> > AsyncOutputStream instead?
>
> Query instance, this is the input version....
>
> nsresult
> ProxyServer::OnSocketAccepted(nsIServerSocket *aServ,
> nsISocketTransport *aTransport) {
>         nsresult rv;
>         nsCOMPtr<nsIInputStream> instream;
>         nsCOMPtr<nsIAsyncInputStream> astream;
>         nsCOMPtr<nsIOutputStream> outstream;
>
>         rv = aTransport->OpenInputStream(nsITransport::OPEN_UNBUFFERED, 0, 0,
> getter_AddRefs(instream));
>         rv = aTransport->OpenOutputStream(nsITransport::OPEN_UNBUFFERED, 0,
> 0, getter_AddRefs(outstream));
>
>         astream = do_QueryInterface(instream);
>         rv = astream->AsyncWait(new BrowserConnection(instream, outstream),
> 0, 0, NULL);
>
>         return rv;
> }
>
>
>
>
> > _______________________________________________
> > dev-tech-xpcom mailing list
> > [email protected]
> > https://lists.mozilla.org/listinfo/dev-tech-xpcom
> >
>
>
> --
> Jon Smirl
> [EMAIL PROTECTED]
> _______________________________________________
> dev-tech-xpcom mailing list
> [email protected]
> https://lists.mozilla.org/listinfo/dev-tech-xpcom
>
_______________________________________________
dev-tech-xpcom mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-xpcom

Reply via email to