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.
org.xnio.conduits.BufferedStreamSinkConduit is probably a good example, although it does not use writeFinal().
----- Original Message -----
> From: "Stuart Douglas" <email@example.com>
> To: "Jeff Williams" <firstname.lastname@example.org>
> Cc: email@example.com
> Sent: Tuesday, 4 November, 2014 7:10:53 AM
> Subject: Re: [undertow-dev] AbstractFixedLengthStreamSinkConduit
> You need to not pass on the terminateWrites() call to the delegate until your
> have written all your data.
> Once terminateWrites is called on your channel set some kind of boolean flag
> to indicate that this is shutdown, and then when the user calls flush()
> write out the buffer (using writeFinal for best performance). If you are not
> using writeFinal() then you need to call terminateWrites() once you succeed
> in flushing, and then pass further flush calls to the delegate.
> ----- Original Message -----
> > From: "Jeff Williams" <firstname.lastname@example.org>
> > To: email@example.com
> > Sent: Monday, 3 November, 2014 11:48:10 PM
> > Subject: [undertow-dev] AbstractFixedLengthStreamSinkConduit
> > Hi,
> > I have written a StreamSinkConduit which buffers content in a pooled
> > buffer.
> > I am having an issue with AbstractFixedLengthStreamSinkConduit throwing a
> > FixedLengthUnderflowException exception.
> > If I have content left in my buffer which I have not yet been able to write
> > to the next conduit when terminateWrites is called, the exception is
> > thrown.
> > Even though this content would have been written in the subsequent call to
> > flush. Shouldn't the bytes remaining be checked after a successful flush
> > rather than in terminateWrites? Or am I missing something?
> > For the time being I am flushing my local buffer in terminateWrites, but
> > this
> > seems wrong!
> > Jeff
> > _______________________________________________
> > undertow-dev mailing list
> > firstname.lastname@example.org
> > https://lists.jboss.org/mailman/listinfo/undertow-dev