Commit 4f456a46 authored by Olivier Crête's avatar Olivier Crête
Browse files

Remove the "length" parameter from NiceOutputMessage

It was used correctly only half the time anyway
parent 5c235a86
...@@ -215,9 +215,13 @@ gsize ...@@ -215,9 +215,13 @@ gsize
memcpy_buffer_to_input_message (NiceInputMessage *message, memcpy_buffer_to_input_message (NiceInputMessage *message,
const guint8 *buffer, gsize buffer_length); const guint8 *buffer, gsize buffer_length);
guint8 * guint8 *
compact_input_message (NiceInputMessage *message, gsize *buffer_length); compact_input_message (const NiceInputMessage *message, gsize *buffer_length);
guint8 * guint8 *
compact_output_message (const NiceOutputMessage *message, gsize *buffer_length); compact_output_message (const NiceOutputMessage *message, gsize *buffer_length);
gsize
output_message_get_size (const NiceOutputMessage *message);
#endif /*_NICE_AGENT_PRIV_H */ #endif /*_NICE_AGENT_PRIV_H */
...@@ -84,7 +84,8 @@ ...@@ -84,7 +84,8 @@
#define MAX_TCP_MTU 1400 /* Use 1400 because of VPNs and we assume IEE 802.3 */ #define MAX_TCP_MTU 1400 /* Use 1400 because of VPNs and we assume IEE 802.3 */
static void static void
nice_debug_message_composition (NiceInputMessage *messages, guint n_messages); nice_debug_input_message_composition (const NiceInputMessage *messages,
guint n_messages);
G_DEFINE_TYPE (NiceAgent, nice_agent, G_TYPE_OBJECT); G_DEFINE_TYPE (NiceAgent, nice_agent, G_TYPE_OBJECT);
...@@ -1050,7 +1051,8 @@ pseudo_tcp_socket_send_messages (PseudoTcpSocket *self, ...@@ -1050,7 +1051,8 @@ pseudo_tcp_socket_send_messages (PseudoTcpSocket *self,
* used in reliable mode, and there is no concept of a ‘message’, but is * used in reliable mode, and there is no concept of a ‘message’, but is
* necessary because the calling API has no way of returning to the client * necessary because the calling API has no way of returning to the client
* and indicating that a message was partially sent. */ * and indicating that a message was partially sent. */
if (message->length > pseudo_tcp_socket_get_available_send_space (self)) { if (output_message_get_size (message) >
pseudo_tcp_socket_get_available_send_space (self)) {
return i; return i;
} }
...@@ -1232,7 +1234,7 @@ pseudo_tcp_socket_readable (PseudoTcpSocket *sock, gpointer user_data) ...@@ -1232,7 +1234,7 @@ pseudo_tcp_socket_readable (PseudoTcpSocket *sock, gpointer user_data)
nice_debug ("%s: Client buffers case: Received %d valid messages:", nice_debug ("%s: Client buffers case: Received %d valid messages:",
G_STRFUNC, n_valid_messages); G_STRFUNC, n_valid_messages);
nice_debug_message_composition (component->recv_messages, nice_debug_input_message_composition (component->recv_messages,
component->n_recv_messages); component->n_recv_messages);
if (n_valid_messages < 0) { if (n_valid_messages < 0) {
...@@ -1292,8 +1294,6 @@ pseudo_tcp_socket_write_packet (PseudoTcpSocket *socket, ...@@ -1292,8 +1294,6 @@ pseudo_tcp_socket_write_packet (PseudoTcpSocket *socket,
if (component->selected_pair.local != NULL) { if (component->selected_pair.local != NULL) {
NiceSocket *sock; NiceSocket *sock;
NiceAddress *addr; NiceAddress *addr;
GOutputVector local_buf;
NiceOutputMessage local_message;
sock = component->selected_pair.local->sockptr; sock = component->selected_pair.local->sockptr;
...@@ -1312,15 +1312,8 @@ pseudo_tcp_socket_write_packet (PseudoTcpSocket *socket, ...@@ -1312,15 +1312,8 @@ pseudo_tcp_socket_write_packet (PseudoTcpSocket *socket,
addr = &component->selected_pair.remote->addr; addr = &component->selected_pair.remote->addr;
local_buf.buffer = buffer; if (nice_socket_send (sock, addr, len, buffer))
local_buf.size = len;
local_message.buffers = &local_buf;
local_message.n_buffers = 1;
local_message.length = len;
if (nice_socket_send_messages (sock, addr, &local_message, 1)) {
return WR_SUCCESS; return WR_SUCCESS;
}
} else { } else {
nice_debug ("%s: WARNING: Failed to send pseudo-TCP packet from agent %p " nice_debug ("%s: WARNING: Failed to send pseudo-TCP packet from agent %p "
"as no pair has been selected yet.", G_STRFUNC, component->agent); "as no pair has been selected yet.", G_STRFUNC, component->agent);
...@@ -2749,13 +2742,14 @@ done: ...@@ -2749,13 +2742,14 @@ done:
/* Print the composition of an array of messages. No-op if debugging is /* Print the composition of an array of messages. No-op if debugging is
* disabled. */ * disabled. */
static void static void
nice_debug_message_composition (NiceInputMessage *messages, guint n_messages) nice_debug_input_message_composition (const NiceInputMessage *messages,
guint n_messages)
{ {
#ifndef NDEBUG #ifndef NDEBUG
guint i; guint i;
for (i = 0; i < n_messages; i++) { for (i = 0; i < n_messages; i++) {
NiceInputMessage *message = &messages[i]; const NiceInputMessage *message = &messages[i];
guint j; guint j;
nice_debug ("Message %p (from: %p, length: %" G_GSIZE_FORMAT ")", message, nice_debug ("Message %p (from: %p, length: %" G_GSIZE_FORMAT ")", message,
...@@ -2774,30 +2768,20 @@ nice_debug_message_composition (NiceInputMessage *messages, guint n_messages) ...@@ -2774,30 +2768,20 @@ nice_debug_message_composition (NiceInputMessage *messages, guint n_messages)
#endif #endif
} }
/* Concatenate all the buffers in the given @recv_message into a single, newly static guint8 *
* allocated, monolithic buffer which is returned. The length of the new buffer compact_message (const NiceOutputMessage *message, gsize buffer_length)
* is returned in @buffer_length, and should be equal to the length field of
* @recv_message.
*
* The return value must be freed with g_free(). */
guint8 *
compact_input_message (NiceInputMessage *message, gsize *buffer_length)
{ {
guint8 *buffer; guint8 *buffer;
gsize offset = 0; gsize offset = 0;
guint i; guint i;
nice_debug ("%s: **WARNING: SLOW PATH**", G_STRFUNC); buffer = g_malloc (buffer_length);
nice_debug_message_composition (message, 1);
*buffer_length = message->length;
buffer = g_malloc (*buffer_length);
for (i = 0; for (i = 0;
(message->n_buffers >= 0 && i < (guint) message->n_buffers) || (message->n_buffers >= 0 && i < (guint) message->n_buffers) ||
(message->n_buffers < 0 && message->buffers[i].buffer != NULL); (message->n_buffers < 0 && message->buffers[i].buffer != NULL);
i++) { i++) {
gsize len = MIN (*buffer_length - offset, message->buffers[i].size); gsize len = MIN (buffer_length - offset, message->buffers[i].size);
memcpy (buffer + offset, message->buffers[i].buffer, len); memcpy (buffer + offset, message->buffers[i].buffer, len);
offset += len; offset += len;
} }
...@@ -2805,6 +2789,25 @@ compact_input_message (NiceInputMessage *message, gsize *buffer_length) ...@@ -2805,6 +2789,25 @@ compact_input_message (NiceInputMessage *message, gsize *buffer_length)
return buffer; return buffer;
} }
/* Concatenate all the buffers in the given @recv_message into a single, newly
* allocated, monolithic buffer which is returned. The length of the new buffer
* is returned in @buffer_length, and should be equal to the length field of
* @recv_message.
*
* The return value must be freed with g_free(). */
guint8 *
compact_input_message (const NiceInputMessage *message, gsize *buffer_length)
{
nice_debug ("%s: **WARNING: SLOW PATH**", G_STRFUNC);
nice_debug_input_message_composition (message, 1);
/* This works as long as NiceInputMessage is a subset of eNiceOutputMessage */
*buffer_length = message->length;
return compact_message ((NiceOutputMessage *) message, *buffer_length);
}
/* Returns the number of bytes copied. Silently drops any data from @buffer /* Returns the number of bytes copied. Silently drops any data from @buffer
* which doesn’t fit in @message. */ * which doesn’t fit in @message. */
gsize gsize
...@@ -2834,7 +2837,7 @@ memcpy_buffer_to_input_message (NiceInputMessage *message, ...@@ -2834,7 +2837,7 @@ memcpy_buffer_to_input_message (NiceInputMessage *message,
message->length += len; message->length += len;
} }
nice_debug_message_composition (message, 1); nice_debug_input_message_composition (message, 1);
if (buffer_length > 0) { if (buffer_length > 0) {
g_warning ("Dropped %" G_GSIZE_FORMAT " bytes of data from the end of " g_warning ("Dropped %" G_GSIZE_FORMAT " bytes of data from the end of "
...@@ -2855,9 +2858,27 @@ memcpy_buffer_to_input_message (NiceInputMessage *message, ...@@ -2855,9 +2858,27 @@ memcpy_buffer_to_input_message (NiceInputMessage *message,
guint8 * guint8 *
compact_output_message (const NiceOutputMessage *message, gsize *buffer_length) compact_output_message (const NiceOutputMessage *message, gsize *buffer_length)
{ {
/* This works as long as NiceInputMessage and NiceOutputMessage are layed out nice_debug ("%s: **WARNING: SLOW PATH**", G_STRFUNC);
* identically. */
return compact_input_message ((NiceInputMessage *) message, buffer_length); *buffer_length = output_message_get_size (message);
return compact_message (message, *buffer_length);
}
gsize
output_message_get_size (const NiceOutputMessage *message)
{
guint i;
gsize message_len = 0;
/* Find the total size of the message */
for (i = 0;
(message->n_buffers >= 0 && i < (guint) message->n_buffers) ||
(message->n_buffers < 0 && message->buffers[i].buffer != NULL);
i++)
message_len += message->buffers[i].size;
return message_len;
} }
/** /**
...@@ -3034,7 +3055,7 @@ nice_agent_recv_messages_blocking_or_nonblocking (NiceAgent *agent, ...@@ -3034,7 +3055,7 @@ nice_agent_recv_messages_blocking_or_nonblocking (NiceAgent *agent,
} }
nice_debug ("%s: (%s):", G_STRFUNC, blocking ? "blocking" : "non-blocking"); nice_debug ("%s: (%s):", G_STRFUNC, blocking ? "blocking" : "non-blocking");
nice_debug_message_composition (messages, n_messages); nice_debug_input_message_composition (messages, n_messages);
/* Set the component’s receive buffer. */ /* Set the component’s receive buffer. */
context = component_dup_io_context (component); context = component_dup_io_context (component);
...@@ -3320,8 +3341,8 @@ nice_agent_send ( ...@@ -3320,8 +3341,8 @@ nice_agent_send (
const gchar *buf) const gchar *buf)
{ {
GOutputVector local_buf = { buf, len }; GOutputVector local_buf = { buf, len };
NiceOutputMessage local_message = { &local_buf, 1, len };
gint n_sent_messages; gint n_sent_messages;
NiceOutputMessage local_message = { &local_buf, 1 };
n_sent_messages = nice_agent_send_messages_nonblocking (agent, stream_id, n_sent_messages = nice_agent_send_messages_nonblocking (agent, stream_id,
component_id, &local_message, 1, NULL, NULL); component_id, &local_message, 1, NULL, NULL);
......
...@@ -176,7 +176,6 @@ typedef struct { ...@@ -176,7 +176,6 @@ typedef struct {
* which contain data to transmit for this message * which contain data to transmit for this message
* @n_buffers: number of #GOutputVectors in @buffers, or -1 to indicate @buffers * @n_buffers: number of #GOutputVectors in @buffers, or -1 to indicate @buffers
* is %NULL-terminated * is %NULL-terminated
* @length: total number of valid bytes contiguously stored in @buffers
* *
* Represents a single message to transmit on the network. For * Represents a single message to transmit on the network. For
* reliable connections, this is essentially just an array of * reliable connections, this is essentially just an array of
...@@ -197,7 +196,6 @@ typedef struct { ...@@ -197,7 +196,6 @@ typedef struct {
typedef struct { typedef struct {
GOutputVector *buffers; GOutputVector *buffers;
gint n_buffers; gint n_buffers;
gsize length;
} NiceOutputMessage; } NiceOutputMessage;
......
...@@ -403,7 +403,7 @@ nice_output_stream_write (GOutputStream *stream, const void *buffer, gsize count ...@@ -403,7 +403,7 @@ nice_output_stream_write (GOutputStream *stream, const void *buffer, gsize count
do { do {
GOutputVector local_buf = { (const guint8 *) buffer + len, count - len }; GOutputVector local_buf = { (const guint8 *) buffer + len, count - len };
NiceOutputMessage local_message = {&local_buf, 1, count - len}; NiceOutputMessage local_message = {&local_buf, 1};
/* Have to unlock while calling into the agent because /* Have to unlock while calling into the agent because
* it will take the agent lock which will cause a deadlock if one of * it will take the agent lock which will cause a deadlock if one of
...@@ -523,7 +523,7 @@ nice_output_stream_write_nonblocking (GPollableOutputStream *stream, ...@@ -523,7 +523,7 @@ nice_output_stream_write_nonblocking (GPollableOutputStream *stream,
NiceOutputStreamPrivate *priv = NICE_OUTPUT_STREAM (stream)->priv; NiceOutputStreamPrivate *priv = NICE_OUTPUT_STREAM (stream)->priv;
NiceAgent *agent; /* owned */ NiceAgent *agent; /* owned */
GOutputVector local_buf = { buffer, count }; GOutputVector local_buf = { buffer, count };
NiceOutputMessage local_message = { &local_buf, 1, count }; NiceOutputMessage local_message = { &local_buf, 1 };
gint n_sent_messages; gint n_sent_messages;
/* Closed streams are not writeable. */ /* Closed streams are not writeable. */
......
...@@ -43,6 +43,7 @@ ...@@ -43,6 +43,7 @@
#endif #endif
#include "http.h" #include "http.h"
#include "agent-priv.h"
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
...@@ -165,7 +166,6 @@ nice_http_socket_new (NiceSocket *base_socket, ...@@ -165,7 +166,6 @@ nice_http_socket_new (NiceSocket *base_socket,
local_bufs.size = strlen (msg); local_bufs.size = strlen (msg);
local_messages.buffers = &local_bufs; local_messages.buffers = &local_bufs;
local_messages.n_buffers = 1; local_messages.n_buffers = 1;
local_messages.length = local_bufs.size;
nice_socket_send_messages (priv->base_socket, NULL, &local_messages, 1); nice_socket_send_messages (priv->base_socket, NULL, &local_messages, 1);
priv->state = HTTP_STATE_INIT; priv->state = HTTP_STATE_INIT;
...@@ -266,7 +266,6 @@ memcpy_ring_buffer_to_input_messages (HttpPriv *priv, ...@@ -266,7 +266,6 @@ memcpy_ring_buffer_to_input_messages (HttpPriv *priv,
message->buffers[j].size = message->buffers[j].size =
memcpy_ring_buffer_to_buffer (priv, memcpy_ring_buffer_to_buffer (priv,
message->buffers[j].buffer, message->buffers[j].size); message->buffers[j].buffer, message->buffers[j].size);
message->length += message->buffers[j].size;
} }
} }
...@@ -618,15 +617,15 @@ add_to_be_sent (NiceSocket *sock, const NiceAddress *to, ...@@ -618,15 +617,15 @@ add_to_be_sent (NiceSocket *sock, const NiceAddress *to,
const NiceOutputMessage *message = &messages[i]; const NiceOutputMessage *message = &messages[i];
struct to_be_sent *tbs = NULL; struct to_be_sent *tbs = NULL;
guint j; guint j;
gsize message_len_remaining = message->length; gsize message_len_remaining = output_message_get_size (message);
gsize offset = 0; gsize offset = 0;
if (message->length == 0) if (message_len_remaining == 0)
continue; continue;
tbs = g_slice_new0 (struct to_be_sent); tbs = g_slice_new0 (struct to_be_sent);
tbs->buf = g_malloc (message->length); tbs->buf = g_malloc (message_len_remaining);
tbs->length = message->length; tbs->length = message_len_remaining;
if (to) if (to)
tbs->to = *to; tbs->to = *to;
g_queue_push_tail (&priv->send_queue, tbs); g_queue_push_tail (&priv->send_queue, tbs);
......
...@@ -43,6 +43,7 @@ ...@@ -43,6 +43,7 @@
#endif #endif
#include "pseudossl.h" #include "pseudossl.h"
#include "agent-priv.h"
#include <string.h> #include <string.h>
...@@ -229,12 +230,15 @@ add_to_be_sent (NiceSocket *sock, const NiceAddress *to, ...@@ -229,12 +230,15 @@ add_to_be_sent (NiceSocket *sock, const NiceAddress *to,
const NiceOutputMessage *message = &messages[i]; const NiceOutputMessage *message = &messages[i];
guint j; guint j;
gsize offset = 0; gsize offset = 0;
gsize message_len;
tbs = g_slice_new0 (struct to_be_sent); tbs = g_slice_new0 (struct to_be_sent);
/* Compact the buffer. */ message_len = output_message_get_size (message);
tbs->buf = g_malloc (message->length);
tbs->length = message->length; /* Compact the buffer. */
tbs->buf = g_malloc (message_len);
tbs->length = message_len;
if (to != NULL) if (to != NULL)
tbs->to = *to; tbs->to = *to;
g_queue_push_tail (&priv->send_queue, tbs); g_queue_push_tail (&priv->send_queue, tbs);
...@@ -246,12 +250,12 @@ add_to_be_sent (NiceSocket *sock, const NiceAddress *to, ...@@ -246,12 +250,12 @@ add_to_be_sent (NiceSocket *sock, const NiceAddress *to,
const GOutputVector *buffer = &message->buffers[j]; const GOutputVector *buffer = &message->buffers[j];
gsize len; gsize len;
len = MIN (message->length - offset, buffer->size); len = MIN (message_len - offset, buffer->size);
memcpy (tbs->buf + offset, buffer->buffer, len); memcpy (tbs->buf + offset, buffer->buffer, len);
offset += len; offset += len;
} }
g_assert_cmpuint (offset, ==, message->length); g_assert (offset == message_len);
} }
} }
......
...@@ -146,7 +146,7 @@ nice_socket_send (NiceSocket *sock, const NiceAddress *to, gsize len, ...@@ -146,7 +146,7 @@ nice_socket_send (NiceSocket *sock, const NiceAddress *to, gsize len,
const gchar *buf) const gchar *buf)
{ {
GOutputVector local_buf = { buf, len }; GOutputVector local_buf = { buf, len };
NiceOutputMessage local_message = { &local_buf, 1, len }; NiceOutputMessage local_message = { &local_buf, 1};
gint ret; gint ret;
ret = sock->send_messages (sock, to, &local_message, 1); ret = sock->send_messages (sock, to, &local_message, 1);
...@@ -169,4 +169,3 @@ nice_socket_free (NiceSocket *sock) ...@@ -169,4 +169,3 @@ nice_socket_free (NiceSocket *sock)
g_slice_free (NiceSocket,sock); g_slice_free (NiceSocket,sock);
} }
} }
...@@ -43,6 +43,7 @@ ...@@ -43,6 +43,7 @@
#endif #endif
#include "socks5.h" #include "socks5.h"
#include "agent-priv.h"
#include <string.h> #include <string.h>
...@@ -463,8 +464,8 @@ add_to_be_sent (NiceSocket *sock, const NiceAddress *to, ...@@ -463,8 +464,8 @@ add_to_be_sent (NiceSocket *sock, const NiceAddress *to,
tbs = g_slice_new0 (struct to_be_sent); tbs = g_slice_new0 (struct to_be_sent);
/* Compact the buffer. */ /* Compact the buffer. */
tbs->buf = g_malloc (message->length); tbs->length = output_message_get_size (message);
tbs->length = message->length; tbs->buf = g_malloc (tbs->length);
if (to != NULL) if (to != NULL)
tbs->to = *to; tbs->to = *to;
g_queue_push_tail (&priv->send_queue, tbs); g_queue_push_tail (&priv->send_queue, tbs);
...@@ -476,12 +477,12 @@ add_to_be_sent (NiceSocket *sock, const NiceAddress *to, ...@@ -476,12 +477,12 @@ add_to_be_sent (NiceSocket *sock, const NiceAddress *to,
const GOutputVector *buffer = &message->buffers[j]; const GOutputVector *buffer = &message->buffers[j];
gsize len; gsize len;
len = MIN (message->length - offset, buffer->size); len = MIN (tbs->length - offset, buffer->size);
memcpy (tbs->buf + offset, buffer->buffer, len); memcpy (tbs->buf + offset, buffer->buffer, len);
offset += len; offset += len;
} }
g_assert_cmpuint (offset, ==, message->length); g_assert (offset == tbs->length);
} }
} }
......
...@@ -78,7 +78,7 @@ static gboolean socket_is_reliable (NiceSocket *sock); ...@@ -78,7 +78,7 @@ static gboolean socket_is_reliable (NiceSocket *sock);
static void add_to_be_sent (NiceSocket *sock, const NiceOutputMessage *message, static void add_to_be_sent (NiceSocket *sock, const NiceOutputMessage *message,
gsize message_offset, gboolean head); gsize message_offset, gsize message_len, gboolean head);
static void free_to_be_sent (struct to_be_sent *tbs); static void free_to_be_sent (struct to_be_sent *tbs);
static gboolean socket_send_more (GSocket *gsocket, GIOCondition condition, static gboolean socket_send_more (GSocket *gsocket, GIOCondition condition,
gpointer data); gpointer data);
...@@ -258,12 +258,15 @@ socket_send_message (NiceSocket *sock, const NiceOutputMessage *message) ...@@ -258,12 +258,15 @@ socket_send_message (NiceSocket *sock, const NiceOutputMessage *message)
TcpPriv *priv = sock->priv; TcpPriv *priv = sock->priv;
gssize ret; gssize ret;
GError *gerr = NULL; GError *gerr = NULL;
gsize message_len;
/* Don't try to access the socket if it had an error, otherwise we risk a /* Don't try to access the socket if it had an error, otherwise we risk a
* crash with SIGPIPE (Broken pipe) */ * crash with SIGPIPE (Broken pipe) */
if (priv->error) if (priv->error)
return -1; return -1;
message_len = output_message_get_size (message);
/* First try to send the data, don't send it later if it can be sent now /* First try to send the data, don't send it later if it can be sent now
* this way we avoid allocating memory on every send */ * this way we avoid allocating memory on every send */
if (g_queue_is_empty (&priv->send_queue)) { if (g_queue_is_empty (&priv->send_queue)) {
...@@ -274,15 +277,15 @@ socket_send_message (NiceSocket *sock, const NiceOutputMessage *message) ...@@ -274,15 +277,15 @@ socket_send_message (NiceSocket *sock, const NiceOutputMessage *message)
if (g_error_matches (gerr, G_IO_ERROR, G_IO_ERROR_WOULD_BLOCK) || if (g_error_matches (gerr, G_IO_ERROR, G_IO_ERROR_WOULD_BLOCK) ||
g_error_matches (gerr, G_IO_ERROR, G_IO_ERROR_FAILED)) { g_error_matches (gerr, G_IO_ERROR, G_IO_ERROR_FAILED)) {
/* Queue the message and send it later. */ /* Queue the message and send it later. */
add_to_be_sent (sock, message, 0, FALSE); add_to_be_sent (sock, message, 0, message_len, FALSE);
ret = message->length; ret = message_len;
} }
g_error_free (gerr); g_error_free (gerr);
} else if ((gsize) ret < message->length) { } else if ((gsize) ret < message_len) {
/* Partial send. */ /* Partial send. */
add_to_be_sent (sock, message, ret, TRUE); add_to_be_sent (sock, message, ret, message_len, TRUE);
ret = message->length; ret = message_len;
} }
} else { } else {
/* FIXME: This dropping will break http/socks5/etc /* FIXME: This dropping will break http/socks5/etc
...@@ -305,8 +308,8 @@ socket_send_message (NiceSocket *sock, const NiceOutputMessage *message) ...@@ -305,8 +308,8 @@ socket_send_message (NiceSocket *sock, const NiceOutputMessage *message)
} }
/* Queue the message and send it later. */ /* Queue the message and send it later. */
add_to_be_sent (sock, message, 0, FALSE); add_to_be_sent (sock, message, 0, message_len, FALSE);
ret = message->length; ret = message_len;
} }
return ret; return ret;
...@@ -389,9 +392,9 @@ socket_send_more ( ...@@ -389,9 +392,9 @@ socket_send_more (
if (gerr != NULL && if (gerr != NULL &&
g_error_matches (gerr, G_IO_ERROR, G_IO_ERROR_WOULD_BLOCK)) { g_error_matches (gerr, G_IO_ERROR, G_IO_ERROR_WOULD_BLOCK)) {
GOutputVector local_buf = { tbs->buf, tbs->length }; GOutputVector local_buf = { tbs->buf, tbs->length };
NiceOutputMessage local_message = {&local_buf, 1, local_buf.size}; NiceOutputMessage local_message = {&local_buf, 1};
add_to_be_sent (sock, &local_message, 0, TRUE); add_to_be_sent (sock, &local_message, 0, local_buf.size, TRUE);
free_to_be_sent (tbs); free_to_be_sent (tbs);
g_error_free (gerr); g_error_free (gerr);