alo7-net 0.1.0 → 0.1.1
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 +10 -1
- data/README.md +1 -1
- data/VERSION +1 -0
- data/lib/alo7/net/client.rb +15 -6
- data/lib/alo7/net/error.rb +3 -0
- data/lib/alo7/net/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4be8f1c411b7cd3e220a4880997a2eb8f5f888ff
|
4
|
+
data.tar.gz: 821e386a12ab39a5b8ce927f094f203c22c87a13
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ca793330a9a8260ccc22bd2d7cf2ca587e48c06b1b956a6ec4b650b15a3e301690de993934462885c98c4206f5fd07bb92654b5718a96d22f927876758ceeeea
|
7
|
+
data.tar.gz: fd020be3dcb38d53918eac28714388d0ae82db342aa60edb6a54897f9aa4c542bb54cce8f4c9226c314acde194c2454eff1dc43815928d6e78383f545eb59661
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# alo7-net [](https://travis-ci.org/qqshfox/alo7-net) [](https://coveralls.io/github/qqshfox/alo7-net) [](https://codeclimate.com/github/qqshfox/alo7-net) [](https://gemnasium.com/github.com/qqshfox/alo7-net)
|
1
|
+
# alo7-net [](https://badge.fury.io/rb/alo7-net) [](https://travis-ci.org/qqshfox/alo7-net) [](https://coveralls.io/github/qqshfox/alo7-net) [](https://codeclimate.com/github/qqshfox/alo7-net) [](https://gemnasium.com/github.com/qqshfox/alo7-net)
|
2
2
|
|
3
3
|
alo7-net is the TCP server/client library we developed specifically for our ALO7 Learning Platform. This library provides a way to write asynchronous code in a straight-line fashion using fibers.
|
4
4
|
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
v0.1.1
|
data/lib/alo7/net/client.rb
CHANGED
@@ -23,22 +23,31 @@ module Alo7
|
|
23
23
|
# @param host [String] host to connect to
|
24
24
|
# @param port [Integer] port to connect to
|
25
25
|
# @return [self]
|
26
|
+
#
|
27
|
+
# @raise if another {#reconnect} is under progress
|
26
28
|
def reconnect(host, port)
|
29
|
+
raise AnotherReconnectingUnderProgress.new 'another reconnecting is under progress' if impl.connect_defer
|
27
30
|
Net.reconnect self, host, port
|
28
31
|
self.class.await_connect self
|
29
32
|
end
|
30
33
|
|
34
|
+
# @private
|
35
|
+
class Impl < Connection::Impl
|
36
|
+
attr_accessor :connect_defer
|
37
|
+
|
38
|
+
def connection_completed
|
39
|
+
connect_defer, @connect_defer = @connect_defer, nil
|
40
|
+
connect_defer.succeed
|
41
|
+
super
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
31
45
|
class << self
|
32
46
|
# @private
|
33
47
|
def await_connect(connection)
|
34
48
|
defer = Defer.new
|
35
|
-
connection.
|
36
|
-
defer.succeed
|
37
|
-
end
|
49
|
+
connection.impl.connect_defer = defer
|
38
50
|
Net.await defer
|
39
|
-
connection.singleton_class.instance_eval do
|
40
|
-
remove_method :connection_completed
|
41
|
-
end
|
42
51
|
connection
|
43
52
|
end
|
44
53
|
end
|
data/lib/alo7/net/error.rb
CHANGED
data/lib/alo7/net/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: alo7-net
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Hanfei Shen
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-07-
|
11
|
+
date: 2016-07-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: eventmachine
|
@@ -60,6 +60,7 @@ files:
|
|
60
60
|
- LICENSE.txt
|
61
61
|
- README.md
|
62
62
|
- Rakefile
|
63
|
+
- VERSION
|
63
64
|
- alo7-net.gemspec
|
64
65
|
- bin/console
|
65
66
|
- bin/setup
|