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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 75e3775fdccdd11934891cf0ecb6dc26970861c2
4
- data.tar.gz: 2bb3b8ec31b215d353b0fd89a22609a9eac5f952
3
+ metadata.gz: 4b38b01607becd9fbceb6ec5d902059d5b22f29a
4
+ data.tar.gz: e2d8222914a822df86ad5dcf772877ac1fde6df2
5
5
  SHA512:
6
- metadata.gz: 553deb8cd3b0b929aa9eb43f776150e8df4e8ac80f06b51d56ff17710e4b6845cf73f956c947a16485b44ab1da6cbbc7b261155a773b215b13d6e36963f3c588
7
- data.tar.gz: 5995692a530495950f408e6b2aba395e3211b0c50c03a110209efce88e5fb568b2b20c416f14396fdbb7930b63fb143f385908a7e9b9200aa90eb01af769fc54
6
+ metadata.gz: c50fcc76e4107834a702498aff84c43829642392b5cc88ee1c539a52825ef54ca154c86c70d1a1f073387ff717a722eb933320bb096408d1ac4b1787e4cd14f7
7
+ data.tar.gz: b51019385ccd1ce8fd7672bc8394b1b33471005e7040068b910fab1650602c223b8a8ff608203dbf358a57e432182bc287b90f61506da0cf813bce67d7481eae
@@ -3,7 +3,7 @@
3
3
  require_relative 'core/util/util'
4
4
 
5
5
  module Zashoku
6
- Version = [1, 7, 0].freeze
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
@@ -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, BSIZE)
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 < BSIZE
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
  }
@@ -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
- client.c.puts(
56
- if message['raw']
57
- response.length.to_s + Zashoku::EOF + response + Zashoku::EOF
58
- else
59
- JSON.generate(response: response)
60
- end
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
@@ -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 object')
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zashoku
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.7.0
4
+ version: 1.7.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - annacrombie