fix memory accounting for useless channels

Fix accounting for a channel that is without a
peer for sending and/or receiving.
This commit is contained in:
Matthew Flatt 2015-08-28 16:42:23 -06:00
parent b016246096
commit bfb4d34715

View File

@ -441,8 +441,10 @@ int BTC_bi_chan_mark(void *p, struct NewGC *gc)
/* Race conditions here on `mem_size', and likely double counting
when the same async channels are accessible from paired bi
channels --- but those approximations are ok for accounting. */
account_memory(gc, gc->current_mark_owner, gcBYTES_TO_WORDS(bc->link->sendch->mem_size), 0);
account_memory(gc, gc->current_mark_owner, gcBYTES_TO_WORDS(bc->link->recvch->mem_size), 0);
if (bc->link->sendch)
account_memory(gc, gc->current_mark_owner, gcBYTES_TO_WORDS(bc->link->sendch->mem_size), 0);
if (bc->link->recvch)
account_memory(gc, gc->current_mark_owner, gcBYTES_TO_WORDS(bc->link->recvch->mem_size), 0);
}
return gc->mark_table[btc_redirect_bi_chan](p, gc);
}