bug fix for Stomp::readFrame, was occasionally reading more than one Frame #22

Merged
merged 1 commit into from Feb 23, 2013

Projects

None yet

2 participants

@boonedox
Contributor

fread reads up to specified number of bytes or EOF.
fgets reads up to "\n", number of bytes or EOF.

The problem with fread is that if there is more than one Frame
on the socket, it will read the current Frame and part of the next
Frame.  Stomp::readFrame() is expected to just read the next Frame.

@boonedox boonedox use fgets instead of fread in Stomp::readFrame()
fread reads up to specified number of bytes or EOF.
fgets reads up to "\n", number of bytes or EOF.

The problem with fread is that if there is more than one Frame
on the socket, it will read the current Frame and part of the next
Frame.  Stomp::readFrame() is expected to just read the next Frame.
e143d5c
@monofone monofone merged commit 4ac51c0 into dejanb:master Feb 23, 2013
@monofone
Collaborator

Thanks for your Help

@jmglsn jmglsn added a commit to stomp-php/stomp-php that referenced this pull request Jul 27, 2015
@jmglsn jmglsn Read until first EOL instead of full 1024 bytes. fixes dejanb/stomp-p…
…hp#22

The deleted test case seems to check for a unwanted behavior. The client might acted too greedy, buffering frames.
5f74d45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment