Commit 00e7e2ba authored by Olaf Bergmann's avatar Olaf Bergmann

Check for LIBCOAP_VERSION >= 4.3

Starting with libcoap release 4.3.0, the pre-preprocessor symbol
LIBCOAP_VERSION indicates the current library version number as
9-digit number. This is used here to check if coap_run_once()
or coap_io_process() needs to called.
parent b6ea20fe
......@@ -345,7 +345,11 @@ handle_ticket_transfer(dcaf_context_t *dcaf_context,
dcaf_transaction_update(t->state.future, session, pdu);
coap_send(session, pdu);
while (!done) {
#if !defined(LIBCOAP_VERSION) || (LIBCOAP_VERSION < 4003000)
coap_run_once(ctx, 0);
#else /* LIBCOAP_VERSION >= 4003000 */
coap_io_process(ctx, COAP_IO_WAIT);
#endif /* LIBCOAP_VERSION >= 4003000 */
done = dcaf_check_transaction(dcaf_context, t->state.future)
&& (t->state.future->state.act == DCAF_STATE_IDLE);
}
......
......@@ -348,7 +348,11 @@ dcaf_send_request_uri(dcaf_context_t *dcaf_context,
/* Store remote address in transaction object. We need to adjust the
* port to switch to DTLS later. */
#if !defined(LIBCOAP_VERSION) || (LIBCOAP_VERSION < 4003000)
coap_address_copy(&t->remote, &session->remote_addr);
#else /* LIBCOAP_VERSION >= 4003000 */
coap_address_copy(&t->remote, &session->addr_info.remote);
#endif /* LIBCOAP_VERSION >= 4003000 */
if (!coap_uri_scheme_is_secure(uri)) {
uint16_t port = dcaf_get_coap_port(&t->remote);
dcaf_set_coap_port(&t->remote, port ? port + 1 : COAPS_DEFAULT_PORT);
......@@ -368,7 +372,11 @@ dcaf_send_request_uri(dcaf_context_t *dcaf_context,
/* coap_io_process() returns the time in milliseconds it has
* spent. We use this value to determine if we have run out of
* time. */
#if !defined(LIBCOAP_VERSION) || (LIBCOAP_VERSION < 4003000)
result = coap_run_once(ctx, timeout);
#else /* LIBCOAP_VERSION >= 4003000 */
result = coap_io_process(ctx, timeout);
#endif /* LIBCOAP_VERSION >= 4003000 */
dcaf_log(DCAF_LOG_DEBUG, "coap_run_once returns %d\n", result);
if (result < 0) { /* error */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment