IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 4467


Ignore:
Timestamp:
Jul 6, 2005, 2:16:11 PM (21 years ago)
Author:
jhoblitt
Message:

change nebCull() to return bool
change nebCull() param key to be const
fill in nebCull() source

Location:
trunk/Nebulous/nebclient/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Nebulous/nebclient/src/nebclient.c

    r4466 r4467  
    44 * Copyright (C) 2005  Joshua Hoblitt
    55 *
    6  * $Id: nebclient.c,v 1.8 2005-07-06 23:32:19 jhoblitt Exp $
     6 * $Id: nebclient.c,v 1.9 2005-07-07 00:16:11 jhoblitt Exp $
    77 */
    88
     
    146146}
    147147
    148 int nebCull(nebServer *server, char *key)
     148bool nebCull(nebServer *server, const char *key)
    149149{
    150150    char            **locations;
    151151    int             n;
    152152
    153     n = nebFindInstances(server, key, NULL, &locations);
    154 
    155     printf( "found %d instances\n", n );
    156 
    157     if (n < 2 ) {
     153    if (nebFindInstances(server, (char *)key, NULL, &locations) < 2) {
    158154        fprintf(stderr, "can not cull - not enough instances");
    159         //free locations
    160         return -1;
    161     }
    162 
    163     return nebDeleteInstance(server, locations[0]);
     155
     156        return false;
     157    }
     158
     159    if (!nebDeleteInstance(server, locations[0])) {
     160        nebFree(locations);
     161
     162        return false;
     163    }
     164
     165    nebFree(locations);
     166
     167    return true;
    164168}
    165169
  • trunk/Nebulous/nebclient/src/nebclient.h

    r4466 r4467  
    44 * Copyright (C) 2005  Joshua Hoblitt
    55 *
    6  * $Id: nebclient.h,v 1.10 2005-07-06 23:32:19 jhoblitt Exp $
     6 * $Id: nebclient.h,v 1.11 2005-07-07 00:16:11 jhoblitt Exp $
    77 */
    88
     
    2626bool nebReplicate(nebServer *server, const char *key, const char *volume, char **URI);
    2727
    28 int nebCull(nebServer *server, char *key);
     28bool nebCull(nebServer *server, const char *key);
    2929
    3030int nebLock(nebServer *server, char *key, rw flag);
Note: See TracChangeset for help on using the changeset viewer.