Java Code Examples for org.eclipse.californium.core.network.Exchange#getResponseBlockStatus()

The following examples show how to use org.eclipse.californium.core.network.Exchange#getResponseBlockStatus() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BlockwiseLayer.java    From SI with BSD 2-Clause "Simplified" License 5 votes vote down vote up
private BlockwiseStatus findResponseBlockStatus(Exchange exchange, Response response) {
	BlockwiseStatus status = exchange.getResponseBlockStatus();
	if (status == null) {
		status = new BlockwiseStatus(response.getOptions().getContentFormat());
		status.setCurrentSzx( computeSZX(preferred_block_size) );
		exchange.setResponseBlockStatus(status);
		LOGGER.finer("There is no blockwise status yet. Create and set new Block2 status: "+status);
	} else {
		LOGGER.finer("Current Block2 status: "+status);
	}
	// sets a timeout to complete exchange
	prepareBlockCleanup(exchange);
	return status;
}
 
Example 2
Source File: BlockwiseLayer.java    From SI with BSD 2-Clause "Simplified" License 5 votes vote down vote up
private BlockwiseStatus findResponseBlockStatus(Exchange exchange, Response response) {
	BlockwiseStatus status = exchange.getResponseBlockStatus();
	if (status == null) {
		status = new BlockwiseStatus(response.getOptions().getContentFormat());
		status.setCurrentSzx( computeSZX(preferred_block_size) );
		exchange.setResponseBlockStatus(status);
		LOGGER.finer("There is no blockwise status yet. Create and set new Block2 status: "+status);
	} else {
		LOGGER.finer("Current Block2 status: "+status);
	}
	// sets a timeout to complete exchange
	prepareBlockCleanup(exchange);
	return status;
}
 
Example 3
Source File: BlockwiseLayer.java    From SI with BSD 2-Clause "Simplified" License 4 votes vote down vote up
private boolean requireBlockwise(Exchange exchange, Response response) {
	return response.getPayloadSize() > max_message_size
			|| exchange.getResponseBlockStatus() != null;
}
 
Example 4
Source File: BlockwiseLayer.java    From SI with BSD 2-Clause "Simplified" License 4 votes vote down vote up
private boolean requireBlockwise(Exchange exchange, Response response) {
	return response.getPayloadSize() > max_message_size
			|| exchange.getResponseBlockStatus() != null;
}