forward-proxy 0.1.1 → 0.1.2
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/CHANGELOG.md +5 -0
- data/README.md +6 -0
- data/lib/forward_proxy/thread_pool.rb +25 -23
- data/lib/forward_proxy/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3687a0d3afbcb7693bc263f07a0cd08b64c137df
|
4
|
+
data.tar.gz: 2c5b3b5b9b1b7f4267f2dcebe704d2d528e6192c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 64c42b4c1b2d82cfcb23bb4a1119473eb6ec2ec4a4a2b817b58e71eb2c9722208bc944f3b571edc6005c27696eb08786915b933f6adec28cb3f8d892ae8a4f89
|
7
|
+
data.tar.gz: b29d444e69dc042152505ae321e7be6ef903840f611775c1044fa895a6ba26c0a97a9fca99973803cb8ca88f6f846f2286106b8b942e00a308273ee3884903d1
|
data/CHANGELOG.md
ADDED
data/README.md
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
# ForwardProxy
|
2
2
|
|
3
|
+
![Gem Version][3] ![Gem][1] ![Build Status][2]
|
4
|
+
|
3
5
|
Ruby Forward Proxy implemented with only standard libraries.
|
4
6
|
|
5
7
|
```
|
@@ -70,3 +72,7 @@ The gem is available as open source under the terms of the [MIT License](https:/
|
|
70
72
|
## Code of Conduct
|
71
73
|
|
72
74
|
Everyone interacting in the ForwardProxy project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/jamesmoriarty/forward-proxy/blob/master/CODE_OF_CONDUCT.md).
|
75
|
+
|
76
|
+
[1]: https://img.shields.io/gem/dt/forward-proxy
|
77
|
+
[2]: https://github.com/jamesmoriarty/forward-proxy/workflows/Continuous%20Integration/badge.svg?branch=main
|
78
|
+
[3]: https://img.shields.io/gem/v/forward-proxy
|
@@ -1,34 +1,36 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
module ForwardProxy
|
2
|
+
class ThreadPool
|
3
|
+
attr_reader :queue, :threads, :size
|
3
4
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
5
|
+
def initialize(size)
|
6
|
+
@size = size
|
7
|
+
@queue = Queue.new
|
8
|
+
@threads = []
|
9
|
+
end
|
9
10
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
11
|
+
def start
|
12
|
+
size.times do
|
13
|
+
threads << Thread.new do
|
14
|
+
catch(:exit) do
|
15
|
+
loop do
|
16
|
+
job, args = queue.pop
|
17
|
+
job.call(*args)
|
18
|
+
end
|
17
19
|
end
|
18
20
|
end
|
19
21
|
end
|
20
22
|
end
|
21
|
-
end
|
22
|
-
|
23
|
-
def schedule(*args, &block)
|
24
|
-
queue.push([block, args])
|
25
|
-
end
|
26
23
|
|
27
|
-
|
28
|
-
|
29
|
-
schedule { throw :exit }
|
24
|
+
def schedule(*args, &block)
|
25
|
+
queue.push([block, args])
|
30
26
|
end
|
31
27
|
|
32
|
-
|
28
|
+
def shutdown
|
29
|
+
threads.each do
|
30
|
+
schedule { throw :exit }
|
31
|
+
end
|
32
|
+
|
33
|
+
threads.each(&:join)
|
34
|
+
end
|
33
35
|
end
|
34
36
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: forward-proxy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Moriarty
|
@@ -20,6 +20,7 @@ extra_rdoc_files: []
|
|
20
20
|
files:
|
21
21
|
- ".github/workflows/ci.yaml"
|
22
22
|
- ".gitignore"
|
23
|
+
- CHANGELOG.md
|
23
24
|
- CODE_OF_CONDUCT.md
|
24
25
|
- Gemfile
|
25
26
|
- LICENSE.txt
|