Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
BC
public
belle-sip
Commits
a5569489
Commit
a5569489
authored
May 31, 2013
by
Simon Morlat
Browse files
add new debug traces
parent
81b4695a
Changes
5
Hide whitespace changes
Inline
Side-by-side
src/belle_sip_loop.c
View file @
a5569489
...
...
@@ -342,7 +342,7 @@ void belle_sip_main_loop_cancel_source(belle_sip_main_loop_t *ml, unsigned long
void
belle_sip_main_loop_iterate
(
belle_sip_main_loop_t
*
ml
){
size_t
pfd_size
=
ml
->
nsources
*
sizeof
(
belle_sip_pollfd_t
);
belle_sip_pollfd_t
*
pfd
=
(
belle_sip_pollfd_t
*
)
alloc
a
(
pfd_size
);
belle_sip_pollfd_t
*
pfd
=
(
belle_sip_pollfd_t
*
)
belle_sip_m
alloc
0
(
pfd_size
);
int
i
=
0
;
belle_sip_source_t
*
s
;
belle_sip_list_t
*
elem
,
*
next
;
...
...
@@ -360,7 +360,6 @@ void belle_sip_main_loop_iterate(belle_sip_main_loop_t *ml){
}
/*Step 1: prepare the pollfd table and get the next timeout value */
memset
(
pfd
,
0
,
pfd_size
);
for
(
elem
=
ml
->
sources
;
elem
!=
NULL
;
elem
=
next
){
next
=
elem
->
next
;
s
=
(
belle_sip_source_t
*
)
elem
->
data
;
...
...
@@ -390,7 +389,7 @@ void belle_sip_main_loop_iterate(belle_sip_main_loop_t *ml){
/* do the poll */
ret
=
belle_sip_poll
(
pfd
,
i
,
duration
);
if
(
ret
==-
1
){
return
;
goto
end
;
}
/* Step 2: examine poll results and determine the list of source to be notified */
...
...
@@ -443,6 +442,8 @@ void belle_sip_main_loop_iterate(belle_sip_main_loop_t *ml){
if
(
can_clean
)
belle_sip_object_pool_clean
(
ml
->
pool
);
else
if
(
tmp_pool
)
belle_sip_object_unref
(
tmp_pool
);
end:
belle_sip_free
(
pfd
);
}
void
belle_sip_main_loop_run
(
belle_sip_main_loop_t
*
ml
){
...
...
src/channel.c
View file @
a5569489
...
...
@@ -149,14 +149,15 @@ int belle_sip_channel_process_data(belle_sip_channel_t *obj,unsigned int revents
int
content_length
;
if
(
revents
&
BELLE_SIP_EVENT_READ
)
{
if
(
obj
->
recv_error
>
0
)
{
if
(
obj
->
simulated_recv_return
>
0
)
{
num
=
belle_sip_channel_recv
(
obj
,
obj
->
input_stream
.
write_ptr
,
belle_sip_channel_input_stream_get_buff_length
(
&
obj
->
input_stream
)
-
1
);
/*write ptr is only incremented if data were acquired from the transport*/
obj
->
input_stream
.
write_ptr
+=
num
;
/*first null terminate the read buff*/
*
obj
->
input_stream
.
write_ptr
=
'\0'
;
}
else
{
num
=
obj
->
recv_error
;
belle_sip_message
(
"channel [%p]: simulating recv() returning %i"
,
obj
,
obj
->
simulated_recv_return
);
num
=
obj
->
simulated_recv_return
;
}
}
else
if
(
!
revents
)
{
num
=
obj
->
input_stream
.
write_ptr
-
obj
->
input_stream
.
read_ptr
;
...
...
@@ -288,7 +289,7 @@ void belle_sip_channel_init(belle_sip_channel_t *obj, belle_sip_stack_t *stack,c
if
(
bindip
&&
strcmp
(
bindip
,
"::0"
)
!=
0
&&
strcmp
(
bindip
,
"0.0.0.0"
)
!=
0
)
obj
->
local_ip
=
belle_sip_strdup
(
bindip
);
obj
->
local_port
=
localport
;
obj
->
recv_error
=
1
;
/*not set*/
obj
->
simulated_recv_return
=
1
;
/*not set*/
belle_sip_channel_input_stream_reset
(
&
obj
->
input_stream
);
update_inactivity_timer
(
obj
,
FALSE
);
}
...
...
src/channel.h
View file @
a5569489
...
...
@@ -92,8 +92,8 @@ struct belle_sip_channel{
belle_sip_channel_input_stream_t
input_stream
;
belle_sip_source_t
*
inactivity_timer
;
uint64_t
last_recv_time
;
unsigned
int
recv_error
:
1
;
/* used to simulate network error.
if <=0, channel_recv will return this value
*/
unsigned
int
force_close
:
1
;
/*
used to simulate network error. if <=0, channel_recv will return this value
*/
int
simulated_recv_return
;
/* used to simulate network error.
0= no data (disconnected) >0= do nothing -1= network error
*/
unsigned
int
force_close
:
1
;
/*
when channel is intentionnaly disconnected, in order to prevent looping notifications
*/
};
#define BELLE_SIP_CHANNEL(obj) BELLE_SIP_CAST(obj,belle_sip_channel_t)
...
...
src/provider.c
View file @
a5569489
...
...
@@ -845,7 +845,7 @@ void belle_sip_provider_set_recv_error(belle_sip_provider_t *prov, int recv_erro
belle_sip_list_t
*
channels
;
for
(
lps
=
prov
->
lps
;
lps
!=
NULL
;
lps
=
lps
->
next
){
for
(
channels
=
((
belle_sip_listening_point_t
*
)
lps
->
data
)
->
channels
;
channels
!=
NULL
;
channels
=
channels
->
next
){
((
belle_sip_channel_t
*
)
channels
->
data
)
->
recv_error
=
recv_error
;
((
belle_sip_channel_t
*
)
channels
->
data
)
->
simulated_recv_return
=
recv_error
;
((
belle_sip_source_t
*
)
channels
->
data
)
->
notify_required
=
(
recv_error
<=
0
);
}
}
...
...
src/sipstack.c
View file @
a5569489
...
...
@@ -70,6 +70,7 @@ BELLE_SIP_DECLARE_NO_IMPLEMENTED_INTERFACES(belle_sip_hop_t);
BELLE_SIP_INSTANCIATE_VPTR
(
belle_sip_hop_t
,
belle_sip_object_t
,
belle_sip_hop_destroy
,
belle_sip_hop_clone
,
NULL
,
TRUE
);
static
void
belle_sip_stack_destroy
(
belle_sip_stack_t
*
stack
){
belle_sip_message
(
"stack [%p] destroyed."
,
stack
);
belle_sip_object_unref
(
stack
->
ml
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment