Skip to content

Commit

Permalink
In bang-read-thread.c implemented read_request_job, read_available_jo…
Browse files Browse the repository at this point in the history
…b, read_finished_job - mostly copypasta, assuming I did it right.

git-svn-id: https://subversion.cs.uiuc.edu/svn/bang/eoh2009@136 69d76c3e-0761-0410-948c-9895a8bb34fc
  • Loading branch information
asjacob2 committed Mar 8, 2009
1 parent 3a69094 commit f01d5b8
Showing 1 changed file with 91 additions and 3 deletions.
94 changes: 91 additions & 3 deletions src/base/bang-read-thread.c
Expand Up @@ -262,15 +262,103 @@ static char read_module_request(BANG_peer *self) {
}

static char read_request_job(BANG_peer *self) {
return 0;
uuid_t auth, peer;

read_uuid(self,auth);
if (uuid_is_null(auth)) {
return 0;
}

read_uuid(self,peer);
if (uuid_is_null(peer)) {
return 0;
}

BANG_route_request_job(peer, auth);
return 1;
}

static char read_available_job(BANG_peer *self) {
return 0;
uuid_t auth, peer;

read_uuid(self,auth);
if (uuid_is_null(auth)) {
return 0;
}

read_uuid(self,peer);
if (uuid_is_null(peer)) {
return 0;
}

BANG_job job;

/* MAGIC NUMBER AGAIN */
int *job_number = (int*) read_message(self,4);
if (job_number == NULL) {
return 0;
}

job.job_number = *job_number;
free(job_number);

unsigned int *job_length = (unsigned int*) read_message(self,LENGTH_OF_LENGTHS);
if (job_length == NULL) {
return 0;
}

job.length = *job_length;
free(job_length);

job.data = read_message(self,job.length);
if (job.data == NULL) {
return 0;
}

BANG_route_finished_job(auth, peer, &job);
return 1;
}

static char read_finished_job(BANG_peer *self) {
return 0;
uuid_t auth, peer;

read_uuid(self,auth);
if (uuid_is_null(auth)) {
return 0;
}

read_uuid(self,peer);
if (uuid_is_null(peer)) {
return 0;
}

BANG_job job;

/* MAGIC NUMBER AGAIN */
int *job_number = (int*) read_message(self,4);
if (job_number == NULL) {
return 0;
}

job.job_number = *job_number;
free(job_number);

unsigned int *job_length = (unsigned int*) read_message(self,LENGTH_OF_LENGTHS);
if (job_length == NULL) {
return 0;
}

job.length = *job_length;
free(job_length);

job.data = read_message(self,job.length);
if (job.data == NULL) {
return 0;
}

BANG_route_finished_job(auth, peer, &job);

return 1;
}

void* BANG_read_peer_thread(void *self_info) {
Expand Down

0 comments on commit f01d5b8

Please sign in to comment.