Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
B
belle-sip
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
4
Issues
4
List
Board
Labels
Milestones
Merge Requests
7
Merge Requests
7
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
External Wiki
External Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
BC
public
belle-sip
Commits
e038e196
Commit
e038e196
authored
Mar 29, 2016
by
jehan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
small performance optimization around timers
parent
d10b3f92
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
24 additions
and
7 deletions
+24
-7
list.h
include/belle-sip/list.h
+1
-0
mainloop.h
include/belle-sip/mainloop.h
+9
-1
sip-uri.h
include/belle-sip/sip-uri.h
+4
-1
belle_sip_loop.c
src/belle_sip_loop.c
+5
-3
belle_sip_utils.c
src/belle_sip_utils.c
+5
-2
No files found.
include/belle-sip/list.h
View file @
e038e196
...
...
@@ -28,6 +28,7 @@ typedef struct _belle_sip_list belle_sip_list_t;
BELLESIP_EXPORT
belle_sip_list_t
*
belle_sip_list_append
(
belle_sip_list_t
*
elem
,
void
*
data
);
BELLESIP_EXPORT
belle_sip_list_t
*
belle_sip_list_prepend
(
belle_sip_list_t
*
elem
,
void
*
data
);
BELLESIP_EXPORT
belle_sip_list_t
*
belle_sip_list_prepend_link
(
belle_sip_list_t
*
elem
,
belle_sip_list_t
*
new_elem
);
BELLESIP_EXPORT
belle_sip_list_t
*
belle_sip_list_last_elem
(
const
belle_sip_list_t
*
l
);
BELLESIP_EXPORT
belle_sip_list_t
*
belle_sip_list_free
(
belle_sip_list_t
*
elem
);
BELLESIP_EXPORT
belle_sip_list_t
*
belle_sip_list_concat
(
belle_sip_list_t
*
first
,
belle_sip_list_t
*
second
);
...
...
include/belle-sip/mainloop.h
View file @
e038e196
...
...
@@ -103,6 +103,11 @@ BELLESIP_EXPORT void belle_sip_main_loop_do_later(belle_sip_main_loop_t *ml, bel
BELLESIP_EXPORT
belle_sip_source_t
*
belle_sip_timeout_source_new
(
belle_sip_source_func_t
func
,
void
*
data
,
unsigned
int
timeout_value_ms
);
BELLESIP_EXPORT
void
belle_sip_source_set_timeout
(
belle_sip_source_t
*
s
,
unsigned
int
value_ms
);
/**
* Cancel a source. Will be removed at next iterate. It is not freed.
**/
BELLESIP_EXPORT
void
belle_sip_source_cancel
(
belle_sip_source_t
*
src
);
BELLESIP_EXPORT
unsigned
int
belle_sip_source_get_timeout
(
const
belle_sip_source_t
*
s
);
...
...
@@ -140,7 +145,10 @@ BELLESIP_EXPORT int belle_sip_main_loop_quit(belle_sip_main_loop_t *ml);
BELLESIP_EXPORT
void
belle_sip_main_loop_cancel_source
(
belle_sip_main_loop_t
*
ml
,
unsigned
long
id
);
BELLE_SIP_END_DECLS
#if defined(__cplusplus) && defined(BELLE_SIP_USE_STL)
#ifndef BELLE_SIP_USE_STL
#define BELLE_SIP_USE_STL 1
#endif
#if defined(__cplusplus) && BELLE_SIP_USE_STL
#include <functional>
typedef
std
::
function
<
int
(
unsigned
int
)
>
belle_sip_source_cpp_func_t
;
BELLESIP_EXPORT
inline
int
belle_sip_source_cpp_func
(
belle_sip_source_cpp_func_t
*
user_data
,
unsigned
int
events
)
...
...
include/belle-sip/sip-uri.h
View file @
e038e196
...
...
@@ -219,8 +219,11 @@ BELLESIP_EXPORT int belle_sip_uri_check_components_from_request_uri(const belle_
*/
BELLESIP_EXPORT
int
belle_sip_uri_check_components_from_context
(
const
belle_sip_uri_t
*
uri
,
const
char
*
method
,
const
char
*
header_name
);
BELLE_SIP_END_DECLS
#ifndef BELLE_SIP_USE_STL
#define BELLE_SIP_USE_STL 1
#endif
#if defined(__cplusplus) &&
defined(BELLE_SIP_USE_STL)
#if defined(__cplusplus) &&
BELLE_SIP_USE_STL
#include <ostream>
inline
std
::
ostream
&
operator
<<
(
std
::
ostream
&
__os
,
const
belle_sip_uri_t
*
uri
)
...
...
src/belle_sip_loop.c
View file @
e038e196
...
...
@@ -296,7 +296,7 @@ void belle_sip_main_loop_add_source(belle_sip_main_loop_t *ml, belle_sip_source_
source
->
expire_ms
=
belle_sip_time_ms
()
+
source
->
timeout
;
}
source
->
cancelled
=
FALSE
;
ml
->
sources
=
belle_sip_list_
ap
pend_link
(
ml
->
sources
,
&
source
->
node
);
ml
->
sources
=
belle_sip_list_
pre
pend_link
(
ml
->
sources
,
&
source
->
node
);
ml
->
nsources
++
;
}
...
...
@@ -336,7 +336,9 @@ void belle_sip_source_set_remove_cb(belle_sip_source_t *s, belle_sip_source_remo
unsigned
int
belle_sip_source_get_timeout
(
const
belle_sip_source_t
*
s
){
return
s
->
timeout
;
}
void
belle_sip_source_cancel
(
belle_sip_source_t
*
s
){
if
(
s
)
s
->
cancelled
=
TRUE
;
}
static
int
match_source_id
(
const
void
*
s
,
const
void
*
pid
){
if
(
((
belle_sip_source_t
*
)
s
)
->
id
==
(
unsigned
long
)(
intptr_t
)
pid
){
...
...
@@ -355,7 +357,7 @@ belle_sip_source_t *belle_sip_main_loop_find_source(belle_sip_main_loop_t *ml, u
void
belle_sip_main_loop_cancel_source
(
belle_sip_main_loop_t
*
ml
,
unsigned
long
id
){
belle_sip_source_t
*
s
=
belle_sip_main_loop_find_source
(
ml
,
id
);
if
(
s
)
s
->
cancelled
=
TRUE
;
belle_sip_source_cancel
(
s
)
;
}
void
belle_sip_main_loop_iterate
(
belle_sip_main_loop_t
*
ml
){
...
...
src/belle_sip_utils.c
View file @
e038e196
...
...
@@ -292,8 +292,7 @@ belle_sip_list_t* belle_sip_list_append(belle_sip_list_t* elem, void * data){
return
belle_sip_list_append_link
(
elem
,
new_elem
);
}
belle_sip_list_t
*
belle_sip_list_prepend
(
belle_sip_list_t
*
elem
,
void
*
data
){
belle_sip_list_t
*
new_elem
=
belle_sip_list_new
(
data
);
belle_sip_list_t
*
belle_sip_list_prepend_link
(
belle_sip_list_t
*
elem
,
belle_sip_list_t
*
new_elem
){
if
(
elem
!=
NULL
)
{
new_elem
->
next
=
elem
;
elem
->
prev
=
new_elem
;
...
...
@@ -301,6 +300,10 @@ belle_sip_list_t* belle_sip_list_prepend(belle_sip_list_t* elem, void *data){
return
new_elem
;
}
belle_sip_list_t
*
belle_sip_list_prepend
(
belle_sip_list_t
*
elem
,
void
*
data
){
return
belle_sip_list_prepend_link
(
elem
,
belle_sip_list_new
(
data
));
}
belle_sip_list_t
*
belle_sip_list_last_elem
(
const
belle_sip_list_t
*
l
){
if
(
l
==
NULL
)
return
NULL
;
while
(
l
->
next
){
...
...
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