Commit ad267619 authored by Simon Morlat's avatar Simon Morlat

Allow receiving a message while in the RES_IN_PROGRESS state of channel.

Indeed, this state is temporarily achieved when doing DNS SRV query after DNS ttl timeout.
The previous code resulted in any message being dropped and the channel to reach ERROR state when this happened.
parent 79e7d0eb
......@@ -254,7 +254,8 @@ static int stream_channel_process_data(belle_sip_stream_channel_t *obj,unsigned
belle_sip_source_set_timeout((belle_sip_source_t*)obj,-1);
belle_sip_channel_set_ready(base,(struct sockaddr*)&ss,addrlen);
return BELLE_SIP_CONTINUE;
} else if (state == BELLE_SIP_CHANNEL_READY) {
} else if (state == BELLE_SIP_CHANNEL_READY || state == BELLE_SIP_CHANNEL_RES_IN_PROGRESS) {
/* Because of DNS TTL timeout, the channel may enter the RES_IN_PROGRESS state temporarily while being connected.*/
return belle_sip_channel_process_data(base,revents);
} else {
belle_sip_error("Unexpected event [%i], in state [%s] for channel [%p]",revents,belle_sip_channel_state_to_string(state),obj);
......
......@@ -653,10 +653,11 @@ static int tls_process_data(belle_sip_channel_t *obj,unsigned int revents){
belle_sip_warning("channel [%p]: unexpected event [%i] during TLS handshake.",obj,revents);
}
}
} else if ( obj->state == BELLE_SIP_CHANNEL_READY) {
} else if (obj->state == BELLE_SIP_CHANNEL_READY || obj->state == BELLE_SIP_CHANNEL_RES_IN_PROGRESS) {
/* Because of DNS TTL timeout, the channel may enter the RES_IN_PROGRESS state temporarily while being connected.*/
return belle_sip_channel_process_data(obj,revents);
} else {
belle_sip_error("Unexpected event [%i], for channel [%p]",revents,channel);
belle_sip_error("Unexpected event [%i], for channel [%p] in state [%s]", revents, channel, belle_sip_channel_state_to_string(obj->state));
channel_set_state(obj,BELLE_SIP_CHANNEL_ERROR);
return BELLE_SIP_STOP;
}
......
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