Some bits here and there...
This commit is contained in:
@@ -41,7 +41,6 @@ static void show_certs(SSL *ssl)
|
||||
static void* servlet(void *args) /* Serve the connection -- threadable */
|
||||
{
|
||||
struct msg buf;
|
||||
char reply[2048];
|
||||
int bytes, ret;
|
||||
//unsigned short job[MAXJOBS] = { 0 };
|
||||
struct agent_args *agent = (struct agent_args*)args;
|
||||
@@ -56,7 +55,7 @@ static void* servlet(void *args) /* Serve the connection -- threadable */
|
||||
show_certs(agent->ssl);
|
||||
do {
|
||||
buf.meta.type = GET_MEMORY;
|
||||
//sleep(1);
|
||||
sleep(1);
|
||||
SSL_write(agent->ssl, &buf, sizeof(buf));
|
||||
bytes = SSL_read(agent->ssl, &buf, sizeof(buf));
|
||||
if (bytes > 0) {
|
||||
@@ -66,20 +65,19 @@ static void* servlet(void *args) /* Serve the connection -- threadable */
|
||||
agent->ip );
|
||||
continue;
|
||||
}
|
||||
//buf.chunk.data[bytes] = 0;
|
||||
|
||||
log_trace(VERBOSE, "Client msg: \"%s\"", buf.chunk.data);
|
||||
SSL_write(agent->ssl, buf.chunk.data, buf.meta.len); /* send reply */
|
||||
/* TODO: Insert msg handler here */
|
||||
|
||||
continue;
|
||||
}
|
||||
if (SSL_get_shutdown(agent->ssl) == SSL_RECEIVED_SHUTDOWN)
|
||||
log_trace(VERBOSE, "SSL_RECEIVED_SHUTDOWN from agent [%s]", agent->ip);
|
||||
else {
|
||||
log_trace(VERBOSE, "Client didn't send data! SSL error below:");
|
||||
log_ssl();
|
||||
sprintf(reply, "%s", "Where's the data, m8?");
|
||||
/* TODO: We crash here if we Ctrl + C the client, check why */
|
||||
//SSL_write(agent->ssl, reply, strlen(reply));
|
||||
//log_ssl(); /* We actually don't have anything to log from SSL */
|
||||
sprintf((char*)buf.chunk.data, "%s", "Where's the data, m8?");
|
||||
SSL_write(agent->ssl, &buf, sizeof(struct msg));
|
||||
}
|
||||
log_trace(INFO, "Agent [%s] disconnected.", agent->ip);
|
||||
} while (bytes);
|
||||
|
||||
Reference in New Issue
Block a user