gamespy_query 0.2.0pre8 → 0.2.0pre9
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/gamespy_query/socket_master.rb +12 -2
- data/lib/gamespy_query/version.rb +1 -1
- metadata +1 -1
@@ -87,12 +87,22 @@ module GamespyQuery
|
|
87
87
|
dat = master.process list
|
88
88
|
|
89
89
|
ded = "1"
|
90
|
-
gm_dat = dedicated_only || sm_dedicated_only
|
90
|
+
gm_dat = if dedicated_only || sm_dedicated_only
|
91
|
+
h = {}
|
92
|
+
dat.each_pair do |k, v|
|
93
|
+
next unless v[:gamedata] && v[:gamedata][:dedicated] == ded
|
94
|
+
h[k] = v
|
95
|
+
end
|
96
|
+
h
|
97
|
+
else
|
98
|
+
dat
|
99
|
+
end
|
100
|
+
|
91
101
|
sm = GamespyQuery::SocketMaster.new(gm_dat.keys)
|
92
102
|
sockets = sm.process!
|
93
103
|
sockets.select{|s| s.valid? }.each do |s|
|
94
104
|
begin
|
95
|
-
data =
|
105
|
+
data = gm_dat[s.addr]
|
96
106
|
data[:ip], data[:port] = s.addr.split(":")
|
97
107
|
data[:gamename] = game
|
98
108
|
data[:gamedata].merge!(s.sync(s.data))
|