rack-tctp 0.9.8 → 0.9.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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/rack/tctp/halec.rb +27 -22
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1fb5bcf11c0cacc00595f49b429d6810b646f62a
4
- data.tar.gz: 469afac39fcc7dd72568c9c5f0c62c8309e5e7b6
3
+ metadata.gz: aed3301a65c55e8bd87dffd0cab7781b583bc16f
4
+ data.tar.gz: 431e9b398f6d6ddb7e64f2f645f2fed9c4f7ef97
5
5
  SHA512:
6
- metadata.gz: 8a47f449b3ddb7da03987b77624b936c88875a46d9d64ec5b6016d070bf287d1a6b7c868ab0e92f74070c115f5219bb06c79d84bfebb6ef201dadd4677572808
7
- data.tar.gz: b8cfe98bbe089fbfa476146de64e8458e7b5e9e478190b8539588bbb5f0c83ecb770966074fc00be291ccddc86ec1b0fdbcaefddcfd36f69541c31b5519ba145
6
+ metadata.gz: 5bc4d91be9c966327682b55b127c8f0662b134e73d6cc03bcefb620dd5e94f74f83f9c762af5c480faa168f1509dfd6f2cd10f73bfc7f9cfc26a30f6f4d7190c
7
+ data.tar.gz: 40a7110474d74ae7cbb7f93fd8576b4fea0c3c4ece20631c1ee1ed1c4ec3050088b8502831d08f216906a54de82cc98e307447f5d3a47a8ee8c849557d871e58
@@ -23,32 +23,37 @@ class Rack::TCTP::HALEC
23
23
 
24
24
  # The queue for encrypting and decrypting data
25
25
  # @return [Queue] The async queue
26
- attr_reader :async_queue
27
-
28
- def initialize(options = {})
29
- @url = options[:url] || nil
30
-
31
- @async_queue = Queue.new
32
-
33
- Thread.new do
34
- begin
35
- while true
36
- item = @async_queue.pop
37
-
38
- case item[0]
39
- when :encrypt
40
- item[2].call encrypt_data(item[1])
41
- when :decrypt
42
- item[2].call decrypt_data(item[1])
43
- when :call
44
- item[2].call
26
+ # @!attr [r] async_queue
27
+ def async_queue
28
+ unless @async_queue
29
+ @async_queue = Queue.new
30
+
31
+ @async_thread = Thread.new do
32
+ begin
33
+ while true
34
+ item = @async_queue.pop
35
+
36
+ case item[0]
37
+ when :encrypt
38
+ item[2].call encrypt_data(item[1])
39
+ when :decrypt
40
+ item[2].call decrypt_data(item[1])
41
+ when :call
42
+ item[2].call
43
+ end
45
44
  end
45
+ rescue Exception => e
46
+ #TODO Handle HALEC encryption thread shutdown
47
+ puts e
46
48
  end
47
- rescue Exception => e
48
- #TODO Handle HALEC encryption thread shutdown
49
- puts e
50
49
  end
51
50
  end
51
+
52
+ @async_queue
53
+ end
54
+
55
+ def initialize(options = {})
56
+ @url = options[:url] || nil
52
57
  end
53
58
 
54
59
  # Encrypts +plaintext+ data and either returns the encrypted data or calls a block with it.
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rack-tctp
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.8
4
+ version: 0.9.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mathias Slawik