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

View file

@ -112,6 +112,7 @@ typedef struct
DB* db; DB* db;
const char* name; const char* name;
PortList* ports; PortList* ports;
int active_ports;
} Database; } Database;
@ -129,6 +130,8 @@ typedef struct
DbRefList* dbrefs; /* List of databases that this port has opened */ 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 DB_TXN* txn; /* Transaction handle for this port; each port may only have 1 txn
* active */ * active */