Navigation Menu

Skip to content

Commit

Permalink
Library now compiles, I dunno what it would do if you actual ran it
Browse files Browse the repository at this point in the history
though.  Anyway, modules no longer compile.
  • Loading branch information
Nikhil Samith Bysani committed Jan 20, 2009
1 parent 6450897 commit 05edd53
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
21 changes: 19 additions & 2 deletions src/base/bang-module.c
Expand Up @@ -48,7 +48,7 @@ static unsigned char* module_hash(char *path) {

unsigned char *md = (unsigned char*) calloc(SHA_DIGEST_LENGTH,sizeof(unsigned char));

static EVP_MD_CTX *ctx = NULL;
static EVP_MD_CTX *ctx = NULL;
ctx = (ctx == NULL) ? EVP_MD_CTX_create() : ctx;

EVP_MD_CTX_init(ctx);
Expand Down Expand Up @@ -83,7 +83,7 @@ static BANG_api* get_BANG_api() {
if (api == NULL) {
/*If we forget to do something in this function, this will force
* the program to segfault when a module calls a function
* we were susposed to give them.
* we were susposed to give them.
* calloc sets everything to zero*/

/* This is memory will 'leak' we will let the OS clean it up, because
Expand Down Expand Up @@ -265,6 +265,23 @@ void* BANG_get_symbol(BANG_module *module, char *symbol) {
void BANG_module_callback_job_available(const BANG_module *module, uuid_t auth, uuid_t peer) {
assert(module != NULL);

/* Make sure they have the right module. */
if (uuid_compare(module->info->peers_info->uuids[module->info->my_id],auth) == 0) {

/* TODO: USE LOCKS! */
int i = 0;
for (i = 0; i < module->info->peers_info->peer_number; ++i) {
if (uuid_compare(module->info->peers_info->uuids[i],peer) == 0) {
module->callbacks->jobs_available(module->info,i);
}
}
}
}


void BANG_module_callback_job_request(const BANG_module *module, uuid_t auth, uuid_t peer) {
assert(module != NULL);

/* Make sure they have the right module. */
if (uuid_compare(module->info->peers_info->uuids[module->info->my_id],auth) == 0) {

Expand Down
3 changes: 1 addition & 2 deletions src/base/bang-module.h
Expand Up @@ -43,7 +43,7 @@ void BANG_run_module(BANG_module *module);
* \param auth The uuid of the authority saying a job is available.
* \param peer The uuid of the peer being told that a job is available at auth.
*
* \brief A callback to tell peer with module that there is a job availabel held
* \brief A callback to tell peer with module that there is a job available held
* by auth.
*/
void BANG_module_callback_job_available(const BANG_module *module, uuid_t auth, uuid_t peer);
Expand All @@ -56,5 +56,4 @@ void BANG_module_callback_job_available(const BANG_module *module, uuid_t auth,
* \brief A callback to tell the authority that the uuid peer wants a job.
*/
void BANG_module_callback_job_request(const BANG_module *module, uuid_t auth, uuid_t peer);

#endif

0 comments on commit 05edd53

Please sign in to comment.