<p dir="ltr">Thanks for the tips. My local flush was actually based on org.xnio.conduits.BufferedStreamSinkConduit including a terminated flag, except that i was also passing terminateWrites() on to the delegate. I'll try it with writeFinal() instead.</p>
<p dir="ltr">Jeff</p>
<div class="gmail_quote">On 03/11/2014 9:11 PM, "Stuart Douglas" <<a href="mailto:sdouglas@redhat.com">sdouglas@redhat.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">org.xnio.conduits.BufferedStreamSinkConduit is probably a good example, although it does not use writeFinal().<br>
<br>
Stuart<br>
<br>
----- Original Message -----<br>
> From: "Stuart Douglas" <<a href="mailto:sdouglas@redhat.com">sdouglas@redhat.com</a>><br>
> To: "Jeff Williams" <<a href="mailto:jeffw@wherethebitsroam.com">jeffw@wherethebitsroam.com</a>><br>
> Cc: <a href="mailto:undertow-dev@lists.jboss.org">undertow-dev@lists.jboss.org</a><br>
> Sent: Tuesday, 4 November, 2014 7:10:53 AM<br>
> Subject: Re: [undertow-dev] AbstractFixedLengthStreamSinkConduit<br>
><br>
> You need to not pass on the terminateWrites() call to the delegate until your<br>
> have written all your data.<br>
><br>
> Once terminateWrites is called on your channel set some kind of boolean flag<br>
> to indicate that this is shutdown, and then when the user calls flush()<br>
> write out the buffer (using writeFinal for best performance). If you are not<br>
> using writeFinal() then you need to call terminateWrites() once you succeed<br>
> in flushing, and then pass further flush calls to the delegate.<br>
><br>
> Stuart<br>
><br>
> ----- Original Message -----<br>
> > From: "Jeff Williams" <<a href="mailto:jeffw@wherethebitsroam.com">jeffw@wherethebitsroam.com</a>><br>
> > To: <a href="mailto:undertow-dev@lists.jboss.org">undertow-dev@lists.jboss.org</a><br>
> > Sent: Monday, 3 November, 2014 11:48:10 PM<br>
> > Subject: [undertow-dev] AbstractFixedLengthStreamSinkConduit<br>
> ><br>
> > Hi,<br>
> ><br>
> > I have written a StreamSinkConduit which buffers content in a pooled<br>
> > buffer.<br>
> > I am having an issue with AbstractFixedLengthStreamSinkConduit throwing a<br>
> > FixedLengthUnderflowException exception.<br>
> ><br>
> > If I have content left in my buffer which I have not yet been able to write<br>
> > to the next conduit when terminateWrites is called, the exception is<br>
> > thrown.<br>
> > Even though this content would have been written in the subsequent call to<br>
> > flush. Shouldn't the bytes remaining be checked after a successful flush<br>
> > rather than in terminateWrites? Or am I missing something?<br>
> ><br>
> > For the time being I am flushing my local buffer in terminateWrites, but<br>
> > this<br>
> > seems wrong!<br>
> ><br>
> > Jeff<br>
> ><br>
> > _______________________________________________<br>
> > undertow-dev mailing list<br>
> > <a href="mailto:undertow-dev@lists.jboss.org">undertow-dev@lists.jboss.org</a><br>
> > <a href="https://lists.jboss.org/mailman/listinfo/undertow-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/undertow-dev</a><br>
</blockquote></div>