Commit 808a9e5f authored by Simon Morlat's avatar Simon Morlat

rewrite DNS resolver partly, to kill a bug regarding SRV+A resolution not terminating.

Also, A resolution following SRV results now takes place in parallel.
parent e641faf7
......@@ -110,7 +110,10 @@ BELLE_SIP_DECLARE_TYPES_BEGIN(belle_sip,1)
BELLE_SIP_TYPE_ID(belle_sip_header_p_preferred_identity_t),
BELLE_SIP_TYPE_ID(belle_sip_header_privacy_t),
BELLE_SIP_TYPE_ID(belle_sip_certificates_chain_t),
BELLE_SIP_TYPE_ID(belle_sip_signing_key_t)
BELLE_SIP_TYPE_ID(belle_sip_signing_key_t),
BELLE_SIP_TYPE_ID(belle_sip_dns_srv_t),
BELLE_SIP_TYPE_ID(belle_sip_simple_resolver_context_t),
BELLE_SIP_TYPE_ID(belle_sip_combined_resolver_context_t)
BELLE_SIP_DECLARE_TYPES_END
......
......@@ -250,6 +250,8 @@ BELLE_SIP_END_DECLS
#define BELLE_SIP_OBJECT(obj) BELLE_SIP_CAST(obj,belle_sip_object_t)
#define BELLE_SIP_OBJECT_IS_INSTANCE_OF(obj,_type) _belle_sip_object_is_instance_of((belle_sip_object_t*)obj,_type##_id)
#define BELLE_SIP_OBJECT_VPTR(obj,object_type) ((BELLE_SIP_OBJECT_VPTR_TYPE(object_type)*)(((belle_sip_object_t*)obj)->vptr))
/*deprecated*/
#define BELLE_SIP_IS_INSTANCE_OF(obj,_type) BELLE_SIP_OBJECT_IS_INSTANCE_OF(obj,_type)
......@@ -339,5 +341,50 @@ void belle_sip_object_pool_clean(belle_sip_object_pool_t *obj);
BELLE_SIP_END_DECLS
/**
* Adding a new type in belle-sip in 5 steps
* =========================================
*
* Let's suppose you want to add an object called belle_sip_something_t
* 1) Declare the type in the enum in belle-sip.h:
* BELLE_SIP_TYPE_ID(belle_sip_something_t)
* 2) Declare the api of the new object in .h, including a typedef and a cast macro:
* typedef struct belle_sip_something belle_sip_something_t;
* #define BELLE_SIP_SOMETHING(obj) BELLE_SIP_CAST(obj,belle_sip_something_t)
*
* belle_sip_something_t *belle_sip_something_create(int arg1, int arg2);
* void belle_sip_something_do_cooking(belle_sip_something_t *obj);
* Do not add any destructor, belle_sip_object_unref() does it for all objects.
*
* 3) in the c file contaning the object's implementation, define the internal structure for your object.
* The first field of the struct must be the parent type.
* struct belle_sip_something{
* belle_sip_object_t base;
* int myint1;
* int myint2;
* char *mychar;
* };
* 4) still in the C file contaning the object's implementation, define a destructor and all functions of its API:
* The destructor must only manage the fields from the type, not the parent.
* static void belle_sip_something_destroy(belle_sip_something_t *obj){
* if (obj->mychar) belle_sip_free(obj->mychar);
* }
*
* belle_sip_something_t *belle_sip_something_create(int arg1, int arg2){
* belle_sip_something_t *obj=belle_sip_object_new(belle_sip_something_t);
* obj->myint1=arg1;
* obj->myint2=arg2;
* obj->mychar=belle_sip_strdup("Hello world");
* return obj;
* }
* Declare the interfaces implemented by the object (to be documented) and instanciate its "vptr", necessary for dynamic casting.
* BELLE_SIP_DECLARE_NO_IMPLEMENTED_INTERFACES(belle_sip_something_t);
* BELLE_SIP_INSTANCIATE_VPTR(belle_sip_something_t, belle_sip_object_t,belle_sip_something_destroy, NULL, NULL,FALSE);
*
* 5) in .h file included everywhere in the source (typically belle_sip_internal.h), declare the vptr
* BELLE_SIP_DECLARE_VPTR(belle_sip_dns_srv_t);
*/
#endif
......@@ -21,11 +21,12 @@
#define belle_sip_resolver_h
typedef struct belle_sip_resolver_context belle_sip_resolver_context_t;
typedef struct belle_sip_dns_srv belle_sip_dns_srv_t;
#define BELLE_SIP_DNS_SRV(obj) BELLE_SIP_CAST(obj,belle_sip_dns_srv_t)
typedef struct belle_sip_resolver_context belle_sip_resolver_context_t;
#define BELLE_SIP_RESOLVER_CONTEXT(obj) BELLE_SIP_CAST(obj,belle_sip_resolver_context_t)
/**
* Callback prototype for asynchronous DNS SRV resolution.
* The srv_list contains struct dns_srv elements that must be taken and (possibly later) freed by the callee, using belle_sip_free().
......@@ -39,14 +40,45 @@ typedef void (*belle_sip_resolver_srv_callback_t)(void *data, const char *name,
**/
typedef void (*belle_sip_resolver_callback_t)(void *data, const char *name, struct addrinfo *ai_list);
BELLE_SIP_BEGIN_DECLS
int belle_sip_addrinfo_to_ip(const struct addrinfo *ai, char *ip, size_t ip_size, int *port);
BELLESIP_EXPORT const char *belle_sip_dns_srv_get_target(const belle_sip_dns_srv_t *obj);
BELLESIP_EXPORT unsigned short belle_sip_dns_srv_get_priority(const belle_sip_dns_srv_t *obj);
BELLESIP_EXPORT unsigned short belle_sip_dns_srv_get_weight(const belle_sip_dns_srv_t *obj);
BELLESIP_EXPORT unsigned short belle_sip_dns_srv_get_port(const belle_sip_dns_srv_t *obj);
BELLESIP_EXPORT int belle_sip_addrinfo_to_ip(const struct addrinfo *ai, char *ip, size_t ip_size, int *port);
BELLESIP_EXPORT struct addrinfo * belle_sip_ip_address_to_addrinfo(int family, const char *ipaddress, int port);
BELLESIP_EXPORT unsigned long belle_sip_stack_resolve(belle_sip_stack_t *stack, const char *transport, const char *name, int port, int family, belle_sip_resolver_callback_t cb, void *data);
BELLESIP_EXPORT unsigned long belle_sip_stack_resolve_a(belle_sip_stack_t *stack, const char *name, int port, int family, belle_sip_resolver_callback_t cb, void *data);
BELLESIP_EXPORT unsigned long belle_sip_stack_resolve_srv(belle_sip_stack_t *stack, const char *name, const char *transport, belle_sip_resolver_srv_callback_t cb, void *data);
BELLESIP_EXPORT void belle_sip_stack_resolve_cancel(belle_sip_stack_t *stack, unsigned long id);
/**
* Asynchronously performs DNS SRV followed A or AAAA query. Automatically fallbacks to A or AAAA if SRV isn't found.
* @return a #belle_sip_resolver_context_t that can be used to cancel the resolution if needed. The context must have been ref'd with belle_sip_object_ref().
**/
BELLESIP_EXPORT belle_sip_resolver_context_t * belle_sip_stack_resolve(belle_sip_stack_t *stack, const char *transport, const char *name, int port, int family,
belle_sip_resolver_callback_t cb, void *data);
/**
* Asynchronously performs DNS A or AAAA query.
* @return a #belle_sip_resolver_context_t that can be used to cancel the resolution if needed. The context must have been ref'd with belle_sip_object_ref().
**/
BELLESIP_EXPORT belle_sip_resolver_context_t * belle_sip_stack_resolve_a(belle_sip_stack_t *stack, const char *name, int port, int family, belle_sip_resolver_callback_t cb, void *data);
/**
* Asynchronously performs DNS SRV query.
* @return a #belle_sip_resolver_context_t that can be used to cancel the resolution if needed. The context must have been ref'd with belle_sip_object_ref().
**/
BELLESIP_EXPORT belle_sip_resolver_context_t * belle_sip_stack_resolve_srv(belle_sip_stack_t *stack, const char *transport, const char *name, belle_sip_resolver_srv_callback_t cb, void *data);
/**
* Cancel a pending asynchronous DNS query. The context is unref'd automatically, as a result the context shall no longer be used after this call.
* If the query is already performed, cancellation has no effect, but context is unref'd anyway.
**/
BELLESIP_EXPORT void belle_sip_resolver_context_cancel(belle_sip_resolver_context_t *ctx);
/**
* Lookups the source address from local interface that can be used to connect to a destination address.
......
......@@ -32,11 +32,14 @@ GET_SET_STRING(belle_sip_auth_event,distinguished_name)
belle_sip_auth_event_t* belle_sip_auth_event_create(const char* realm, const belle_sip_header_from_t *from) {
belle_sip_auth_event_t* result = belle_sip_new0(belle_sip_auth_event_t);
belle_sip_uri_t *uri=belle_sip_header_address_get_uri(BELLE_SIP_HEADER_ADDRESS(from));
belle_sip_auth_event_set_realm(result,realm);
belle_sip_auth_event_set_username(result,belle_sip_uri_get_user(uri));
belle_sip_auth_event_set_domain(result,belle_sip_uri_get_host(uri));
if (from){
belle_sip_uri_t *uri=belle_sip_header_address_get_uri(BELLE_SIP_HEADER_ADDRESS(from));
belle_sip_auth_event_set_username(result,belle_sip_uri_get_user(uri));
belle_sip_auth_event_set_domain(result,belle_sip_uri_get_host(uri));
}
return result;
}
......
......@@ -120,8 +120,6 @@ void belle_sip_object_delete(void *obj);
void belle_sip_object_pool_add(belle_sip_object_pool_t *pool, belle_sip_object_t *obj);
void belle_sip_object_pool_remove(belle_sip_object_pool_t *pool, belle_sip_object_t *obj);
#define BELLE_SIP_OBJECT_VPTR(obj,object_type) ((BELLE_SIP_OBJECT_VPTR_TYPE(object_type)*)(((belle_sip_object_t*)obj)->vptr))
#define belle_sip_object_init(obj) /*nothing*/
......@@ -132,7 +130,6 @@ BELLE_SIP_DECLARE_VPTR(belle_sip_datagram_listening_point_t);
BELLE_SIP_DECLARE_VPTR(belle_sip_provider_t);
BELLE_SIP_DECLARE_VPTR(belle_sip_main_loop_t);
BELLE_SIP_DECLARE_VPTR(belle_sip_source_t);
BELLE_SIP_DECLARE_VPTR(belle_sip_resolver_context_t);
BELLE_SIP_DECLARE_VPTR(belle_sip_dialog_t);
BELLE_SIP_DECLARE_VPTR(belle_sip_header_address_t);
BELLE_SIP_DECLARE_VPTR(belle_sip_header_contact_t);
......@@ -192,11 +189,20 @@ BELLE_SIP_DECLARE_VPTR(belle_sip_header_p_preferred_identity_t);
BELLE_SIP_DECLARE_VPTR(belle_sip_header_privacy_t);
BELLE_SIP_DECLARE_VPTR(belle_sip_certificates_chain_t);
BELLE_SIP_DECLARE_VPTR(belle_sip_signing_key_t);
BELLE_SIP_DECLARE_VPTR(belle_sip_dns_srv_t);
typedef void (*belle_sip_source_remove_callback_t)(belle_sip_source_t *);
BELLE_SIP_DECLARE_CUSTOM_VPTR_BEGIN(belle_sip_resolver_context_t,belle_sip_source_t)
void (*cancel)(belle_sip_resolver_context_t *);
BELLE_SIP_DECLARE_CUSTOM_VPTR_END
BELLE_SIP_DECLARE_CUSTOM_VPTR_BEGIN(belle_sip_simple_resolver_context_t,belle_sip_resolver_context_t)
BELLE_SIP_DECLARE_CUSTOM_VPTR_END
BELLE_SIP_DECLARE_CUSTOM_VPTR_BEGIN(belle_sip_combined_resolver_context_t,belle_sip_resolver_context_t)
BELLE_SIP_DECLARE_CUSTOM_VPTR_END
typedef void (*belle_sip_source_remove_callback_t)(belle_sip_source_t *);
struct belle_sip_source{
belle_sip_object_t base;
......
......@@ -154,7 +154,7 @@ static void belle_sip_source_destroy(belle_sip_source_t *obj){
static void belle_sip_source_init(belle_sip_source_t *s, belle_sip_source_func_t func, void *data, belle_sip_fd_t fd, unsigned int events, unsigned int timeout_value_ms){
static unsigned long global_id=1;
s->node.data=s;
s->id=global_id++;
if (s->id==0) s->id=global_id++;
s->fd=fd;
s->events=events;
s->timeout=timeout_value_ms;
......
This diff is collapsed.
......@@ -60,7 +60,7 @@ static void belle_sip_channel_destroy(belle_sip_channel_t *obj){
belle_sip_free(obj->peer_name);
if (obj->local_ip) belle_sip_free(obj->local_ip);
obj->listeners=for_each_weak_unref_free(obj->listeners,(belle_sip_object_destroy_notify_t)belle_sip_channel_remove_listener,obj);
if (obj->resolver_id>0) belle_sip_stack_resolve_cancel(obj->stack,obj->resolver_id);
if (obj->resolver_ctx>0) belle_sip_resolver_context_cancel(obj->resolver_ctx);
if (obj->inactivity_timer){
belle_sip_main_loop_remove_source(obj->stack->ml,obj->inactivity_timer);
belle_sip_object_unref(obj->inactivity_timer);
......@@ -723,23 +723,26 @@ void belle_sip_channel_set_ready(belle_sip_channel_t *obj, const struct sockaddr
static void channel_res_done(void *data, const char *name, struct addrinfo *ai_list){
belle_sip_channel_t *obj=(belle_sip_channel_t*)data;
obj->resolver_id=0;
if (obj->resolver_ctx){
belle_sip_object_unref(obj->resolver_ctx);
obj->resolver_ctx=NULL;
}
if (ai_list){
obj->peer_list=obj->current_peer=ai_list;
channel_set_state(obj,BELLE_SIP_CHANNEL_RES_DONE);
channel_prepare_continue(obj);
}else{
belle_sip_error("%s: Resolution done but no result", __FUNCTION__);
belle_sip_error("%s: DNS resolution failed", __FUNCTION__);
channel_set_state(obj,BELLE_SIP_CHANNEL_ERROR);
}
}
void belle_sip_channel_resolve(belle_sip_channel_t *obj){
channel_set_state(obj,BELLE_SIP_CHANNEL_RES_IN_PROGRESS);
//obj->resolver_id=belle_sip_stack_resolve(obj->stack, belle_sip_channel_get_transport_name_lower_case(obj), obj->peer_name, obj->peer_port, obj->lp->ai_family, channel_res_done, obj);
obj->resolver_id=belle_sip_stack_resolve_a(obj->stack, obj->peer_name, obj->peer_port, obj->lp->ai_family, channel_res_done, obj);
if (obj->resolver_id==-1){
channel_set_state(obj,BELLE_SIP_CHANNEL_ERROR);
obj->resolver_ctx=belle_sip_stack_resolve(obj->stack, belle_sip_channel_get_transport_name_lower_case(obj), obj->peer_name, obj->peer_port, obj->lp->ai_family, channel_res_done, obj);
//obj->resolver_ctx=belle_sip_stack_resolve_a(obj->stack, obj->peer_name, obj->peer_port, obj->lp->ai_family, channel_res_done, obj);
if (obj->resolver_ctx){
belle_sip_object_ref(obj->resolver_ctx);
}
return ;
}
......
......@@ -87,7 +87,7 @@ struct belle_sip_channel{
int local_port;
char *public_ip;
int public_port;
unsigned long resolver_id;
belle_sip_resolver_context_t* resolver_ctx;
struct addrinfo *peer_list;
struct addrinfo *current_peer;
belle_sip_list_t *outgoing_messages;
......
......@@ -21,7 +21,6 @@
#include "belle-sip/belle-sip.h"
#include "belle_sip_internal.h"
#include "belle_sip_tester.h"
#include "dns.h"
#define IPV4_SIP_DOMAIN "sip.linphone.org"
......@@ -36,7 +35,7 @@
typedef struct endpoint {
belle_sip_stack_t* stack;
long unsigned int resolver_id;
belle_sip_resolver_context_t *resolver_ctx;
int resolve_done;
int resolve_ko;
struct addrinfo *ai_list;
......@@ -64,7 +63,7 @@ static endpoint_t* create_endpoint() {
}
static void reset_endpoint(endpoint_t *endpoint) {
endpoint->resolver_id = 0;
endpoint->resolver_ctx = 0;
endpoint->resolve_done = 0;
endpoint->resolve_ko = 0;
if (endpoint->ai_list != NULL) {
......@@ -72,8 +71,7 @@ static void reset_endpoint(endpoint_t *endpoint) {
endpoint->ai_list = NULL;
}
if (endpoint->srv_list != NULL) {
belle_sip_list_for_each(endpoint->srv_list, belle_sip_free);
belle_sip_list_free(endpoint->srv_list);
belle_sip_list_free_with_data(endpoint->srv_list, belle_sip_object_unref);
endpoint->srv_list = NULL;
}
}
......@@ -115,8 +113,8 @@ static void ipv4_a_query(void) {
CU_ASSERT_PTR_NOT_NULL_FATAL(client);
timeout = belle_sip_stack_get_dns_timeout(client->stack);
client->resolver_id = belle_sip_stack_resolve_a(client->stack, IPV4_SIP_DOMAIN, SIP_PORT, AF_INET, a_resolve_done, client);
CU_ASSERT_NOT_EQUAL(client->resolver_id, 0);
client->resolver_ctx = belle_sip_stack_resolve_a(client->stack, IPV4_SIP_DOMAIN, SIP_PORT, AF_INET, a_resolve_done, client);
CU_ASSERT_NOT_EQUAL(client->resolver_ctx, NULL);
CU_ASSERT_TRUE(wait_for(client->stack, &client->resolve_done, 1, timeout));
CU_ASSERT_PTR_NOT_EQUAL(client->ai_list, NULL);
if (client->ai_list) {
......@@ -139,8 +137,8 @@ static void ipv4_a_query_no_result(void) {
CU_ASSERT_PTR_NOT_NULL_FATAL(client);
timeout = belle_sip_stack_get_dns_timeout(client->stack);
client->resolver_id = belle_sip_stack_resolve_a(client->stack, IPV4_SIP_BAD_DOMAIN, SIP_PORT, AF_INET, a_resolve_done, client);
CU_ASSERT_NOT_EQUAL(client->resolver_id, 0);
client->resolver_ctx = belle_sip_stack_resolve_a(client->stack, IPV4_SIP_BAD_DOMAIN, SIP_PORT, AF_INET, a_resolve_done, client);
CU_ASSERT_NOT_EQUAL(client->resolver_ctx, NULL);
CU_ASSERT_TRUE(wait_for(client->stack, &client->resolve_done, 1, timeout));
CU_ASSERT_PTR_EQUAL(client->ai_list, NULL);
......@@ -153,8 +151,8 @@ static void ipv4_a_query_send_failure(void) {
CU_ASSERT_PTR_NOT_NULL_FATAL(client);
belle_sip_stack_set_resolver_send_error(client->stack, -1);
client->resolver_id = belle_sip_stack_resolve_a(client->stack, IPV4_SIP_DOMAIN, SIP_PORT, AF_INET, a_resolve_done, client);
CU_ASSERT_EQUAL(client->resolver_id, 0);
client->resolver_ctx = belle_sip_stack_resolve_a(client->stack, IPV4_SIP_DOMAIN, SIP_PORT, AF_INET, a_resolve_done, client);
CU_ASSERT_EQUAL(client->resolver_ctx, NULL);
belle_sip_stack_set_resolver_send_error(client->stack, 0);
destroy_endpoint(client);
......@@ -167,8 +165,8 @@ static void ipv4_a_query_timeout(void) {
CU_ASSERT_PTR_NOT_NULL_FATAL(client);
belle_sip_stack_set_dns_timeout(client->stack, 0);
client->resolver_id = belle_sip_stack_resolve_a(client->stack, "toto.com", SIP_PORT, AF_INET, a_resolve_done, client);
CU_ASSERT_NOT_EQUAL(client->resolver_id, 0);
client->resolver_ctx = belle_sip_stack_resolve_a(client->stack, "toto.com", SIP_PORT, AF_INET, a_resolve_done, client);
CU_ASSERT_NOT_EQUAL(client->resolver_ctx, NULL);
CU_ASSERT_TRUE(wait_for(client->stack, &client->resolve_done, 1, 200));
CU_ASSERT_PTR_EQUAL(client->ai_list, NULL);
CU_ASSERT_EQUAL(client->resolve_ko,1);
......@@ -182,8 +180,8 @@ static void ipv4_a_query_multiple_results(void) {
CU_ASSERT_PTR_NOT_NULL_FATAL(client);
timeout = belle_sip_stack_get_dns_timeout(client->stack);
client->resolver_id = belle_sip_stack_resolve_a(client->stack, IPV4_MULTIRES_DOMAIN, SIP_PORT, AF_INET, a_resolve_done, client);
CU_ASSERT_NOT_EQUAL(client->resolver_id, 0);
client->resolver_ctx = belle_sip_stack_resolve_a(client->stack, IPV4_MULTIRES_DOMAIN, SIP_PORT, AF_INET, a_resolve_done, client);
CU_ASSERT_NOT_EQUAL(client->resolver_ctx, NULL);
CU_ASSERT_TRUE(wait_for(client->stack, &client->resolve_done, 1, timeout));
CU_ASSERT_PTR_NOT_EQUAL(client->ai_list, NULL);
if (client->ai_list) {
......@@ -201,8 +199,8 @@ static void ipv6_aaaa_query(void) {
CU_ASSERT_PTR_NOT_NULL_FATAL(client);
timeout = belle_sip_stack_get_dns_timeout(client->stack);
client->resolver_id = belle_sip_stack_resolve_a(client->stack, IPV6_SIP_DOMAIN, SIP_PORT, AF_INET6, a_resolve_done, client);
CU_ASSERT_NOT_EQUAL(client->resolver_id, 0);
client->resolver_ctx = belle_sip_stack_resolve_a(client->stack, IPV6_SIP_DOMAIN, SIP_PORT, AF_INET6, a_resolve_done, client);
CU_ASSERT_NOT_EQUAL(client->resolver_ctx, NULL);
CU_ASSERT_TRUE(wait_for(client->stack, &client->resolve_done, 1, timeout));
CU_ASSERT_PTR_NOT_EQUAL(client->ai_list, NULL);
if (client->ai_list) {
......@@ -229,14 +227,14 @@ static void srv_query(void) {
CU_ASSERT_PTR_NOT_NULL_FATAL(client);
timeout = belle_sip_stack_get_dns_timeout(client->stack);
client->resolver_id = belle_sip_stack_resolve_srv(client->stack, SRV_DOMAIN, "udp", srv_resolve_done, client);
CU_ASSERT_NOT_EQUAL(client->resolver_id, 0);
client->resolver_ctx = belle_sip_stack_resolve_srv(client->stack, "udp", SRV_DOMAIN, srv_resolve_done, client);
CU_ASSERT_NOT_EQUAL(client->resolver_ctx, NULL);
CU_ASSERT_TRUE(wait_for(client->stack, &client->resolve_done, 1, timeout));
CU_ASSERT_PTR_NOT_EQUAL(client->srv_list, NULL);
CU_ASSERT_NOT_EQUAL(belle_sip_list_size(client->srv_list), 0);
if (client->srv_list && (belle_sip_list_size(client->srv_list) > 0)) {
struct dns_srv *result_srv = belle_sip_list_nth_data(client->srv_list, 0);
CU_ASSERT_EQUAL(result_srv->port, SIP_PORT);
belle_sip_dns_srv_t *result_srv = belle_sip_list_nth_data(client->srv_list, 0);
CU_ASSERT_EQUAL(belle_sip_dns_srv_get_port(result_srv), SIP_PORT);
}
destroy_endpoint(client);
......@@ -249,8 +247,8 @@ static void srv_a_query(void) {
CU_ASSERT_PTR_NOT_NULL_FATAL(client);
timeout = belle_sip_stack_get_dns_timeout(client->stack);
client->resolver_id = belle_sip_stack_resolve(client->stack, "udp", SRV_DOMAIN, SIP_PORT, AF_INET, a_resolve_done, client);
CU_ASSERT_NOT_EQUAL(client->resolver_id, 0);
client->resolver_ctx = belle_sip_stack_resolve(client->stack, "udp", SRV_DOMAIN, SIP_PORT, AF_INET, a_resolve_done, client);
CU_ASSERT_NOT_EQUAL(client->resolver_ctx, NULL);
CU_ASSERT_TRUE(wait_for(client->stack, &client->resolve_done, 1, timeout));
CU_ASSERT_PTR_NOT_EQUAL(client->ai_list, NULL);
......@@ -265,8 +263,8 @@ static void srv_a_query_no_srv_result(void) {
CU_ASSERT_PTR_NOT_NULL_FATAL(client);
timeout = belle_sip_stack_get_dns_timeout(client->stack);
client->resolver_id = belle_sip_stack_resolve(client->stack, "udp", IPV4_SIP_DOMAIN, SIP_PORT, AF_INET, a_resolve_done, client);
CU_ASSERT_NOT_EQUAL(client->resolver_id, 0);
client->resolver_ctx = belle_sip_stack_resolve(client->stack, "udp", IPV4_SIP_DOMAIN, SIP_PORT, AF_INET, a_resolve_done, client);
CU_ASSERT_NOT_EQUAL(client->resolver_ctx, NULL);
CU_ASSERT_TRUE(wait_for(client->stack, &client->resolve_done, 1, timeout));
CU_ASSERT_PTR_NOT_EQUAL(client->ai_list, NULL);
if (client->ai_list) {
......@@ -288,8 +286,8 @@ static void no_query_needed(void) {
endpoint_t *client = create_endpoint();
CU_ASSERT_PTR_NOT_NULL_FATAL(client);
client->resolver_id = belle_sip_stack_resolve(client->stack, "udp", IPV4_SIP_IP, SIP_PORT, AF_INET, a_resolve_done, client);
CU_ASSERT_EQUAL(client->resolver_id, 0);
client->resolver_ctx = belle_sip_stack_resolve(client->stack, "udp", IPV4_SIP_IP, SIP_PORT, AF_INET, a_resolve_done, client);
CU_ASSERT_EQUAL(client->resolver_ctx, NULL);
CU_ASSERT_TRUE(client->resolve_done);
CU_ASSERT_PTR_NOT_EQUAL(client->ai_list, NULL);
if (client->ai_list) {
......
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