Commit 06d42f1c authored by Madaro Livio's avatar Madaro Livio Committed by Youness Alaoui

Fix sending data padding for TURN TCP draft 9 and RFC 5766

Data padding is required for interoperability with standard TURN server.
parent 9bc0702e
......@@ -152,7 +152,7 @@ socket_recv (NiceSocket *sock, NiceAddress *from, guint len, gchar *buf)
}
if (priv->compatibility == NICE_TURN_SOCKET_COMPATIBILITY_DRAFT9 ||
priv->compatibility == NICE_TURN_SOCKET_COMPATIBILITY_RFC5766)
priv->compatibility == NICE_TURN_SOCKET_COMPATIBILITY_RFC5766)
padlen = (priv->expecting_len % 4) ? 4 - (priv->expecting_len % 4) : 0;
else
padlen = 0;
......@@ -188,8 +188,8 @@ socket_send (NiceSocket *sock, const NiceAddress *to,
gchar buffer[MAX_UDP_MESSAGE_SIZE + sizeof(guint16) + sizeof(padbuf)];
guint buffer_len = 0;
if (priv->compatibility != NICE_TURN_SOCKET_COMPATIBILITY_DRAFT9 ||
priv->compatibility == NICE_TURN_SOCKET_COMPATIBILITY_RFC5766)
if (priv->compatibility != NICE_TURN_SOCKET_COMPATIBILITY_DRAFT9 &&
priv->compatibility != NICE_TURN_SOCKET_COMPATIBILITY_RFC5766)
padlen = 0;
if (priv->compatibility == NICE_TURN_SOCKET_COMPATIBILITY_GOOGLE) {
......@@ -202,7 +202,7 @@ socket_send (NiceSocket *sock, const NiceAddress *to,
buffer_len += len;
if (priv->compatibility == NICE_TURN_SOCKET_COMPATIBILITY_DRAFT9 ||
priv->compatibility == NICE_TURN_SOCKET_COMPATIBILITY_RFC5766) {
priv->compatibility == NICE_TURN_SOCKET_COMPATIBILITY_RFC5766) {
memcpy (buffer + buffer_len, padbuf, padlen);
buffer_len += padlen;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment