cztop 1.2.2 → 1.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGES.md +4 -0
- data/README.md +18 -8
- data/lib/cztop/send_receive_methods.rb +1 -1
- data/lib/cztop/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5d76545700369dac81459715b642249b0b12460a7307e15454800a373feeea0f
|
4
|
+
data.tar.gz: 978a64afa33b8d8ca3f38a1e9f6fc115cee1ba64da8ad6b56eb705392007543f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e7bc28d173c43d80379a0e41bc041f8b942aecd3378c3fbe29995c1b9d2d03657ea11c43bbaf4f3781f1ab0f9778e089c4dd76db9ec27419281550d20dd890e1
|
7
|
+
data.tar.gz: 89c5d43a8aab9e10250257592b91f6c8362be08cd5ae66d4b4a5db408f5b58d2c1fd0408e8529c66f0392d169bb6b8e82ca6e6278f88574427e36d00b4e492e2
|
data/CHANGES.md
CHANGED
data/README.md
CHANGED
@@ -18,26 +18,33 @@ See [this example](https://github.com/paddor/cztop/blob/master/examples/async.rb
|
|
18
18
|
```ruby
|
19
19
|
#! /usr/bin/env ruby
|
20
20
|
|
21
|
-
require '
|
21
|
+
require 'bundler/inline'
|
22
|
+
|
23
|
+
gemfile do
|
24
|
+
source 'https://rubygems.org'
|
25
|
+
gem 'cztop', path: '../../'
|
26
|
+
gem 'async'
|
27
|
+
end
|
28
|
+
|
29
|
+
ENDPOINT = 'inproc://req_rep_example'
|
30
|
+
# ENDPOINT = 'ipc:///tmp/req_rep_example0'
|
31
|
+
# ENDPOINT = 'tcp://localhost:5556'
|
22
32
|
|
23
33
|
Async do |task|
|
24
|
-
task.async do |t|
|
25
|
-
socket = CZTop::Socket::REP.new
|
26
|
-
socket.options.rcvtimeo = 50 # ms
|
34
|
+
rep_task = task.async do |t|
|
35
|
+
socket = CZTop::Socket::REP.new ENDPOINT
|
27
36
|
|
28
37
|
loop do
|
29
38
|
msg = socket.receive
|
30
39
|
puts "<<< #{msg.to_a.inspect}"
|
31
40
|
socket << msg.to_a.map(&:upcase)
|
32
|
-
rescue IO::TimeoutError
|
33
|
-
break
|
34
41
|
end
|
35
|
-
|
42
|
+
ensure
|
36
43
|
puts "REP done."
|
37
44
|
end
|
38
45
|
|
39
46
|
task.async do
|
40
|
-
socket = CZTop::Socket::REQ.new
|
47
|
+
socket = CZTop::Socket::REQ.new ENDPOINT
|
41
48
|
|
42
49
|
10.times do |i|
|
43
50
|
socket << "foobar ##{i}"
|
@@ -46,6 +53,7 @@ Async do |task|
|
|
46
53
|
end
|
47
54
|
|
48
55
|
puts "REQ done."
|
56
|
+
rep_task.stop
|
49
57
|
end
|
50
58
|
end
|
51
59
|
```
|
@@ -85,6 +93,8 @@ Executed in 401.51 millis fish external
|
|
85
93
|
|
86
94
|
```
|
87
95
|
|
96
|
+
A slightly more complex version (more sockets) is [here](https://github.com/paddor/cztop/blob/master/examples/massive_async.rb).
|
97
|
+
|
88
98
|
## Overview
|
89
99
|
|
90
100
|
### Features
|
data/lib/cztop/version.rb
CHANGED