Added active counts to dbref and portref to help see what is being corrupted

in the coredump.
This commit is contained in:
Jon Meredith 2009-06-18 09:09:29 -06:00 committed by Phillip Toland
parent 86f39286b1
commit 2077413b9e
2 changed files with 9 additions and 0 deletions

View file

@ -1900,6 +1900,7 @@ static int add_portref(int dbref, ErlDrvPort port)
current = (PortList*)zalloc(sizeof(PortList));
current->port = port;
last->next = current;
G_DATABASES[dbref].active_ports++;
return 1;
}
else
@ -1908,6 +1909,7 @@ static int add_portref(int dbref, ErlDrvPort port)
current = zalloc(sizeof(PortList));
current->port = port;
G_DATABASES[dbref].ports = current;
G_DATABASES[dbref].active_ports++;
return 1;
}
}
@ -1934,6 +1936,7 @@ static int del_portref(int dbref, ErlDrvPort port)
// Delete this entry
zfree(current);
G_DATABASES[dbref].active_ports--;
return 1;
}
@ -1970,6 +1973,7 @@ static int add_dbref(PortData* data, int dbref)
current = zalloc(sizeof(DbRefList));
current->dbref = dbref;
last->next = current;
data->active_dbs++;
return 1;
}
else
@ -1978,6 +1982,7 @@ static int add_dbref(PortData* data, int dbref)
current = zalloc(sizeof(DbRefList));
current->dbref = dbref;
data->dbrefs = current;
data->active_dbs++;
return 1;
}
}
@ -2009,6 +2014,7 @@ static int del_dbref(PortData* data, int dbref)
// Delete this entry
zfree(current);
data->active_dbs--;
return 1;
}

View file

@ -112,6 +112,7 @@ typedef struct
DB* db;
const char* name;
PortList* ports;
int active_ports;
} Database;
@ -129,6 +130,8 @@ typedef struct
DbRefList* dbrefs; /* List of databases that this port has opened */
int active_dbs; /* Count of entries in dbrefs (for debug) */
DB_TXN* txn; /* Transaction handle for this port; each port may only have 1 txn
* active */