aboutsummaryrefslogtreecommitdiffstats
path: root/src/mds-server
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2014-05-15 15:45:13 +0200
committerMattias Andrée <maandree@operamail.com>2014-05-15 15:45:13 +0200
commit566054194d82b4bfabaaca44d14008a073e29a6b (patch)
tree5fc6f39d75cc49402071906151d3b0b6b41f1f00 /src/mds-server
parentDo not echo back messages to the sender (diff)
downloadmds-566054194d82b4bfabaaca44d14008a073e29a6b.tar.gz
mds-566054194d82b4bfabaaca44d14008a073e29a6b.tar.bz2
mds-566054194d82b4bfabaaca44d14008a073e29a6b.tar.xz
m + fix message sending
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to 'src/mds-server')
-rw-r--r--src/mds-server/client.c10
-rw-r--r--src/mds-server/mds-server.c5
2 files changed, 8 insertions, 7 deletions
diff --git a/src/mds-server/client.c b/src/mds-server/client.c
index c8e25ea..15afc18 100644
--- a/src/mds-server/client.c
+++ b/src/mds-server/client.c
@@ -76,13 +76,13 @@ size_t client_marshal_size(const client_t* restrict this)
size_t n = sizeof(ssize_t) + 2 * sizeof(int) + sizeof(uint64_t) + 5 * sizeof(size_t);
size_t i;
- n += mds_message_marshal_size(&(this->message), 1);
+ n += mds_message_marshal_size(&(this->message));
for (i = 0; i < this->interception_conditions_count; i++)
n += interception_condition_marshal_size(this->interception_conditions + i);
for (i = 0; i < this->multicasts_count; i++)
n += multicast_marshal_size(this->multicasts + i);
n += this->send_pending_size * sizeof(char);
- n += this->modify_message == NULL ? 0 : mds_message_marshal_size(this->modify_message, 1);
+ n += this->modify_message == NULL ? 0 : mds_message_marshal_size(this->modify_message);
return n;
}
@@ -102,9 +102,9 @@ size_t client_marshal(const client_t* restrict this, char* restrict data)
buf_set_next(data, int, this->socket_fd);
buf_set_next(data, int, this->open);
buf_set_next(data, uint64_t, this->id);
- n = mds_message_marshal_size(&(this->message), 1);;
+ n = mds_message_marshal_size(&(this->message));
buf_set_next(data, size_t, n);
- mds_message_marshal(&(this->message), data, 1);
+ mds_message_marshal(&(this->message), data);
data += n / sizeof(char);
buf_set_next(data, size_t, this->interception_conditions_count);
for (i = 0; i < this->interception_conditions_count; i++)
@@ -117,7 +117,7 @@ size_t client_marshal(const client_t* restrict this, char* restrict data)
memcpy(data, this->send_pending, this->send_pending_size * sizeof(char));
data += this->send_pending_size;
if (this->modify_message != NULL)
- mds_message_marshal(this->modify_message, data, 1);
+ mds_message_marshal(this->modify_message, data);
return client_marshal_size(this);
}
diff --git a/src/mds-server/mds-server.c b/src/mds-server/mds-server.c
index d0757fd..b774e77 100644
--- a/src/mds-server/mds-server.c
+++ b/src/mds-server/mds-server.c
@@ -871,6 +871,7 @@ int message_received(client_t* client)
{
perror(*argv);
free(old_buf);
+ pthread_mutex_unlock(&(client->mutex));
return 0;
}
}
@@ -896,13 +897,13 @@ int message_received(client_t* client)
/* Multicast the message. */
- n = mds_message_marshal_size(&message, 0);
+ n = mds_message_compose_size(&message);
if ((msgbuf = malloc(n)) == NULL)
{
perror(*argv);
return 0;
}
- mds_message_marshal(&message, msgbuf, 0);
+ mds_message_compose(&message, msgbuf);
queue_message_multicast(msgbuf, n / sizeof(char), client);