softwear-lib 2.1.4 → 2.1.6

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: 456bfe9e8434b62888a54a23e6fbf36fb3b44e83
4
- data.tar.gz: 67c56043228166ad631c4074bef9a4f3cfa9d9f3
3
+ metadata.gz: 7b957d5fb4f40c08589d75c8d1ab16f4b9085014
4
+ data.tar.gz: f5b7e611f9aa06f7df289604fb8ab337a8cb7386
5
5
  SHA512:
6
- metadata.gz: 376113159944d76552f5f965146373f2d4042e65768320550aa869281926a0e0e3da516f7d8caa0440ffa93f208bd1f6ac39f115f0fa65431a75bf181ea4246a
7
- data.tar.gz: f9d0d0f33727cfc97c727c31155bc1e3ee248dc54a2b6d94eac2f87e31392c7e9c35b25b33482099b10841ea2bc84c4f4880a2293afa56459695ff558b8bd66d
6
+ metadata.gz: dd18ab37690e9f95caa21928ec6aecce6a9e30c5a3e976465c834a0dc0571bf56316a735d82c9b24a1f0253e00f2e823d3c207c0c4ec4fbe559ce7d926878665
7
+ data.tar.gz: 60e22123c326ddae38b2a9f057411ef3c4df073babccf628049de97026da64364de44a2384366408422475ae02814aba5fc87f731dc2a7e2692e3e86ff3423d3
@@ -344,7 +344,7 @@ module Softwear
344
344
  object
345
345
  end
346
346
 
347
- rescue JSON::ParserError => e
347
+ rescue JSON::ParserError => _e
348
348
  Rails.logger.error "Bad user model JSON: ``` #{json} ```"
349
349
  nil
350
350
  end
@@ -401,9 +401,9 @@ module Softwear
401
401
  def auth(token, app_name = nil)
402
402
  response = validate_response query "auth #{app_name || Figaro.env.hub_app_name} #{token}"
403
403
 
404
- return false unless response =~ /^yes .+$/
404
+ return false unless response =~ /^yes/
405
405
 
406
- _yes, json = response.split(' ', 2)
406
+ json = response.sub(/^yes/, '')
407
407
  object = new(JSON.parse(json))
408
408
  object.instance_variable_set(:@persisted, true)
409
409
  object
@@ -16,8 +16,6 @@ def log(*a)
16
16
  $stdout.puts(*a) unless Rails.env.test?
17
17
  end
18
18
 
19
- # TODO for production, we want to use the SSL server instead of straight up TCP.
20
-
21
19
  # ==== Send Format: =======
22
20
  # One line strings: "#{command} #{arg1} #{arg2} #{etc}"
23
21
  # The last argument, depending on the command, may contain spaces (but usually does not need to)
@@ -55,6 +53,12 @@ def start_server!(*args)
55
53
 
56
54
  loop do
57
55
  Thread.start(server.accept) do |client|
56
+ begin
57
+ client.setsockopt(Socket::IPPROTO_TCP, Socket::TCP_NODELAY, 1)
58
+ rescue Exception => e
59
+ puts "Couldn't set TCP_NODELAY"
60
+ end
61
+
58
62
  client_count += 1
59
63
  dev_log "New client! ##{client_count} #{address_of client}"
60
64
 
@@ -83,6 +87,7 @@ def start_server!(*args)
83
87
  dev_log "<== #{line_in}"
84
88
  ActiveRecord::Base.connection_pool.with_connection do
85
89
  command.call(client, rest_of_command)
90
+ client.flush
86
91
  end
87
92
  end
88
93
 
@@ -1,5 +1,5 @@
1
1
  module Softwear
2
2
  module Library
3
- VERSION = "2.1.4"
3
+ VERSION = "2.1.6"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: softwear-lib
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.4
4
+ version: 2.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nigel Baillie
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-03-13 00:00:00.000000000 Z
11
+ date: 2017-03-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler