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.
- checksums.yaml +4 -4
- data/lib/rack/tctp/halec.rb +27 -22
- 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: aed3301a65c55e8bd87dffd0cab7781b583bc16f
|
4
|
+
data.tar.gz: 431e9b398f6d6ddb7e64f2f645f2fed9c4f7ef97
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5bc4d91be9c966327682b55b127c8f0662b134e73d6cc03bcefb620dd5e94f74f83f9c762af5c480faa168f1509dfd6f2cd10f73bfc7f9cfc26a30f6f4d7190c
|
7
|
+
data.tar.gz: 40a7110474d74ae7cbb7f93fd8576b4fea0c3c4ece20631c1ee1ed1c4ec3050088b8502831d08f216906a54de82cc98e307447f5d3a47a8ee8c849557d871e58
|
data/lib/rack/tctp/halec.rb
CHANGED
@@ -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
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
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.
|