Rename protocol structs

This commit is contained in:
2016-08-12 12:18:10 +03:00
parent dcd7a46d0a
commit 3309026308
5 changed files with 25 additions and 25 deletions

View File

@@ -83,14 +83,14 @@ void* get_os(void *args)
if ((fd = open(dump_path, O_RDONLY)) == -1) {
fprintf(stderr, "Cannot open file: %s\n", dump_path);
job->buf.meta.len = sprintf((char*)job->buf.chunk.data, "Unknown");
SSL_write(job->ssl, &job->buf, sizeof(struct msg));
SSL_write(job->ssl, &job->buf, sizeof(struct msg_t));
} else {
job->buf.meta.len = read(fd, job->buf.chunk.data, sizeof(job->buf.chunk.data));
if ((signed)job->buf.meta.len == -1) {
perror("Failed to read from file: ");
}
close(fd);
SSL_write(job->ssl, &job->buf, sizeof(struct msg));
SSL_write(job->ssl, &job->buf, sizeof(struct msg_t));
job->slot = FREE;
}
unlink(dump_path);
@@ -103,7 +103,7 @@ void* get_kernel(void *args)
struct job_args *job = args;
if (uname(&name) == -1) {
job->buf.meta.len = sprintf((char*)job->buf.chunk.data, "Unknown");
SSL_write(job->ssl, &job->buf, sizeof(struct msg));
SSL_write(job->ssl, &job->buf, sizeof(struct msg_t));
} else {
job->buf.meta.len = sprintf( (char*)job->buf.chunk.data,
"%s %s %s %s %s",
@@ -112,7 +112,7 @@ void* get_kernel(void *args)
name.release,
name.version,
name.machine );
SSL_write(job->ssl, &job->buf, sizeof(struct msg));
SSL_write(job->ssl, &job->buf, sizeof(struct msg_t));
}
job->slot = FREE;
return 0;
@@ -125,11 +125,11 @@ void* get_uptime(void *args)
if (sysinfo(&sys) != 0) {
job->buf.meta.len = sprintf((char*)job->buf.chunk.data, "Unknown");
SSL_write(job->ssl, &job->buf, sizeof(struct msg));
SSL_write(job->ssl, &job->buf, sizeof(struct msg_t));
} else {
memcpy(&job->buf.chunk.data, &sys.uptime, sizeof(long));
//sprintf((char*)&job->buf.chunk.data, "%ld", sys.uptime);
SSL_write(job->ssl, &job->buf, sizeof(struct msg));
SSL_write(job->ssl, &job->buf, sizeof(struct msg_t));
}
job->slot = FREE;
return 0;
@@ -147,7 +147,7 @@ void* get_memory(void *args)
"%ld / %ld (MB)",
((pages - freepages) * pagesize) / 1048576 /* 1024*1024 */,
(pages * pagesize) / 1048576 );
SSL_write(job->ssl, &job->buf, sizeof(struct msg));
SSL_write(job->ssl, &job->buf, sizeof(struct msg_t));
job->slot = FREE;
//return 0;
pthread_detach(pthread_self());