dango 0.0.29 → 0.0.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -152,6 +152,16 @@ class DangoClientFramework
|
|
152
152
|
def dango_receive__notice_system_message(rec_obj)
|
153
153
|
end
|
154
154
|
|
155
|
+
# ハートビートなら
|
156
|
+
def dango_receive__heart_beat(rec_obj)
|
157
|
+
end
|
158
|
+
|
159
|
+
# 必要に応じて追加するメソッド
|
160
|
+
def method_missing(name, *args)
|
161
|
+
logger.info "method not found. #{name.inspect} #{args.inspect}"
|
162
|
+
raise(NameError, "method not found. #{name.inspect} #{args.inspect}")
|
163
|
+
end
|
164
|
+
|
155
165
|
# ユーザーが終了させたい時に呼び出すメソッド(セッションを切る)
|
156
166
|
def dango_client_close
|
157
167
|
client_quit() # クライアントの終了処理
|
@@ -253,8 +263,6 @@ class DangoClientFramework
|
|
253
263
|
raise(DangoFrameworkError, "received data is none")
|
254
264
|
end
|
255
265
|
|
256
|
-
#remove_method(instance_method_name) # 定義したインスタンスメソッドを削除しておく
|
257
|
-
|
258
266
|
send_return_shared[action_name]
|
259
267
|
end
|
260
268
|
end
|
@@ -556,7 +556,7 @@ class DangoServerFramework
|
|
556
556
|
# sock = socket_list[sid]
|
557
557
|
# logger.debug "heart_beat_thread_start:sid=#{sid} #{sock} #{sock.closed?}"
|
558
558
|
# dango_send_data(sock, {})
|
559
|
-
logger.debug "heart_beat_thread_start:sid=#{sid}"
|
559
|
+
# logger.debug "heart_beat_thread_start:sid=#{sid}"
|
560
560
|
send_notice(sid, "_heart_beat", {}, {:timeout=>@heart_beat_response_wait_sec})
|
561
561
|
end
|
562
562
|
end
|
@@ -679,7 +679,7 @@ class DangoServerFramework
|
|
679
679
|
end # catch 終わり
|
680
680
|
|
681
681
|
if !have_came_response # 戻ってきたデータがあるかどうかチェック
|
682
|
-
logger.warn "!!! received data is none:#{notice_name} #{sid} #{Time.now_to_s}"
|
682
|
+
logger.warn "!!! received data is none:#{notice_name} #{sid} #{send_obj_dup['_id']} #{Time.now_to_s}"
|
683
683
|
end
|
684
684
|
end
|
685
685
|
end # mutex
|
@@ -122,19 +122,19 @@ class TestClient < DangoClientFramework
|
|
122
122
|
raise(ArgumentError, ":proc is not Proc class.") if trap_proc && ! trap_proc.is_a?(Proc)
|
123
123
|
|
124
124
|
# 戻ってきたデータのチェックメソッド
|
125
|
-
notice_name_sym = (notice_name.class == Symbol) ? (":"+notice_name.to_s) : ('"'+notice_name+'"')
|
126
125
|
|
127
|
-
if ! @receive_methods.include?(notice_name_sym)
|
126
|
+
# if ! @receive_methods.include?(notice_name_sym)
|
127
|
+
notice_name_sym = (notice_name.class == Symbol) ? (":"+notice_name.to_s) : ('"'+notice_name+'"')
|
128
128
|
instance_method_name = "dango_receive_#{notice_name}"
|
129
129
|
expr = <<-EOF
|
130
130
|
def self.#{instance_method_name}(ret_obj)
|
131
|
-
logger.debug "ret_obj:" + ret_obj.inspect + " " + Time.now_to_s
|
131
|
+
logger.debug "ret_obj:#{notice_name_sym}:" + ret_obj.inspect + " " + Time.now_to_s
|
132
132
|
send_receive_shared[#{notice_name_sym}] = ret_obj
|
133
133
|
end
|
134
134
|
EOF
|
135
135
|
instance_eval expr
|
136
|
-
@receive_methods.push(notice_name_sym)
|
137
|
-
end
|
136
|
+
# @receive_methods.push(notice_name_sym)
|
137
|
+
# end
|
138
138
|
|
139
139
|
# @trap_thread_hashにスレッド登録
|
140
140
|
if ! @trap_thread_hash.has_key?(notice_name)
|
@@ -157,7 +157,7 @@ class TestClient < DangoClientFramework
|
|
157
157
|
|
158
158
|
# 戻ってきたデータがあれば
|
159
159
|
if send_receive_shared[notice_name]
|
160
|
-
logger.debug "notice_name:#{send_receive_shared[notice_name].inspect} #{Time.now_to_s}"
|
160
|
+
logger.debug "notice_name:#{notice_name}:#{send_receive_shared[notice_name].inspect} #{Time.now_to_s}"
|
161
161
|
break
|
162
162
|
end
|
163
163
|
|
@@ -173,18 +173,28 @@ class TestClient < DangoClientFramework
|
|
173
173
|
if trap_proc
|
174
174
|
logger.debug "trap_receive_data:trap_proc:#{trap_proc.inspect} #{Time.now_to_s}"
|
175
175
|
trap_proc.call(send_receive_shared[notice_name])
|
176
|
+
send_receive_shared[notice_name] = nil
|
176
177
|
break if ! trap_loop # loopする必要がなければスレッド終了
|
177
178
|
|
178
179
|
# :procが設定されていなければ、wait用に@receive_arrに入れておく
|
179
180
|
else
|
180
181
|
@receive_mutex.synchronize do
|
181
182
|
logger.debug "notice_name:#{notice_name}:#{send_receive_shared[notice_name].inspect} #{Time.now_to_s}"
|
182
|
-
@receive_arr.push([notice_name, send_receive_shared[notice_name]])
|
183
|
+
@receive_arr.push([notice_name.deep_dup, send_receive_shared[notice_name].deep_dup])
|
184
|
+
send_receive_shared[notice_name] = nil
|
183
185
|
end
|
184
186
|
break # スレッド終了
|
185
187
|
|
186
188
|
end
|
187
189
|
end # loop
|
190
|
+
|
191
|
+
# メソッドの削除
|
192
|
+
instance_method_name = "dango_receive_#{notice_name}"
|
193
|
+
expr = <<-EOF
|
194
|
+
def self.#{instance_method_name}(ret_obj); end
|
195
|
+
EOF
|
196
|
+
instance_eval expr
|
197
|
+
|
188
198
|
end # Thread
|
189
199
|
|
190
200
|
@trap_thread_hash[notice_name] = th
|
@@ -201,13 +211,21 @@ class TestClient < DangoClientFramework
|
|
201
211
|
|
202
212
|
# trapスレッドの削除
|
203
213
|
if @trap_thread_hash[notice_name]
|
214
|
+
logger.debug "cancel_trap_receive:#{@trap_thread_hash[notice_name].status }:#{Time.now_to_s}"
|
204
215
|
@trap_thread_hash[notice_name].kill
|
216
|
+
logger.debug "cancel_trap_receive:#{@trap_thread_hash[notice_name].status }:#{Time.now_to_s}"
|
205
217
|
@trap_thread_hash[notice_name].join
|
218
|
+
logger.debug "cancel_trap_receive:#{@trap_thread_hash[notice_name].status }:#{Time.now_to_s}"
|
206
219
|
|
207
220
|
@trap_thread_hash.delete(notice_name)
|
208
221
|
end
|
209
222
|
|
210
|
-
|
223
|
+
# 受信データのごみを削除
|
224
|
+
send_receive_shared[notice_name] = nil
|
225
|
+
|
226
|
+
@receive_mutex.synchronize do
|
227
|
+
@receive_arr.delete_if{|r| r[0] == notice_name}
|
228
|
+
end
|
211
229
|
end
|
212
230
|
|
213
231
|
# wait_receive
|
data/lib/dango/version.rb
CHANGED
metadata
CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.4
|
|
3
3
|
specification_version: 1
|
4
4
|
name: dango
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.0.
|
7
|
-
date: 2007-11-
|
6
|
+
version: 0.0.30
|
7
|
+
date: 2007-11-09 00:00:00 +09:00
|
8
8
|
summary: Realtime communications network framework for Ruby and Flash on Rails.
|
9
9
|
require_paths:
|
10
10
|
- lib
|