// TODO somehow connect the cancel back to netsession
@Override
	public void offer(HttpContent chunk) {
		if (this.channel.isClosed())
			return;		// TODO somehow connect the cancel back to netsession 
		if (chunk.content().readableBytes() > this.max) {
			this.channel.abort();		// TODO somehow connect the cancel back to netsession
			return;
		}
		ByteBuf bb = chunk.content();
		bb.retain();		// we will use it in upcoming send
		System.out.println("ref count a: " + bb.refCnt());
		StreamMessage b = new StreamMessage("Block", bb);
		b.setField("Sequence", this.seq);
		OperationResult or = this.channel.send(b);
		// bb should now be back to 1
		System.out.println("ref count b: " + bb.refCnt());
		if (or.hasErrors()) {
			this.channel.close();
			return;
		}
		this.seq++;
		// TODO track progress if possible
		// final only if not canceled
		if (chunk instanceof LastHttpContent)
			this.channel.send(MessageUtil.streamFinal());
	}
public void offer(HttpContent chunk) {
if (this.channel.isClosed())
return; // TODO somehow connect the cancel back to netsession
if (chunk.content().readableBytes() > this.max) {
this.channel.abort(); // TODO somehow connect the cancel back to netsession
@Override
public void offer(HttpContent chunk) {
if (this.channel.isClosed())
return; // TODO somehow connect the cancel back to netsession
if (chunk.content().readableBytes() > this.max) {
this.channel.abort(); // TODO somehow connect the cancel back to netsession
return;
}
ByteBuf bb = chunk.content();
bb.retain(); // we will use it in upcoming send
System.out.println("ref count a: " + bb.refCnt());
StreamMessage b = new StreamMessage("Block", bb);
b.setField("Sequence", this.seq);
OperationResult or = this.channel.send(b);
@Override
public void offer(HttpContent chunk) {
if (this.channel.isClosed())
return; // TODO somehow connect the cancel back to netsession
if (chunk.content().readableBytes() > this.max) {
this.channel.abort(); // TODO somehow connect the cancel back to netsession
return;
}
ByteBuf bb = chunk.content();
bb.retain(); // we will use it in upcoming send
System.out.println("ref count a: " + bb.refCnt());
StreamMessage b = new StreamMessage("Block", bb);
b.setField("Sequence", this.seq);
OperationResult or = this.channel.send(b);
// bb should now be back to 1
System.out.println("ref count b: " + bb.refCnt());
if (or.hasErrors()) {
this.channel.close();
return;
}
this.seq++;
// TODO track progress if possible
// final only if not canceled
if (chunk instanceof LastHttpContent)