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

@@ -90,12 +90,12 @@ int main(int count, char *strings[])
}
do {
struct msg buf;
memset(&buf, 0, sizeof(struct msg));
bytes = SSL_read(ssl, &buf, sizeof(struct msg));
struct msg_t buf;
memset(&buf, 0, sizeof(struct msg_t));
bytes = SSL_read(ssl, &buf, sizeof(struct msg_t));
if (bytes > 0) {
short index;
if (bytes != sizeof(struct msg)) {
if (bytes != sizeof(struct msg_t)) {
fprintf( stderr,
"Received non-standard data from server!\n" );
continue;
@@ -104,11 +104,11 @@ int main(int count, char *strings[])
if ((index = get_job_slot()) == FAIL) {
buf.chunk.id = -1; /* ID -1 means reject (full) */
sprintf((char*)buf.chunk.data, "The agent's queue is full!");
SSL_write(ssl, &buf, sizeof(struct msg));
SSL_write(ssl, &buf, sizeof(struct msg_t));
continue;
}
args[index].slot = FULL;
memcpy(&args[index].buf, &buf, sizeof(struct msg));
memcpy(&args[index].buf, &buf, sizeof(struct msg_t));
switch (args[index].buf.meta.type) {
case UNIX:
pthread_create( &job_thread[index],
@@ -181,7 +181,7 @@ int main(int count, char *strings[])
sprintf( (char*)buf.chunk.data,
"Unsupported job type with ID: %d",
buf.meta.type );
SSL_write(ssl, &buf, sizeof(struct msg));
SSL_write(ssl, &buf, sizeof(struct msg_t));
continue;
}
} else {
@@ -189,9 +189,9 @@ int main(int count, char *strings[])
if (index == FAIL) {
sprintf( (char*)buf.chunk.data,
"Data was sent for an invalid job ID" );
SSL_write(ssl, &buf, sizeof(struct msg));
SSL_write(ssl, &buf, sizeof(struct msg_t));
} else
memcpy(&args[index].buf, &buf, sizeof(struct msg));
memcpy(&args[index].buf, &buf, sizeof(struct msg_t));
}
}