Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
libnice
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
cpp-libs
libnice
Commits
03146af6
Commit
03146af6
authored
Feb 02, 2007
by
Dafydd Harries
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add nice_agent_poll_read
darcs-hash:20070202172357-c9803-8094202e451896f13265fd9a323b36b2af89bfc9.gz
parent
bf81ddf0
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
76 additions
and
0 deletions
+76
-0
agent/agent.c
agent/agent.c
+70
-0
agent/agent.h
agent/agent.h
+5
-0
nice/libnice.symbols
nice/libnice.symbols
+1
-0
No files found.
agent/agent.c
View file @
03146af6
...
...
@@ -606,6 +606,76 @@ nice_agent_recv (
}
/**
* nice_agent_poll_read:
*
* Polls the agent's sockets until at least one of them is readable, and
* additionally if @other_fds is not NULL, polls those for readability too.
* @other_fds should contain the file descriptors directly, i.e. using
* GUINT_TO_POINTER.
*
* @agent: A NiceAgent
* @other_fds: A GSList of other file descriptors to poll
* Return value: A list of file descriptors from @other_fds that are readable
**/
GSList
*
nice_agent_poll_read
(
NiceAgent
*
agent
,
GSList
*
other_fds
)
{
fd_set
fds
;
guint
max_fd
=
0
;
gint
num_readable
;
GSList
*
ret
=
NULL
;
GSList
*
i
;
guint
j
;
FD_ZERO
(
&
fds
);
for
(
i
=
agent
->
local_candidates
;
i
;
i
=
i
->
next
)
{
NiceCandidate
*
candidate
;
candidate
=
i
->
data
;
FD_SET
(
candidate
->
sock
.
fileno
,
&
fds
);
max_fd
=
MAX
(
candidate
->
sock
.
fileno
,
max_fd
);
}
for
(
i
=
other_fds
;
i
;
i
=
i
->
next
)
{
guint
fileno
;
fileno
=
GPOINTER_TO_UINT
(
i
->
data
);
FD_SET
(
fileno
,
&
fds
);
max_fd
=
MAX
(
fileno
,
max_fd
);
}
max_fd
++
;
num_readable
=
select
(
max_fd
,
&
fds
,
NULL
,
NULL
,
0
);
if
(
num_readable
<
1
)
/* none readable, or error */
return
NULL
;
for
(
j
=
0
;
j
<
max_fd
;
j
++
)
if
(
FD_ISSET
(
j
,
&
fds
))
{
GSList
*
i
;
if
(
g_slist_find
(
other_fds
,
GUINT_TO_POINTER
(
j
)))
ret
=
g_slist_append
(
ret
,
GUINT_TO_POINTER
(
j
));
else
for
(
i
=
agent
->
local_candidates
;
i
;
i
=
i
->
next
)
{
NiceCandidate
*
candidate
=
i
->
data
;
if
(
candidate
->
sock
.
fileno
==
j
)
_nice_agent_recv
(
agent
,
candidate
);
}
}
return
ret
;
}
/**
* Set the STUN server from which to obtain server-reflexive candidates.
*/
...
...
agent/agent.h
View file @
03146af6
...
...
@@ -66,6 +66,11 @@ nice_agent_recv (
NiceAgent
*
agent
,
guint
candidate_id
);
GSList
*
nice_agent_poll_read
(
NiceAgent
*
agent
,
GSList
*
other_fds
);
const
GSList
*
nice_agent_get_local_candidates
(
NiceAgent
*
agent
);
...
...
nice/libnice.symbols
View file @
03146af6
...
...
@@ -12,6 +12,7 @@ T nice_agent_add_stream
T nice_agent_free
T nice_agent_get_local_candidates
T nice_agent_new
T nice_agent_poll_read
T nice_agent_pop_event
T nice_agent_recv
T nice_candidate_free
...
...
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