grocer 0.0.12 → 0.0.13

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.md ADDED
@@ -0,0 +1,6 @@
1
+ # CHANGELOG
2
+
3
+ ## 0.0.13
4
+
5
+ * Fixes a bug where closing a Grocer.server could result in an
6
+ `Errno::ENOTCONN` being raised (seems isolated to OS X).
@@ -26,12 +26,19 @@ module Grocer
26
26
  end
27
27
 
28
28
  def close
29
- if @ssl_socket
30
- @ssl_socket.shutdown
29
+ if @ssl_socket && !@ssl_socket.closed?
30
+ begin
31
+ @ssl_socket.shutdown
32
+ rescue Errno::ENOTCONN
33
+ # Some platforms raise this if the socket is not connected. Not sure
34
+ # how to avoid it.
35
+ end
36
+
31
37
  @ssl_socket.close
32
- @ssl_socket = nil
33
- @socket = nil
34
38
  end
39
+
40
+ @ssl_socket = nil
41
+ @socket = nil
35
42
  end
36
43
 
37
44
  private
@@ -1,3 +1,3 @@
1
1
  module Grocer
2
- VERSION = '0.0.12'
2
+ VERSION = '0.0.13'
3
3
  end
@@ -33,14 +33,30 @@ describe Grocer::SSLServer do
33
33
  it "shutdowns the SSL socket" do
34
34
  mock_ssl_server.expects(:shutdown)
35
35
 
36
- subject.accept # "open" socket
36
+ # Emulate opening the socket
37
+ subject.accept
38
+ mock_ssl_server.stubs(:closed? => false)
39
+
40
+ subject.close
41
+ end
42
+
43
+ it "ignores Errno::ENOTCONN errors that might be raised when shutting down the socket" do
44
+ mock_ssl_server.stubs(:shutdown).raises(Errno::ENOTCONN)
45
+
46
+ # Emulate opening the socket
47
+ subject.accept
48
+ mock_ssl_server.stubs(:closed? => false)
49
+
37
50
  subject.close
38
51
  end
39
52
 
40
53
  it "closes the SSL socket" do
41
54
  mock_ssl_server.expects(:close)
42
55
 
43
- subject.accept # "open" socket
56
+ # Emulate opening the socket
57
+ subject.accept
58
+ mock_ssl_server.stubs(:closed? => false)
59
+
44
60
  subject.close
45
61
  end
46
62
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: grocer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.12
4
+ version: 0.0.13
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2012-06-14 00:00:00.000000000 Z
14
+ date: 2012-06-20 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: rspec
@@ -110,6 +110,7 @@ files:
110
110
  - .gitignore
111
111
  - .rspec
112
112
  - .travis.yml
113
+ - CHANGELOG.md
113
114
  - Gemfile
114
115
  - LICENSE
115
116
  - README.md
@@ -167,7 +168,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
167
168
  version: '0'
168
169
  segments:
169
170
  - 0
170
- hash: 1066047643388989879
171
+ hash: -2773558114449338672
171
172
  required_rubygems_version: !ruby/object:Gem::Requirement
172
173
  none: false
173
174
  requirements:
@@ -176,7 +177,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
176
177
  version: '0'
177
178
  segments:
178
179
  - 0
179
- hash: 1066047643388989879
180
+ hash: -2773558114449338672
180
181
  requirements: []
181
182
  rubyforge_project:
182
183
  rubygems_version: 1.8.24