[undertow-dev] AbstractFixedLengthStreamSinkConduit

Stuart Douglas sdouglas at redhat.com
Mon Nov 3 15:10:53 EST 2014


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. 

Stuart

----- Original Message -----
> From: "Jeff Williams" <jeffw at wherethebitsroam.com>
> To: undertow-dev at lists.jboss.org
> 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
> undertow-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/undertow-dev


More information about the undertow-dev mailing list