dango 0.0.8 → 0.0.9
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.
- data/lib/dango/client_framework.rb +6 -1
- data/lib/dango/script/dango_server.rb +10 -3
- data/lib/dango/server_framework.rb +17 -16
- data/lib/dango/version.rb +1 -1
- metadata +2 -2
@@ -37,7 +37,7 @@ class DangoClientFramework
|
|
37
37
|
@config = config
|
38
38
|
|
39
39
|
# 変数の初期設定
|
40
|
-
@connection_client_host = @config['
|
40
|
+
@connection_client_host = @config['network']['host'] || 'localhost'
|
41
41
|
@connection_client_port = @config['network']['port'] || 15000
|
42
42
|
|
43
43
|
@connection_client_host = 'localhost' # 未定義時にこのホスト名でサーバー開始
|
@@ -120,6 +120,11 @@ class DangoClientFramework
|
|
120
120
|
end
|
121
121
|
cs_logger.debug "called method=#{ret_obj["notice"].inspect}"
|
122
122
|
|
123
|
+
# データの受信の送信返し
|
124
|
+
response_notice_name = "_response"
|
125
|
+
send_obj = {"_id" => ret_obj["_id"]}
|
126
|
+
cs_client_send_data(response_notice_name, send_obj)
|
127
|
+
|
123
128
|
else
|
124
129
|
sleep 0.1
|
125
130
|
end
|
@@ -10,19 +10,26 @@ require RAILS_ROOT + '/config/environment'
|
|
10
10
|
|
11
11
|
class ScriptDangoServer
|
12
12
|
def initialize(config = {}, start_options = {})
|
13
|
+
start_options.each do |k, v|
|
14
|
+
k =~ /\-\-(\w+?):(\w+?)$/
|
15
|
+
key1 = Regexp.last_match(1)
|
16
|
+
key2 = Regexp.last_match(2)
|
17
|
+
config[key1][key2] = v
|
18
|
+
end
|
19
|
+
|
13
20
|
# serverファイル名一覧を取得
|
14
21
|
load_files = []
|
15
22
|
glob_str = 'dango/server/*.rb'
|
16
23
|
Dir.glob(glob_str) do |srv_file|
|
17
24
|
load_files.push({:file=>srv_file, :mtime=>File.mtime(srv_file)})
|
18
25
|
end
|
19
|
-
|
26
|
+
|
20
27
|
# ファイル名順にソート
|
21
28
|
load_files = load_files.sort_by{|f| f[:file] }
|
22
29
|
load_files.each do |f|
|
23
30
|
load f[:file]
|
24
31
|
end
|
25
|
-
|
26
|
-
DangoServer.start(config
|
32
|
+
|
33
|
+
DangoServer.start(config)
|
27
34
|
end
|
28
35
|
end
|
@@ -37,9 +37,8 @@ class DangoServerFramework
|
|
37
37
|
end
|
38
38
|
end
|
39
39
|
|
40
|
-
def initialize(config
|
40
|
+
def initialize(config)
|
41
41
|
@config = config # 設定ファイル
|
42
|
-
@start_options = start_options # コマンドライン引数
|
43
42
|
|
44
43
|
@gserver = nil # Gserver用の変数
|
45
44
|
@server_reload = nil # サーバーのリロード用フラグ
|
@@ -60,11 +59,11 @@ class DangoServerFramework
|
|
60
59
|
end
|
61
60
|
end
|
62
61
|
|
63
|
-
attr_reader(:
|
62
|
+
attr_reader(:config) # 読みよみのみのアクセサ
|
64
63
|
|
65
64
|
# 起動用のインスタンスメソッド
|
66
|
-
def self.start(config = {}
|
67
|
-
self.new(config
|
65
|
+
def self.start(config = {})
|
66
|
+
self.new(config)
|
68
67
|
end
|
69
68
|
|
70
69
|
# サーバー開始処理
|
@@ -218,7 +217,7 @@ class DangoServerFramework
|
|
218
217
|
cs_logger.debug "action_name=#{action_name}"
|
219
218
|
|
220
219
|
@mutex_proc_thread.synchronize do
|
221
|
-
|
220
|
+
|
222
221
|
if action_name == '_response' # 送信パケットの返事なら
|
223
222
|
action_name_is_response(ret_obj)
|
224
223
|
elsif action_name == 'monitor_all_info' # メンテナンスアクション名なら
|
@@ -253,15 +252,17 @@ class DangoServerFramework
|
|
253
252
|
ensure
|
254
253
|
cs_logger.debug "#{sock.inspect} is gone"
|
255
254
|
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
255
|
+
@mutex_proc_thread.synchronize do
|
256
|
+
begin
|
257
|
+
cs_close() # 接続解除時に呼び出されるメソッド
|
258
|
+
rescue
|
259
|
+
cs_logger.error "#{error_message($!, 'u')}"
|
260
|
+
ensure
|
261
|
+
socket_list.delete(Thread.current.object_id) # ソケットリストから削除
|
262
|
+
sock.close # ソケットを閉じる
|
263
|
+
|
264
|
+
cs_logger.debug "#{sock.inspect} is gone 2"
|
265
|
+
end
|
265
266
|
end
|
266
267
|
|
267
268
|
end
|
@@ -531,7 +532,7 @@ class DangoServerFramework
|
|
531
532
|
|
532
533
|
# サーバーからクライアントへのデータ送信
|
533
534
|
def cs_server_send_data(session_id, notice_name, send_obj, options = {})
|
534
|
-
cs_logger.debug "cs_server_send_data(#{session_id.inspect}, #{notice_name.inspect}, #{send_obj.inspect}, #{options.inspect})"
|
535
|
+
# cs_logger.debug "cs_server_send_data(#{session_id.inspect}, #{notice_name.inspect}, #{send_obj.inspect}, #{options.inspect})"
|
535
536
|
|
536
537
|
raise(DangoFrameworkError, "send_obj is not Hash.") if ! send_obj.is_a?(Hash)
|
537
538
|
|
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-10-
|
6
|
+
version: 0.0.9
|
7
|
+
date: 2007-10-15 00:00:00 +09:00
|
8
8
|
summary: Ruby - Flash conneciton network flamework
|
9
9
|
require_paths:
|
10
10
|
- lib
|