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
b10eb7ae
Commit
b10eb7ae
authored
May 15, 2021
by
Ole André Vadla Ravnås
Committed by
Olivier Crête
Nov 22, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
iostream: Implement close() for ICE-TCP also
parent
462a3629
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
41 additions
and
12 deletions
+41
-12
agent/component.c
agent/component.c
+29
-0
agent/component.h
agent/component.h
+4
-0
agent/inputstream.c
agent/inputstream.c
+4
-6
agent/outputstream.c
agent/outputstream.c
+4
-6
No files found.
agent/component.c
View file @
b10eb7ae
...
@@ -393,6 +393,35 @@ nice_component_close (NiceAgent *agent, NiceStream *stream, NiceComponent *cmp)
...
@@ -393,6 +393,35 @@ nice_component_close (NiceAgent *agent, NiceStream *stream, NiceComponent *cmp)
cmp
->
rfc4571_buffer
=
NULL
;
cmp
->
rfc4571_buffer
=
NULL
;
}
}
void
nice_component_shutdown
(
NiceComponent
*
component
,
gboolean
shutdown_read
,
gboolean
shutdown_write
)
{
GSList
*
i
;
g_assert
(
shutdown_read
||
shutdown_write
);
if
(
!
pseudo_tcp_socket_is_closed
(
component
->
tcp
))
{
PseudoTcpShutdown
how
;
if
(
shutdown_read
&&
shutdown_write
)
how
=
PSEUDO_TCP_SHUTDOWN_RDWR
;
else
if
(
shutdown_read
)
how
=
PSEUDO_TCP_SHUTDOWN_RD
;
else
how
=
PSEUDO_TCP_SHUTDOWN_WR
;
pseudo_tcp_socket_shutdown
(
component
->
tcp
,
how
);
}
for
(
i
=
component
->
socket_sources
;
i
;
i
=
i
->
next
)
{
SocketSource
*
source
=
i
->
data
;
NiceSocket
*
sock
=
source
->
socket
;
if
(
sock
->
type
==
NICE_SOCKET_TYPE_TCP_BSD
)
g_socket_shutdown
(
sock
->
fileno
,
shutdown_read
,
shutdown_write
,
NULL
);
}
}
/*
/*
* Finds a candidate pair that has matching foundation ids.
* Finds a candidate pair that has matching foundation ids.
*
*
...
...
agent/component.h
View file @
b10eb7ae
...
@@ -266,6 +266,10 @@ void
...
@@ -266,6 +266,10 @@ void
nice_component_close
(
NiceAgent
*
agent
,
NiceStream
*
stream
,
nice_component_close
(
NiceAgent
*
agent
,
NiceStream
*
stream
,
NiceComponent
*
component
);
NiceComponent
*
component
);
void
nice_component_shutdown
(
NiceComponent
*
component
,
gboolean
shutdown_read
,
gboolean
shutdown_write
);
gboolean
gboolean
nice_component_find_pair
(
NiceComponent
*
component
,
NiceAgent
*
agent
,
nice_component_find_pair
(
NiceComponent
*
component
,
NiceAgent
*
agent
,
const
gchar
*
lfoundation
,
const
gchar
*
rfoundation
,
CandidatePair
*
pair
);
const
gchar
*
lfoundation
,
const
gchar
*
rfoundation
,
CandidatePair
*
pair
);
...
...
agent/inputstream.c
View file @
b10eb7ae
...
@@ -333,7 +333,6 @@ nice_input_stream_close (GInputStream *stream, GCancellable *cancellable,
...
@@ -333,7 +333,6 @@ nice_input_stream_close (GInputStream *stream, GCancellable *cancellable,
{
{
NiceInputStreamPrivate
*
priv
=
NICE_INPUT_STREAM
(
stream
)
->
priv
;
NiceInputStreamPrivate
*
priv
=
NICE_INPUT_STREAM
(
stream
)
->
priv
;
NiceComponent
*
component
=
NULL
;
NiceComponent
*
component
=
NULL
;
NiceStream
*
_stream
=
NULL
;
NiceAgent
*
agent
;
/* owned */
NiceAgent
*
agent
;
/* owned */
/* Has the agent disappeared? */
/* Has the agent disappeared? */
...
@@ -343,11 +342,10 @@ nice_input_stream_close (GInputStream *stream, GCancellable *cancellable,
...
@@ -343,11 +342,10 @@ nice_input_stream_close (GInputStream *stream, GCancellable *cancellable,
agent_lock
(
agent
);
agent_lock
(
agent
);
/* Shut down the read side of the pseudo-TCP stream, if it still exists. */
/* Shut down the read side of the TCP stream, if it still exists. */
if
(
agent_find_component
(
agent
,
priv
->
stream_id
,
priv
->
component_id
,
if
(
agent_find_component
(
agent
,
priv
->
stream_id
,
priv
->
component_id
,
NULL
,
&
_stream
,
&
component
)
&&
agent
->
reliable
&&
&
component
))
{
!
pseudo_tcp_socket_is_closed
(
component
->
tcp
))
{
nice_component_shutdown
(
component
,
TRUE
,
FALSE
);
pseudo_tcp_socket_shutdown
(
component
->
tcp
,
PSEUDO_TCP_SHUTDOWN_RD
);
}
}
agent_unlock
(
agent
);
agent_unlock
(
agent
);
...
...
agent/outputstream.c
View file @
b10eb7ae
...
@@ -477,7 +477,6 @@ nice_output_stream_close (GOutputStream *stream, GCancellable *cancellable,
...
@@ -477,7 +477,6 @@ nice_output_stream_close (GOutputStream *stream, GCancellable *cancellable,
{
{
NiceOutputStreamPrivate
*
priv
=
NICE_OUTPUT_STREAM
(
stream
)
->
priv
;
NiceOutputStreamPrivate
*
priv
=
NICE_OUTPUT_STREAM
(
stream
)
->
priv
;
NiceComponent
*
component
=
NULL
;
NiceComponent
*
component
=
NULL
;
NiceStream
*
_stream
=
NULL
;
NiceAgent
*
agent
;
/* owned */
NiceAgent
*
agent
;
/* owned */
/* Has the agent disappeared? */
/* Has the agent disappeared? */
...
@@ -487,11 +486,10 @@ nice_output_stream_close (GOutputStream *stream, GCancellable *cancellable,
...
@@ -487,11 +486,10 @@ nice_output_stream_close (GOutputStream *stream, GCancellable *cancellable,
agent_lock
(
agent
);
agent_lock
(
agent
);
/* Shut down the write side of the pseudo-TCP stream. */
/* Shut down the write side of the TCP stream. */
if
(
agent_find_component
(
agent
,
priv
->
stream_id
,
priv
->
component_id
,
if
(
agent_find_component
(
agent
,
priv
->
stream_id
,
priv
->
component_id
,
NULL
,
&
_stream
,
&
component
)
&&
agent
->
reliable
&&
&
component
))
{
!
pseudo_tcp_socket_is_closed
(
component
->
tcp
))
{
nice_component_shutdown
(
component
,
FALSE
,
TRUE
);
pseudo_tcp_socket_shutdown
(
component
->
tcp
,
PSEUDO_TCP_SHUTDOWN_WR
);
}
}
agent_unlock
(
agent
);
agent_unlock
(
agent
);
...
...
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