Commit 2e4d15f3 authored by jehan's avatar jehan
Browse files

improve handling of transient subscribe transactions

parent e70b12af
......@@ -567,6 +567,7 @@ void belle_sip_provider_add_server_transaction(belle_sip_provider_t *prov, belle
BELLESIP_INTERNAL_EXPORT belle_sip_server_transaction_t * belle_sip_provider_find_matching_server_transaction(belle_sip_provider_t *prov,belle_sip_request_t *req);
void belle_sip_provider_remove_server_transaction(belle_sip_provider_t *prov, belle_sip_server_transaction_t *t);
void belle_sip_provider_set_transaction_terminated(belle_sip_provider_t *p, belle_sip_transaction_t *t);
void *belle_sip_transaction_get_application_data_internal(const belle_sip_transaction_t *t);
belle_sip_channel_t * belle_sip_provider_get_channel(belle_sip_provider_t *p, const belle_sip_hop_t *hop);
void belle_sip_provider_add_dialog(belle_sip_provider_t *prov, belle_sip_dialog_t *dialog);
void belle_sip_provider_remove_dialog(belle_sip_provider_t *prov, belle_sip_dialog_t *dialog);
......
......@@ -453,7 +453,10 @@ static int belle_sip_refresher_refresh_internal(belle_sip_refresher_t* refresher
belle_sip_message("Refresher [%p] new publish is delayed to end of ongoing transaction" ,refresher);
refresher->publish_pending = TRUE;
return 0;
} else {
} else if (strcmp(belle_sip_request_get_method(old_request),"SUBSCRIBE")==0) {
belle_sip_message("Cannot refresh now, there is a pending request for refresher [%p].",refresher);
return -1;
}else {
request=belle_sip_request_clone_with_body(belle_sip_transaction_get_request(BELLE_SIP_TRANSACTION(refresher->transaction)));
cseq=belle_sip_message_get_header_by_type(request,belle_sip_header_cseq_t);
belle_sip_header_cseq_set_seq_number(cseq,belle_sip_header_cseq_get_seq_number(cseq)+1);
......@@ -556,8 +559,7 @@ static int belle_sip_refresher_refresh_internal(belle_sip_refresher_t* refresher
client_transaction = belle_sip_provider_create_client_transaction(prov,request);
client_transaction->base.is_internal=1;
belle_sip_transaction_set_application_data(BELLE_SIP_TRANSACTION(client_transaction),refresher);
if (request == refresher->first_acknoleged_request) { /*request is now ref by transaction so no need to keepo it*/
belle_sip_object_unref(refresher->first_acknoleged_request);
refresher->first_acknoleged_request = NULL;
......
......@@ -136,10 +136,19 @@ BELLE_SIP_INSTANCIATE_CUSTOM_VPTR_BEGIN(belle_sip_transaction_t)
NULL /*on_terminate*/
BELLE_SIP_INSTANCIATE_CUSTOM_VPTR_END
void *belle_sip_transaction_get_application_data(const belle_sip_transaction_t *t){
void *belle_sip_transaction_get_application_data_internal(const belle_sip_transaction_t *t){
return t->appdata;
}
void *belle_sip_transaction_get_application_data(const belle_sip_transaction_t *t){
if (t->is_internal) {
belle_sip_error("belle_sip_transaction_get_application_data should not be used on internal transaction [%p]",t);
return NULL;
} else {
return belle_sip_transaction_get_application_data_internal(t);
};
}
void belle_sip_transaction_set_application_data(belle_sip_transaction_t *t, void *data){
t->appdata=data;
}
......
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