Correctly pass string data from client to server.

This commit is contained in:
Martin Baulig
2000-01-09 22:12:49 +00:00
parent fa592c3a94
commit c164df664d
2 changed files with 21 additions and 4 deletions

View File

@@ -64,8 +64,15 @@ glibtop_call_i (glibtop *server, glibtop_backend *backend, unsigned command,
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",

View File

@@ -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);