Skip to content

Commit

Permalink
Merge pull request #52 from splashlab/empty_status_enqueue
Browse files Browse the repository at this point in the history
Fix for consume loop to prevent passing empty "\r\n" statuses to enqueueStatus()
  • Loading branch information
Marko Pavlovic committed Jan 16, 2014
2 parents 4d2df59 + 92026de commit d34c8b7
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/Phirehose.php
Original file line number Diff line number Diff line change
Expand Up @@ -464,6 +464,10 @@ public function consume($reconnect = TRUE)
//Process each full tweet inside $this->buff
while(1){
$eol = strpos($this->buff,"\r\n"); //Find next line ending
if($eol===0) { // if 0, then buffer starts with "\r\n", so trim it and loop again
$this->buff = substr($this->buff,$eol+2); // remove the "\r\n" from line start
continue; // loop again
}
if($eol===false)break; //Time to get more data
$enqueueStart = microtime(TRUE);
$this->enqueueStatus(substr($this->buff,0,$eol));
Expand Down

0 comments on commit d34c8b7

Please sign in to comment.