summaryrefslogtreecommitdiff
path: root/backends
diff options
context:
space:
mode:
authorMartin Baulig <martin@src.gnome.org>2000-01-09 22:12:49 +0000
committerMartin Baulig <martin@src.gnome.org>2000-01-09 22:12:49 +0000
commitc164df664d3a77c1e34bda80b6d5bf362c3d982a (patch)
tree350bfc8cce8cc18ac19c0160661c1f52e03415c0 /backends
parentfa592c3a9418b478f7a0998be9094949f6b0bf75 (diff)
downloadlibgtop-c164df664d3a77c1e34bda80b6d5bf362c3d982a.tar.gz
Correctly pass string data from client to server.
Diffstat (limited to 'backends')
-rw-r--r--backends/server/command.c7
-rw-r--r--backends/server/server.c18
2 files changed, 21 insertions, 4 deletions
diff --git a/backends/server/command.c b/backends/server/command.c
index 0e10b08e..a58f118e 100644
--- a/backends/server/command.c
+++ b/backends/server/command.c
@@ -63,9 +63,16 @@ glibtop_call_i (glibtop *server, glibtop_backend *backend, unsigned command,
} else {
cmnd.send_size = send_size;
}
+
+ cmnd.data_size = data_size;
glibtop_write_i (server, backend, sizeof (glibtop_command), &cmnd);
+ if (data_size) {
+ fprintf (stderr, "SENDING %d bytes of DATA.\n", data_size);
+ glibtop_write_i (server, backend, data_size, data_buf);
+ }
+
glibtop_read_i (server, backend, sizeof (glibtop_response), &resp);
fprintf (stderr, "RESPONSE: %d - %d - %ld - %ld - %p - %ld\n",
diff --git a/backends/server/server.c b/backends/server/server.c
index e738610d..3cf23158 100644
--- a/backends/server/server.c
+++ b/backends/server/server.c
@@ -108,12 +108,13 @@ void
handle_slave_connection (int input, int output)
{
glibtop_command _cmnd, *cmnd = &_cmnd;
+ glibtop *server = glibtop_global_server;
// glibtop_send_version_i (glibtop_global_server, output);
while (do_read (input, cmnd, sizeof (glibtop_command))) {
size_t recv_size = 0, send_size = 0, recv_data_size = 0;
- void *recv_ptr = NULL, *recv_data_ptr = NULL;
+ void *recv_ptr = NULL, *recv_data_ptr = NULL, *data_ptr = NULL;
char parameter [BUFSIZ];
int retval, func_retval;
glibtop_response resp;
@@ -147,9 +148,18 @@ handle_slave_connection (int input, int output)
memcpy (parameter, cmnd->parameter, send_size);
}
- retval = glibtop_demarshal_func_i (glibtop_global_server, NULL,
- cmnd->command, parameter,
- send_size, NULL, 0,
+ if (cmnd->data_size) {
+ fprintf (stderr, "CLIENT has %d bytes of extra data for us.\n",
+ cmnd->data_size);
+
+ data_ptr = glibtop_malloc_r (server, cmnd->data_size);
+ do_read (input, data_ptr, cmnd->data_size);
+ }
+
+ retval = glibtop_demarshal_func_i (server, NULL,
+ cmnd->command,
+ parameter, send_size,
+ data_ptr, cmnd->data_size,
&recv_ptr, &recv_size,
&recv_data_ptr, &recv_data_size,
&func_retval);