alo7-net 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9203184940ea7875e9119f7dfeb7f195b41a6c7c
4
- data.tar.gz: 08ad750866199fcf9d0b2b0ebbac1b165af472ae
3
+ metadata.gz: 4be8f1c411b7cd3e220a4880997a2eb8f5f888ff
4
+ data.tar.gz: 821e386a12ab39a5b8ce927f094f203c22c87a13
5
5
  SHA512:
6
- metadata.gz: 16a36c6b9afffdeb260d65384d61c14d46631f79363be391e00fc1e70abee619981e12cbefcfc25963f41182a1ce24ee0ceabe2aa21a76bc15fb5a7ddd129a08
7
- data.tar.gz: 259cfb5db9ea77d663b774ad807bfa3ba8d4697a00efe6e2bb8dd052ad68250700d06c647c9854645c44be1753974e35d5220a696932e7f4ee3962efd2bdae93
6
+ metadata.gz: ca793330a9a8260ccc22bd2d7cf2ca587e48c06b1b956a6ec4b650b15a3e301690de993934462885c98c4206f5fd07bb92654b5718a96d22f927876758ceeeea
7
+ data.tar.gz: fd020be3dcb38d53918eac28714388d0ae82db342aa60edb6a54897f9aa4c542bb54cce8f4c9226c314acde194c2454eff1dc43815928d6e78383f545eb59661
@@ -1,3 +1,12 @@
1
- # 0.1.0
1
+ # v0.1.1
2
+
3
+ ## Bugfixes
4
+
5
+ * Fix `#connection_completed` not be called after `#connect`.
6
+ * Raise if another `#reconnect` is under progress.
7
+
8
+ # v0.1.0
9
+
10
+ ## Features
2
11
 
3
12
  * Initial release.
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # alo7-net [![Build Status](https://travis-ci.org/qqshfox/alo7-net.svg)](https://travis-ci.org/qqshfox/alo7-net) [![Coverage Status](https://coveralls.io/repos/github/qqshfox/alo7-net/badge.svg)](https://coveralls.io/github/qqshfox/alo7-net) [![Code Climate](https://codeclimate.com/github/qqshfox/alo7-net/badges/gpa.svg)](https://codeclimate.com/github/qqshfox/alo7-net) [![Dependency Status](https://gemnasium.com/badges/github.com/qqshfox/alo7-net.svg)](https://gemnasium.com/github.com/qqshfox/alo7-net)
1
+ # alo7-net [![Gem Version](https://badge.fury.io/rb/alo7-net.svg)](https://badge.fury.io/rb/alo7-net) [![Build Status](https://travis-ci.org/qqshfox/alo7-net.svg)](https://travis-ci.org/qqshfox/alo7-net) [![Coverage Status](https://coveralls.io/repos/github/qqshfox/alo7-net/badge.svg)](https://coveralls.io/github/qqshfox/alo7-net) [![Code Climate](https://codeclimate.com/github/qqshfox/alo7-net/badges/gpa.svg)](https://codeclimate.com/github/qqshfox/alo7-net) [![Dependency Status](https://gemnasium.com/badges/github.com/qqshfox/alo7-net.svg)](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
@@ -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.define_singleton_method :connection_completed do
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
@@ -6,5 +6,8 @@ module Alo7
6
6
 
7
7
  # A error used to indicate a connection lost.
8
8
  class ConnectionLost < Error; end
9
+
10
+ # A error used to indicate another reconnecting is under progress.
11
+ class AnotherReconnectingUnderProgress < Error; end
9
12
  end
10
13
  end
@@ -1,5 +1,5 @@
1
1
  module Alo7
2
2
  module Net
3
- VERSION = '0.1.0'
3
+ VERSION = '0.1.1'
4
4
  end
5
5
  end
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.0
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-01 00:00:00.000000000 Z
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