Skip to content
This repository has been archived by the owner on Mar 8, 2023. It is now read-only.

Commit

Permalink
replay-buffer: fix duff's device
Browse files Browse the repository at this point in the history
  • Loading branch information
skenqbx committed Apr 21, 2015
1 parent 945b426 commit 42634f5
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/replay-buffer.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,10 @@ ReplayBuffer.prototype.replay = function(writable, callback) {
// https://en.wikipedia.org/wiki/Duff%27s_device
(function next() {
var mod = 0;
var n = self.chunks.length - i;

if (self.chunks.length < 4) {
mod = (self.chunks.length - i) % 4;
if (n < 4) {
mod = n % 4;
}
// TODO: write callback!

Expand Down

0 comments on commit 42634f5

Please sign in to comment.