remote control tests.

git-svn-id: file:///svn/unbound/trunk@1270 be551aaa-1e26-0410-a405-d3ace91eadb9
This commit is contained in:
Wouter Wijngaards 2008-09-26 13:02:34 +00:00
parent 66dcc95a78
commit 556d5407e2
5 changed files with 20 additions and 17 deletions

View File

@ -939,9 +939,9 @@ do_zone_remove(SSL* ssl, struct worker* worker, char* arg)
nmlabs, LDNS_RR_CLASS_IN))) {
/* present in tree */
local_zones_del_zone(worker->daemon->local_zones, z);
free(nm);
}
lock_quick_unlock(&worker->daemon->local_zones->lock);
free(nm);
send_ok(ssl);
}

View File

@ -1,3 +1,8 @@
26 September 2008: Wouter
- tests for remote-control.
- small memory leak in exception during remote control fixed.
- fixup for lock checking but not unchecking in remote control.
23 September 2008: Wouter
- Msg cache is loaded. A cache load enables cache responses.
- unbound-control flush [name], flush_type and flush_zone.

View File

@ -144,8 +144,8 @@ parse_dname(const char* str, uint8_t** res, size_t* len, int* labs)
/** create a new localzone */
static struct local_zone*
local_zone_create(struct local_zones* zones, uint8_t* nm, size_t len,
int labs, enum localzone_type t, uint16_t dclass)
local_zone_create(uint8_t* nm, size_t len, int labs,
enum localzone_type t, uint16_t dclass)
{
struct local_zone* z = (struct local_zone*)calloc(1, sizeof(*z));
if(!z) {
@ -165,13 +165,7 @@ local_zone_create(struct local_zones* zones, uint8_t* nm, size_t len,
}
rbtree_init(&z->data, &local_data_cmp);
lock_protect(&z->lock, &z->parent, sizeof(*z)-sizeof(rbnode_t));
lock_protect(&zones->lock, &z->node, sizeof(z->node));
lock_protect(&zones->lock, &z->parent, sizeof(z->parent));
lock_protect(&zones->lock, &z->name, sizeof(z->name));
lock_protect(&zones->lock, &z->namelen, sizeof(z->namelen));
lock_protect(&zones->lock, &z->namelabs, sizeof(z->namelabs));
lock_protect(&zones->lock, &z->dclass, sizeof(z->dclass));
(void)zones; /* avoid argument unused warning if no lock checks */
/* also the zones->lock protects node, parent, name*, class */
return z;
}
@ -180,7 +174,7 @@ static struct local_zone*
lz_enter_zone_dname(struct local_zones* zones, uint8_t* nm, size_t len,
int labs, enum localzone_type t, uint16_t c)
{
struct local_zone* z = local_zone_create(zones, nm, len, labs, t, c);
struct local_zone* z = local_zone_create(nm, len, labs, t, c);
if(!z) {
log_err("out of memory");
return NULL;
@ -1180,8 +1174,7 @@ struct local_zone* local_zones_add_zone(struct local_zones* zones,
enum localzone_type tp)
{
/* create */
struct local_zone* z = local_zone_create(zones, name, len, labs, tp,
dclass);
struct local_zone* z = local_zone_create(name, len, labs, tp, dclass);
if(!z) return NULL;
lock_rw_wrlock(&z->lock);

View File

@ -58,10 +58,10 @@ usage()
printf(" -s ip[@port] server address, if omitted config is used.\n");
printf(" -h show this usage help.\n");
printf("Commands:\n");
printf(" start start server; runs unbound(8)\n");
printf(" stop stops the server\n");
printf(" reload reloads the server\n");
printf(" stats print statistics\n");
printf(" start start server; runs unbound(8)\n");
printf(" stop stops the server\n");
printf(" reload reloads the server\n");
printf(" stats print statistics\n");
printf(" verbosity [number] change logging detail\n");
printf(" local_zone [name] [type] add new local zone\n");
printf(" local_zone_remove [name] remove local zone and its contents\n");
@ -302,6 +302,11 @@ int main(int argc, char* argv[])
int c, ret;
char* cfgfile = CONFIGFILE;
char* svr = NULL;
#ifdef USE_THREAD_DEBUG
/* stop the file output from unbound-control, overwites the servers */
extern int check_locking_order;
check_locking_order = 0;
#endif /* USE_THREAD_DEBUG */
log_ident_set("unbound-control");
log_init(NULL, 0, NULL);
checklock_start();

Binary file not shown.