make OR not crash when non-OR connection dies

svn:r1319
This commit is contained in:
Roger Dingledine 2004-03-20 20:37:49 +00:00
parent 568a4e0a04
commit ed0ef86c0e
1 changed files with 8 additions and 0 deletions

View File

@ -131,6 +131,14 @@ void rep_hist_note_disconnect(const char* nickname, time_t when)
void rep_hist_note_connection_died(const char* nickname, time_t when)
{
or_history_t *hist;
if(!nickname) {
/* XXX
* If conn has no nickname, it's either an OP, or it is an OR
* which didn't complete its handshake (or did and was unapproved).
* Ignore it. Is there anything better we could do?
*/
return;
}
hist = get_or_history(nickname);
if (hist->up_since) {
hist->uptime += (when - hist->up_since);