diff options
Diffstat (limited to 'socket/udp-turn.c')
-rw-r--r-- | socket/udp-turn.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/socket/udp-turn.c b/socket/udp-turn.c index 0314203..fea2e00 100644 --- a/socket/udp-turn.c +++ b/socket/udp-turn.c @@ -318,6 +318,8 @@ socket_close (NiceSocket *sock) g_free (priv->username); g_free (priv->password); g_free (priv); + + sock->priv = NULL; } static gint @@ -330,6 +332,10 @@ socket_recv_messages (NiceSocket *sock, gboolean error = FALSE; guint n_valid_messages; + /* Socket has been closed: */ + if (sock->priv == NULL) + return 0; + nice_debug ("received message on TURN socket"); n_messages = nice_socket_recv_messages (priv->base_socket, @@ -687,6 +693,10 @@ socket_send_message (NiceSocket *sock, const NiceAddress *to, ChannelBinding *binding = NULL; gint ret; + /* Socket has been closed: */ + if (sock->priv == NULL) + return -1; + for (; i; i = i->next) { ChannelBinding *b = i->data; if (nice_address_equal (&b->peer, to)) { @@ -858,6 +868,10 @@ socket_send_messages (NiceSocket *sock, const NiceAddress *to, { guint i; + /* Socket has been closed: */ + if (sock->priv == NULL) + return -1; + for (i = 0; i < n_messages; i++) { const NiceOutputMessage *message = &messages[i]; gssize len; |