lib/angelo/stash.rb in angelo-0.2.0 vs lib/angelo/stash.rb in angelo-0.2.1
- old
+ new
@@ -36,11 +36,10 @@
# server handle_websocket task to read from the socket and fire events
# as needed
#
def << s
peeraddrs[s] = s.peeraddr
- yield if block_given?
stashes[@context] << s
end
# access the underlying array of this context
#
@@ -50,11 +49,11 @@
# iterate on each connected websocket in this context, handling errors
# as needed
#
def each &block
- stash.each do |s|
+ stash.dup.each do |s|
begin
yield s
rescue Reel::SocketError, IOError, SystemCallError => e
debug "context: #{@context} - #{e.message}"
remove_socket s
@@ -116,12 +115,11 @@
class Websocket
extend Stash::ClassMethods
include Stash
def << ws
- super do
- @server.async.handle_websocket ws
- end
+ super
+ @server.async.handle_websocket ws
end
end
class SSE