Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Olivier Crête
libnice
Commits
c122e5ad
Commit
c122e5ad
authored
Jul 11, 2014
by
Olivier Crête
Browse files
tcp-passive: Relay the tcp writable callback up
Otherwise, the caller gets a callback from an unexpected source.
parent
cdbda884
Changes
1
Hide whitespace changes
Inline
Side-by-side
socket/tcp-passive.c
View file @
c122e5ad
...
...
@@ -73,8 +73,6 @@ static void socket_set_writable_callback (NiceSocket *sock,
NiceSocketWritableCb
callback
,
gpointer
user_data
);
static
guint
nice_address_hash
(
const
NiceAddress
*
key
);
static
void
_set_child_callbacks
(
NiceAddress
*
addr
,
NiceSocket
*
child
,
NiceSocket
*
sock
);
NiceSocket
*
nice_tcp_passive_socket_new
(
GMainContext
*
ctx
,
NiceAddress
*
addr
,
...
...
@@ -245,13 +243,13 @@ socket_can_send (NiceSocket *sock, NiceAddress *addr)
}
static
void
_set
_child_
callbacks
(
NiceAddress
*
addr
,
NiceSocket
*
child
,
NiceSocket
*
sock
)
_child_
writable_cb
(
NiceSocket
*
child
,
gpointer
data
)
{
NiceSocket
*
sock
=
data
;
TcpPassivePriv
*
priv
=
sock
->
priv
;
/* FIXME: Danger if child socket was closed */
nice_socket_set_writable_callback
(
child
,
priv
->
writable_cb
,
priv
->
writable_data
);
if
(
priv
->
writable_cb
)
priv
->
writable_cb
(
sock
,
priv
->
writable_data
);
}
static
void
...
...
@@ -262,8 +260,6 @@ socket_set_writable_callback (NiceSocket *sock,
priv
->
writable_cb
=
callback
;
priv
->
writable_data
=
user_data
;
g_hash_table_foreach
(
priv
->
connections
,
(
GHFunc
)
_set_child_callbacks
,
sock
);
}
NiceSocket
*
...
...
@@ -306,7 +302,7 @@ nice_tcp_passive_socket_accept (NiceSocket *sock)
if
(
new_socket
)
{
NiceAddress
*
key
=
nice_address_dup
(
&
remote_addr
);
_set_child
_callback
s
(
key
,
new_socket
,
sock
);
nice_socket_set_writable
_callback
(
new_socket
,
_child_writable_cb
,
sock
);
g_hash_table_insert
(
priv
->
connections
,
key
,
new_socket
);
}
return
new_socket
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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