cool.io 1.2.2 → 1.2.3

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGES.md CHANGED
@@ -1,3 +1,8 @@
1
+ 1.2.3
2
+ -----
3
+
4
+ * Fix CPU consuming issue on Windows.
5
+
1
6
  1.2.2
2
7
  -----
3
8
 
@@ -67,6 +67,53 @@
67
67
 
68
68
  #include <string.h>
69
69
 
70
+ #ifdef _WIN32
71
+ /*
72
+ ########## COOLIO PATCHERY HO! ##########
73
+
74
+ Ruby undefs FD_* utilities for own implementation.
75
+ It converts fd argument into socket handle internally on Windows,
76
+ so libev should not use Ruby's FD_* utilities.
77
+
78
+ Following FD_* utilities come from MinGW.
79
+ RubyInstaller is built by MinGW so this should work.
80
+ */
81
+ int PASCAL __WSAFDIsSet(SOCKET,fd_set*);
82
+ #define EV_WIN_FD_CLR(fd,set) do { u_int __i;\
83
+ for (__i = 0; __i < ((fd_set *)(set))->fd_count ; __i++) {\
84
+ if (((fd_set *)(set))->fd_array[__i] == (fd)) {\
85
+ while (__i < ((fd_set *)(set))->fd_count-1) {\
86
+ ((fd_set*)(set))->fd_array[__i] = ((fd_set*)(set))->fd_array[__i+1];\
87
+ __i++;\
88
+ }\
89
+ ((fd_set*)(set))->fd_count--;\
90
+ break;\
91
+ }\
92
+ }\
93
+ } while (0)
94
+ #define EV_WIN_FD_SET(fd, set) do { u_int __i;\
95
+ for (__i = 0; __i < ((fd_set *)(set))->fd_count ; __i++) {\
96
+ if (((fd_set *)(set))->fd_array[__i] == (fd)) {\
97
+ break;\
98
+ }\
99
+ }\
100
+ if (__i == ((fd_set *)(set))->fd_count) {\
101
+ if (((fd_set *)(set))->fd_count < FD_SETSIZE) {\
102
+ ((fd_set *)(set))->fd_array[__i] = (fd);\
103
+ ((fd_set *)(set))->fd_count++;\
104
+ }\
105
+ }\
106
+ } while(0)
107
+ #define EV_WIN_FD_ZERO(set) (((fd_set *)(set))->fd_count=0)
108
+ #define EV_WIN_FD_ISSET(fd, set) __WSAFDIsSet((SOCKET)(fd), (fd_set *)(set))
109
+ /* ######################################## */
110
+ #else
111
+ #define EV_WIN_FD_CLR FD_CLR
112
+ #define EV_WIN_FD_SET FD_SET
113
+ #define EV_WIN_FD_ZERO FD_ZERO
114
+ #define EV_WIN_FD_ISSET FD_ISSET
115
+ #endif
116
+
70
117
  static void
71
118
  select_modify (EV_P_ int fd, int oev, int nev)
72
119
  {
@@ -91,17 +138,17 @@ select_modify (EV_P_ int fd, int oev, int nev)
91
138
  if ((oev ^ nev) & EV_READ)
92
139
  #endif
93
140
  if (nev & EV_READ)
94
- FD_SET (handle, (fd_set *)vec_ri);
141
+ EV_WIN_FD_SET (handle, (fd_set *)vec_ri);
95
142
  else
96
- FD_CLR (handle, (fd_set *)vec_ri);
143
+ EV_WIN_FD_CLR (handle, (fd_set *)vec_ri);
97
144
 
98
145
  #if EV_SELECT_IS_WINSOCKET
99
146
  if ((oev ^ nev) & EV_WRITE)
100
147
  #endif
101
148
  if (nev & EV_WRITE)
102
- FD_SET (handle, (fd_set *)vec_wi);
149
+ EV_WIN_FD_SET (handle, (fd_set *)vec_wi);
103
150
  else
104
- FD_CLR (handle, (fd_set *)vec_wi);
151
+ EV_WIN_FD_CLR (handle, (fd_set *)vec_wi);
105
152
 
106
153
  #else
107
154
 
@@ -136,6 +183,8 @@ select_modify (EV_P_ int fd, int oev, int nev)
136
183
  }
137
184
  }
138
185
 
186
+ #undef socket
187
+
139
188
  static void
140
189
  select_poll (EV_P_ ev_tstamp timeout)
141
190
  {
@@ -230,10 +279,10 @@ select_poll (EV_P_ ev_tstamp timeout)
230
279
  int handle = fd;
231
280
  #endif
232
281
 
233
- if (FD_ISSET (handle, (fd_set *)vec_ro)) events |= EV_READ;
234
- if (FD_ISSET (handle, (fd_set *)vec_wo)) events |= EV_WRITE;
282
+ if (EV_WIN_FD_ISSET (handle, (fd_set *)vec_ro)) events |= EV_READ;
283
+ if (EV_WIN_FD_ISSET (handle, (fd_set *)vec_wo)) events |= EV_WRITE;
235
284
  #ifdef _WIN32
236
- if (FD_ISSET (handle, (fd_set *)vec_eo)) events |= EV_WRITE;
285
+ if (EV_WIN_FD_ISSET (handle, (fd_set *)vec_eo)) events |= EV_WRITE;
237
286
  #endif
238
287
 
239
288
  if (expect_true (events))
@@ -279,9 +328,9 @@ select_init (EV_P_ int flags)
279
328
  backend_poll = select_poll;
280
329
 
281
330
  #if EV_SELECT_USE_FD_SET
282
- vec_ri = ev_malloc (sizeof (fd_set)); FD_ZERO ((fd_set *)vec_ri);
331
+ vec_ri = ev_malloc (sizeof (fd_set)); EV_WIN_FD_ZERO ((fd_set *)vec_ri);
283
332
  vec_ro = ev_malloc (sizeof (fd_set));
284
- vec_wi = ev_malloc (sizeof (fd_set)); FD_ZERO ((fd_set *)vec_wi);
333
+ vec_wi = ev_malloc (sizeof (fd_set)); EV_WIN_FD_ZERO ((fd_set *)vec_wi);
285
334
  vec_wo = ev_malloc (sizeof (fd_set));
286
335
  #ifdef _WIN32
287
336
  vec_eo = ev_malloc (sizeof (fd_set));
@@ -1,5 +1,5 @@
1
1
  module Coolio
2
- VERSION = "1.2.2"
2
+ VERSION = "1.2.3"
3
3
 
4
4
  def self.version; VERSION; end
5
5
  end
@@ -36,4 +36,4 @@ describe "DNS" do
36
36
  @loop.run
37
37
  end.should raise_error(WontResolve)
38
38
  end
39
- end
39
+ end
@@ -105,7 +105,8 @@ ensure
105
105
  server.close
106
106
  end
107
107
 
108
- describe Coolio::TCPServer do
108
+ # This test should work on Windows
109
+ describe Coolio::TCPServer, :env => :win do
109
110
 
110
111
  it '#run' do
111
112
  test_run("hello").should == "hello"
@@ -128,3 +129,4 @@ describe Coolio::TCPServer do
128
129
  end
129
130
 
130
131
  end
132
+
metadata CHANGED
@@ -1,7 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cool.io
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.2
4
+ version: 1.2.3
5
+ prerelease:
5
6
  platform: ruby
6
7
  authors:
7
8
  - Tony Arcieri
@@ -9,48 +10,54 @@ authors:
9
10
  autorequire:
10
11
  bindir: bin
11
12
  cert_chain: []
12
- date: 2014-04-16 00:00:00.000000000 Z
13
+ date: 2014-04-25 00:00:00.000000000 Z
13
14
  dependencies:
14
15
  - !ruby/object:Gem::Dependency
15
16
  name: rake-compiler
16
17
  requirement: !ruby/object:Gem::Requirement
18
+ none: false
17
19
  requirements:
18
- - - "~>"
20
+ - - ~>
19
21
  - !ruby/object:Gem::Version
20
22
  version: 0.8.3
21
23
  type: :development
22
24
  prerelease: false
23
25
  version_requirements: !ruby/object:Gem::Requirement
26
+ none: false
24
27
  requirements:
25
- - - "~>"
28
+ - - ~>
26
29
  - !ruby/object:Gem::Version
27
30
  version: 0.8.3
28
31
  - !ruby/object:Gem::Dependency
29
32
  name: rspec
30
33
  requirement: !ruby/object:Gem::Requirement
34
+ none: false
31
35
  requirements:
32
- - - ">="
36
+ - - ! '>='
33
37
  - !ruby/object:Gem::Version
34
38
  version: 2.13.0
35
39
  type: :development
36
40
  prerelease: false
37
41
  version_requirements: !ruby/object:Gem::Requirement
42
+ none: false
38
43
  requirements:
39
- - - ">="
44
+ - - ! '>='
40
45
  - !ruby/object:Gem::Version
41
46
  version: 2.13.0
42
47
  - !ruby/object:Gem::Dependency
43
48
  name: rdoc
44
49
  requirement: !ruby/object:Gem::Requirement
50
+ none: false
45
51
  requirements:
46
- - - ">="
52
+ - - ! '>='
47
53
  - !ruby/object:Gem::Version
48
54
  version: 3.6.0
49
55
  type: :development
50
56
  prerelease: false
51
57
  version_requirements: !ruby/object:Gem::Requirement
58
+ none: false
52
59
  requirements:
53
- - - ">="
60
+ - - ! '>='
54
61
  - !ruby/object:Gem::Version
55
62
  version: 3.6.0
56
63
  description: Cool.io provides a high performance event framework for Ruby which uses
@@ -65,9 +72,9 @@ extensions:
65
72
  - ext/iobuffer/extconf.rb
66
73
  extra_rdoc_files: []
67
74
  files:
68
- - ".gitignore"
69
- - ".rspec"
70
- - ".travis.yml"
75
+ - .gitignore
76
+ - .rspec
77
+ - .travis.yml
71
78
  - CHANGES.md
72
79
  - Gemfile
73
80
  - LICENSE
@@ -147,26 +154,33 @@ files:
147
154
  - spec/unix_server_spec.rb
148
155
  homepage: http://coolio.github.com
149
156
  licenses: []
150
- metadata: {}
151
157
  post_install_message:
152
158
  rdoc_options: []
153
159
  require_paths:
154
160
  - lib
155
161
  required_ruby_version: !ruby/object:Gem::Requirement
162
+ none: false
156
163
  requirements:
157
- - - ">="
164
+ - - ! '>='
158
165
  - !ruby/object:Gem::Version
159
166
  version: '0'
167
+ segments:
168
+ - 0
169
+ hash: -2054079521512211321
160
170
  required_rubygems_version: !ruby/object:Gem::Requirement
171
+ none: false
161
172
  requirements:
162
- - - ">="
173
+ - - ! '>='
163
174
  - !ruby/object:Gem::Version
164
175
  version: '0'
176
+ segments:
177
+ - 0
178
+ hash: -2054079521512211321
165
179
  requirements: []
166
180
  rubyforge_project:
167
- rubygems_version: 2.2.2
181
+ rubygems_version: 1.8.23
168
182
  signing_key:
169
- specification_version: 4
183
+ specification_version: 3
170
184
  summary: A cool framework for doing high performance I/O in Ruby
171
185
  test_files:
172
186
  - spec/async_watcher_spec.rb
checksums.yaml DELETED
@@ -1,7 +0,0 @@
1
- ---
2
- SHA1:
3
- metadata.gz: 8df378d986336f5aa0c79e3c5e31f80a1571ab0d
4
- data.tar.gz: 2d9c5aa507a285b4ee129c5a8ccfca8c5f5d8586
5
- SHA512:
6
- metadata.gz: f6a74e7fa7dd6bd728835225ecb8481c2e44a44dad2887aaba7d041d835bdcb76ace90ea2fe4aab6bd5db322f3d9ea0c1e81e4eb68da4a3d75273fdcb6781d86
7
- data.tar.gz: deaffe41d393672ffb44c81766460f8e0736a21294e96acabe998fe01ea36dbdd55ef6b1efadf1e675460ffc0be43376052f9a2f4e3344d36e7c8b37730a3bc5