mirror of
https://github.com/teampoltergeist/poltergeist.git
synced 2022-11-09 12:05:00 -05:00
Prevent potential infinite loop.
This may be part of the problem in #103, but I am not sure. I will try it and see if the issue reoccurs. Closes #103.
This commit is contained in:
parent
d9233c2d89
commit
122bb67b21
1 changed files with 3 additions and 0 deletions
|
@ -125,7 +125,10 @@ module Capybara::Poltergeist
|
|||
# Block until the next message is available from the Web Socket.
|
||||
# Raises Errno::EWOULDBLOCK if timeout is reached.
|
||||
def receive
|
||||
start = Time.now
|
||||
|
||||
until handler.message?
|
||||
raise Errno::EWOULDBLOCK if (Time.now - start) >= timeout
|
||||
IO.select([socket], [], [], timeout) or raise Errno::EWOULDBLOCK
|
||||
data = socket.recv(RECV_SIZE)
|
||||
break if data.empty?
|
||||
|
|
Loading…
Add table
Reference in a new issue