zashoku 1.7.0 → 1.7.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/constants.rb +4 -1
- data/lib/core/net/client.rb +6 -8
- data/lib/core/net/server.rb +7 -7
- data/lib/daemon.rb +7 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4b38b01607becd9fbceb6ec5d902059d5b22f29a
|
4
|
+
data.tar.gz: e2d8222914a822df86ad5dcf772877ac1fde6df2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c50fcc76e4107834a702498aff84c43829642392b5cc88ee1c539a52825ef54ca154c86c70d1a1f073387ff717a722eb933320bb096408d1ac4b1787e4cd14f7
|
7
|
+
data.tar.gz: b51019385ccd1ce8fd7672bc8394b1b33471005e7040068b910fab1650602c223b8a8ff608203dbf358a57e432182bc287b90f61506da0cf813bce67d7481eae
|
data/lib/constants.rb
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
require_relative 'core/util/util'
|
4
4
|
|
5
5
|
module Zashoku
|
6
|
-
Version = [1, 7,
|
6
|
+
Version = [1, 7, 1].freeze
|
7
7
|
|
8
8
|
Root = File.expand_path('../', __dir__)
|
9
9
|
|
@@ -40,6 +40,9 @@ module Zashoku
|
|
40
40
|
'map_key' => :map_key,
|
41
41
|
'search' => :search,
|
42
42
|
'zv' => :print_version
|
43
|
+
},
|
44
|
+
net: {
|
45
|
+
bsize: 4096
|
43
46
|
}
|
44
47
|
}
|
45
48
|
}.freeze
|
data/lib/core/net/client.rb
CHANGED
@@ -9,8 +9,6 @@ module Zashoku
|
|
9
9
|
class Client
|
10
10
|
attr_accessor :callbacks
|
11
11
|
|
12
|
-
BSIZE = 1000000
|
13
|
-
|
14
12
|
def initialize(host, port)
|
15
13
|
@host, @port = host, port
|
16
14
|
@socket = connect(@host, @port)
|
@@ -135,15 +133,15 @@ module Zashoku
|
|
135
133
|
Zashoku::Util.alert("opened file #{file}")
|
136
134
|
f.sync = true
|
137
135
|
Zashoku::Util.alert('waiting for server...')
|
138
|
-
l = @socket.gets(Zashoku::EOF).split(Zashoku::EOF).first.to_i
|
139
|
-
Zashoku::Util.alert("got length #{l}")
|
140
|
-
r = 0
|
136
|
+
#l = @socket.gets(Zashoku::EOF).split(Zashoku::EOF).first.to_i
|
137
|
+
#Zashoku::Util.alert("got length #{l}")
|
138
|
+
#r = 0
|
141
139
|
loop do
|
142
|
-
d = @socket.gets(Zashoku::EOF,
|
140
|
+
d = @socket.gets(Zashoku::EOF, Zashoku::CConf[:core][:net][:bsize])
|
143
141
|
dl = d.length
|
144
142
|
f.print(d)
|
145
|
-
Zashoku::Util.alert( "file #{((r += dl) / Float(l) * 100).round}% buffered" )
|
146
|
-
break if dl <
|
143
|
+
#Zashoku::Util.alert( "file #{((r += dl) / Float(l) * 100).round}% buffered" )
|
144
|
+
break if dl < Zashoku::CConf[:core][:net][:bsize]
|
147
145
|
end
|
148
146
|
f.close
|
149
147
|
}
|
data/lib/core/net/server.rb
CHANGED
@@ -52,13 +52,13 @@ module Zashoku
|
|
52
52
|
begin
|
53
53
|
response = @handler.call(message)
|
54
54
|
Zashoku.logger.debug("sending message to #{client}")
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
55
|
+
if message['raw']
|
56
|
+
#client.c.puts response.stat.size.to_s + Zashoku::EOF
|
57
|
+
client.c.puts(response.gets(Zashoku::CConf[:core][:net][:bsize])) until response.eof?
|
58
|
+
client.c.puts Zashoku::EOF
|
59
|
+
else
|
60
|
+
client.c.puts(JSON.generate(response: response))
|
61
|
+
end
|
62
62
|
rescue Errno::EPIPE
|
63
63
|
break
|
64
64
|
else
|
data/lib/daemon.rb
CHANGED
@@ -4,6 +4,7 @@ require 'json'
|
|
4
4
|
require 'logger'
|
5
5
|
require 'socket'
|
6
6
|
require 'thread'
|
7
|
+
require 'stringio'
|
7
8
|
|
8
9
|
require_relative 'core/controller'
|
9
10
|
require_relative 'core/config/daemon_config'
|
@@ -28,8 +29,12 @@ module Zashoku
|
|
28
29
|
nil
|
29
30
|
end
|
30
31
|
if message[:raw]
|
31
|
-
Zashoku.logger.info('responding with unencoded
|
32
|
-
obj
|
32
|
+
Zashoku.logger.info('responding with unencoded stream')
|
33
|
+
if obj.respond_to?(:gets)
|
34
|
+
obj
|
35
|
+
else
|
36
|
+
StringIO.new(obj.to_s)
|
37
|
+
end
|
33
38
|
else
|
34
39
|
Zashoku::Util.encode_object(obj)
|
35
40
|
end
|