Skip to content

Commit

Permalink
Some documentation, and changed a function to work.
Browse files Browse the repository at this point in the history
git-svn-id: https://subversion.cs.uiuc.edu/svn/bang/eoh2009@34 69d76c3e-0761-0410-948c-9895a8bb34fc
  • Loading branch information
nbysani2 committed Jan 24, 2009
1 parent 31ec68f commit 62b4ca2
Showing 1 changed file with 17 additions and 8 deletions.
25 changes: 17 additions & 8 deletions src/base/bang-module-api.c
Expand Up @@ -20,10 +20,14 @@
* \param uuid The place the uuid is placed.
*
* \brief Gets a uuid from the info, or puts NULL there
* TODO: Use locks!
*/
static void get_uuid_from_id(uuid_t uuid, int id, BANG_module_info *info);

/**
* \param info The info about a module.
*
* \brief Gets a list of valid uuid's from the information.
*/
static uuid_t* get_valid_routes(BANG_module_info *info);

static void get_uuid_from_id(uuid_t uuid, int id, BANG_module_info *info) {
Expand Down Expand Up @@ -57,11 +61,6 @@ static uuid_t* get_valid_routes(BANG_module_info *info) {
return valid_routes;
}

/* TODO: Implement this. Well, this is basically what are our app is all about.
* TODO: LOCKS
*
* Note: This is no longer what out app is about, I added another layer of indirection.
*/
void BANG_debug_on_all_peers(BANG_module_info *info, char *message) {
/* The first slot will be us, so skip that. */
fprintf(stderr,"%s",message);
Expand All @@ -75,6 +74,7 @@ void BANG_debug_on_all_peers(BANG_module_info *info, char *message) {

}

/* TODO: Request something... */
void BANG_get_me_peers(BANG_module_info *info) {
/* This does not use routing...! */
uuid_t *valid_routes = get_valid_routes(info);
Expand All @@ -87,9 +87,18 @@ void BANG_get_me_peers(BANG_module_info *info) {
int BANG_number_of_active_peers(BANG_module_info *info) {
/* The way we store ids may change in the future, so this is a simple
* wrapper function
*
*/
return info->peers_info->peer_number;
int i = 0,j = 0;

BANG_read_lock(info->lck);
for (; i < info->peers_info->peers_number; ++i) {
if (info->peers_info->validity[i])
++j;
}

BANG_read_lock(info->lck);

return j;
}

int BANG_get_my_id(BANG_module_info *info) {
Expand Down

0 comments on commit 62b4ca2

Please sign in to comment.