Skip to content

Commit

Permalink
module api may actually get more peers now.
Browse files Browse the repository at this point in the history
git-svn-id: https://subversion.cs.uiuc.edu/svn/bang/eoh2009@163 69d76c3e-0761-0410-948c-9895a8bb34fc
  • Loading branch information
nbysani2 committed Mar 13, 2009
1 parent a88e707 commit b8fe1b4
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/base/bang-module-api.c
Expand Up @@ -64,12 +64,22 @@ void BANG_get_me_peers(BANG_module_info *info) {

BANG_linked_list *peers_to_bug = BANG_not_route_get_peer_id(valid_routes);
int *cur;
void *data;
int data_length = info->module_name_length + 4 + sizeof(uuid_t);
BANG_request *req;


/* TODO: Put the module info inside the data... */

while ((cur = BANG_linked_list_pop(peers_to_bug)) != NULL) {
req = new_BANG_request(BANG_MODULE_PEER_REQUEST,NULL,0);
data = malloc(data_length);

strcpy(data,info->module_name);
data[info->module_name_length] = 0;
memcpy(data + info->module_name_length + 1, info->module_version, 3);
memcpy(data + info->module_name_length + 4, info->peers_info->uuids[info->my_id], sizeof(uuid_t));

req = new_BANG_request(BANG_MODULE_PEER_REQUEST,data,0);
BANG_request_peer_id(*cur,req);
free(cur);
}
Expand Down

0 comments on commit b8fe1b4

Please sign in to comment.