Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cf-dev] Contiki Erbium, Californium Proxy, Block2 transfer timed out

Hello,

Im using the Contiki OS on some nodes.
Because i need to do some translations between certain Content-Formats i want to use a californium proxy.

For client software i'm using Copper.

I use the example code for a blockwise transfer GET request from Contiki and the example proxy from californium.

The data is correctly shown in Copper, but i get a time out message on the proxy.

Nov 09, 2015 11:59:45 AM org.eclipse.californium.core.network.config.NetworkConfig createStandardWithFile
INFO: Loading standard properties from file Californium.properties
Nov 09, 2015 11:59:45 AM org.eclipse.californium.core.CoapServer start
INFO: Starting server
Nov 09, 2015 11:59:45 AM org.eclipse.californium.core.network.CoapEndpoint start
INFO: Starting endpoint at 0.0.0.0/0.0.0.0:5683
Nov 09, 2015 12:00:10 PM be.ugent.translator.Translator getRequest
INFO: Forwarding request to coap://[aaaa::c30c:0:0:2]/wishful_control/
Nov 09, 2015 12:00:10 PM org.eclipse.californium.core.network.CoapEndpoint start
INFO: Starting endpoint at 0.0.0.0/0.0.0.0:0
Nov 09, 2015 12:00:10 PM org.eclipse.californium.core.network.EndpointManager createDefaultEndpoint
INFO: Created implicit default endpoint 0.0.0.0/0.0.0.0:48414
Nov 09, 2015 12:00:10 PM be.ugent.resource.ReverseResource forwardRequest
INFO: Proxy received a Coap response.
Nov 09, 2015 12:00:25 PM org.eclipse.californium.core.network.stack.BlockwiseLayer$BlockCleanupTask run
INFO: Block2 transfer timed out: CON-GET    MID=19113, Token=98a2ed, OptionSet={"Uri-Path":"wishful_control"}, no payload




This is the console output from Copper :


INFO: Storing transaction 48699
=sending CoAP message===
 Type: Confirmable
 Code: GET
 Message ID: 48699
 Options:
  Uri-Path: node2/wishful_control [21]
 =======================
-sent UDP datagram------
 Length: 27
 -----------------------
-receiving UDP datagram-
 Length: 4
 -----------------------
=received CoAP message==
 Type: Acknowledgment
 Code: EMPTY
 Message ID: 48699
 =======================
INFO: Closing message 48699
INFO: defaultHandler()
-receiving UDP datagram-
 Length: 37
 -----------------------
=received CoAP message==
 Type: Confirmable
 Code: 2.05 Content
 Message ID: 20425
 Payload: 32 bytes
abcdefghijklmnopqrstuvwxyz012345
 =======================
INFO: Incoming separate reponse (Token: null)
=sending CoAP message===
 Type: Acknowledgment
 Code: EMPTY
 Message ID: 20425
 =======================
-sent UDP datagram------
 Length: 4
 -----------------------
INFO: defaultHandler()


The resource get_handler implementation : 

static void
res_get_handler(void *request, void *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset){
const char *msg = "abcdefghijklmnopqrstuvwxyz012345";
printf("offset1 = %d\n",*offset);
/* Check the offset for boundaries of the resource data. */
if(*offset >= 32) {
REST.set_response_status(response, REST.status.BAD_OPTION);
/* A block error message should not exceed the minimum block size (16). */
const char *error_msg = "BlockOutOfScope";
REST.set_response_payload(response, error_msg, strlen(error_msg));
return;
}

REST.set_response_payload(response, msg + *offset ,preferred_size);

/* IMPORTANT for chunk-wise resources: Signal chunk awareness to REST engine. */
*offset += preferred_size;
printf("offset2 = %d\n",*offset);
/* Signal end of resource representation. */
if(*offset >= strlen(msg)) {
*offset = -1;
}
}

Output in Cooja : 

34:43.394 ID:2 offset1 = 0
34:43.395 ID:2 offset2 = 16
34:44.273 ID:2 offset1 = 16
34:44.274 ID:2 offset2 = 32


Anybody that can help me understand why there is a time out on the proxy?

This is my idea : 


protected class BlockCleanupTask implements Runnable {
private Exchange exchange;
public BlockCleanupTask(Exchange exchange) {
this.exchange = exchange;
}
@Override
public void run() {
if (exchange.getRequest()==null) {
LOGGER.info("Block1 transfer timed out: " + exchange.getCurrentRequest());
} else {
LOGGER.info("Block2 transfer timed out: " + exchange.getRequest());
}
exchange.setComplete();
}
}


The blockwise tranfser is completed successfully ( cause the Copper client receives the data ), but the exchange is not closed?
The problem is that i don't know if the issue is in Erbium or in Californium. 

Any thoughts would be greatly appreciated.

Greets

Jo

Back to the top