eventmachine 1.0.8 → 1.0.9

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9ad3da2ff8a74830eb531ba843798d7dc6eb1e1d
4
- data.tar.gz: 8082090ea1867e8526f24d6ae358525d917cdaa7
3
+ metadata.gz: 95a7b099599de06d369149072de07081ad2a1485
4
+ data.tar.gz: 1b5f7379db7f1314b4cd8663191f60fce59466f3
5
5
  SHA512:
6
- metadata.gz: cdf30d406e28cff425182abb2d27a2b2a8ff04abc9541dd22fe9106a58e14934fdfee4c06df2e6fc3a609ab7f04c8fe20b7573ec81a879d19e4d02cd76ecceef
7
- data.tar.gz: d6333ea393ef78506ea846121d65391a4e304fdb3911a5aa461ec38c228646776f0ed1f5483cd953ff52981f5ff925c03353145bbeefdf0236b954461cdb276b
6
+ metadata.gz: 49f71fe7325e32e45a1febc789e815e64e94908b6285957180a0e26fa39ebe6ac3377eb7507da11cfdcbcd607f78ee7a3939a6a1374f998a5819f6092cd0c17d
7
+ data.tar.gz: ec5fbdb8d54d186e5398b843ef6985d5b9e83c26d32483d739268765a99ae84fdd17e0809c9fda8eb36ca71c51ce4ab623eb270d64884e388669656cee19040b
@@ -1,5 +1,20 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.0.9 (January 13, 2016)
4
+ * Try more ways to detect OpenSSL [#602, #643, #661, #663, #668, #669]
5
+ * Use WSAGetLastError in pipe.cpp same as ed.cpp [#659]
6
+ * Test compiler flags with the C++ compiler and add them to CXXFLAGS [#634, #651]
7
+ * Restore silent-fail on unsupported EM.epoll and EM.kqueue [#638, #649]
8
+ * getDescriptorByFileno deprecated in JRuby 1.7.x, removed in JRuby 9000 [#642, #648]
9
+ * Add -Wno-address always-true because on Windows rb_fd_select [#578]
10
+ * Remove the WITHOUT_SSL constant [#578]
11
+ * Fix SSL error when the server replies a TLS Alert to our ClientHello [#544, #653]
12
+ * Use WSAStringToAddress in lieu of inet_pton for IPv6 address detection on Windows [#595, #632]
13
+ * Fix nasty TCP/IPv6 bug [#595, #632]
14
+ * Use select_large_fdset on Solaris [#611, #625]
15
+ * Detect the Solaris Studio compiler [#611, #625]
16
+ * Throw a message with strerror included [#136, #621]
17
+
3
18
  ## 1.0.8 (August 6, 2015)
4
19
  * fix kqueue assertion failed, postpone ArmKqueueWriter until all events are processed [#51, #176, #372, #401, #619]
5
20
  * fix Rubinius GC, crank the machine from Ruby space when running Rubinius [#201, #202, #617]
@@ -10,7 +25,7 @@
10
25
  * fix for compilation with SSL on windows [#601]
11
26
  * open file descriptors and sockets with O_CLOEXEC where possible [#298, #488, #591]
12
27
  * fix SmtpClient: send second EHLO after STARTTLS. [#589]
13
- * fix nul-terminated strings in C, use StringValueCStr instead of StringValuePtr
28
+ * fix nul-terminated strings in C, use StringValueCStr instead of StringValuePtr
14
29
 
15
30
  ## 1.0.7 (February 10, 2015)
16
31
  * fix delay in kqueue/epoll reactor shutdown when timers exist [#587]
data/ext/ed.cpp CHANGED
@@ -857,9 +857,9 @@ void ConnectionDescriptor::Read()
857
857
  ConnectionDescriptor::_DispatchInboundData
858
858
  ******************************************/
859
859
 
860
+ #ifdef WITH_SSL
860
861
  void ConnectionDescriptor::_DispatchInboundData (const char *buffer, unsigned long size)
861
862
  {
862
- #ifdef WITH_SSL
863
863
  if (SslBox) {
864
864
  SslBox->PutCiphertext (buffer, size);
865
865
 
@@ -873,6 +873,7 @@ void ConnectionDescriptor::_DispatchInboundData (const char *buffer, unsigned lo
873
873
 
874
874
  // If our SSL handshake had a problem, shut down the connection.
875
875
  if (s == -2) {
876
+ UnbindReasonCode = EPROTO;
876
877
  ScheduleClose(false);
877
878
  return;
878
879
  }
@@ -883,12 +884,13 @@ void ConnectionDescriptor::_DispatchInboundData (const char *buffer, unsigned lo
883
884
  else {
884
885
  _GenericInboundDispatch(buffer, size);
885
886
  }
886
- #endif
887
-
888
- #ifdef WITHOUT_SSL
887
+ }
888
+ #else
889
+ void ConnectionDescriptor::_DispatchInboundData (const char *buffer, unsigned long size)
890
+ {
889
891
  _GenericInboundDispatch(buffer, size);
890
- #endif
891
892
  }
893
+ #endif
892
894
 
893
895
 
894
896
 
@@ -1024,6 +1026,8 @@ void ConnectionDescriptor::_WriteOutboundData()
1024
1026
  for(int i = 0; i < iovcnt; i++){
1025
1027
  OutboundPage *op = &(OutboundPages[i]);
1026
1028
  #ifdef CC_SUNWspro
1029
+ // TODO: The void * cast works fine on Solaris 11, but
1030
+ // I don't know at what point that changed from older Solaris.
1027
1031
  iov[i].iov_base = (char *)(op->Buffer + op->Offset);
1028
1032
  #else
1029
1033
  iov[i].iov_base = (void *)(op->Buffer + op->Offset);
@@ -1165,29 +1169,31 @@ int ConnectionDescriptor::ReportErrorStatus()
1165
1169
  ConnectionDescriptor::StartTls
1166
1170
  ******************************/
1167
1171
 
1172
+ #ifdef WITH_SSL
1168
1173
  void ConnectionDescriptor::StartTls()
1169
1174
  {
1170
- #ifdef WITH_SSL
1171
1175
  if (SslBox)
1172
1176
  throw std::runtime_error ("SSL/TLS already running on connection");
1173
1177
 
1174
1178
  SslBox = new SslBox_t (bIsServer, PrivateKeyFilename, CertChainFilename, bSslVerifyPeer, GetBinding());
1175
1179
  _DispatchCiphertext();
1176
- #endif
1177
1180
 
1178
- #ifdef WITHOUT_SSL
1181
+ }
1182
+ #else
1183
+ void ConnectionDescriptor::StartTls()
1184
+ {
1179
1185
  throw std::runtime_error ("Encryption not available on this event-machine");
1180
- #endif
1181
1186
  }
1187
+ #endif
1182
1188
 
1183
1189
 
1184
1190
  /*********************************
1185
1191
  ConnectionDescriptor::SetTlsParms
1186
1192
  *********************************/
1187
1193
 
1194
+ #ifdef WITH_SSL
1188
1195
  void ConnectionDescriptor::SetTlsParms (const char *privkey_filename, const char *certchain_filename, bool verify_peer)
1189
1196
  {
1190
- #ifdef WITH_SSL
1191
1197
  if (SslBox)
1192
1198
  throw std::runtime_error ("call SetTlsParms before calling StartTls");
1193
1199
  if (privkey_filename && *privkey_filename)
@@ -1195,12 +1201,13 @@ void ConnectionDescriptor::SetTlsParms (const char *privkey_filename, const char
1195
1201
  if (certchain_filename && *certchain_filename)
1196
1202
  CertChainFilename = certchain_filename;
1197
1203
  bSslVerifyPeer = verify_peer;
1198
- #endif
1199
-
1200
- #ifdef WITHOUT_SSL
1204
+ }
1205
+ #else
1206
+ void ConnectionDescriptor::SetTlsParms (const char *privkey_filename UNUSED, const char *certchain_filename UNUSED, bool verify_peer UNUSED)
1207
+ {
1201
1208
  throw std::runtime_error ("Encryption not available on this event-machine");
1202
- #endif
1203
1209
  }
1210
+ #endif
1204
1211
 
1205
1212
 
1206
1213
  /*********************************
data/ext/em.cpp CHANGED
@@ -260,9 +260,17 @@ void EventMachine_t::SetuidString (const char *username)
260
260
  if (!username || !*username)
261
261
  throw std::runtime_error ("setuid_string failed: no username specified");
262
262
 
263
+ errno = 0;
263
264
  struct passwd *p = getpwnam (username);
264
- if (!p)
265
- throw std::runtime_error ("setuid_string failed: unknown username");
265
+ if (!p) {
266
+ if (errno) {
267
+ char buf[200];
268
+ snprintf (buf, sizeof(buf)-1, "setuid_string failed: %s", strerror(errno));
269
+ throw std::runtime_error (buf);
270
+ } else {
271
+ throw std::runtime_error ("setuid_string failed: unknown username");
272
+ }
273
+ }
266
274
 
267
275
  if (setuid (p->pw_uid) != 0)
268
276
  throw std::runtime_error ("setuid_string failed: no setuid");
@@ -1187,9 +1195,12 @@ const uintptr_t EventMachine_t::ConnectToServer (const char *bind_addr, int bind
1187
1195
  throw std::runtime_error ("invalid server or port");
1188
1196
 
1189
1197
  int family, bind_size;
1190
- struct sockaddr bind_as, *bind_as_ptr = name2address (server, port, &family, &bind_size);
1191
- if (!bind_as_ptr)
1192
- throw std::runtime_error ("unable to resolve server address");
1198
+ struct sockaddr_storage bind_as, *bind_as_ptr = (struct sockaddr_storage*)name2address (server, port, &family, &bind_size);
1199
+ if (!bind_as_ptr) {
1200
+ char buf [200];
1201
+ snprintf (buf, sizeof(buf)-1, "unable to resolve server address: %s", strerror(errno));
1202
+ throw std::runtime_error (buf);
1203
+ }
1193
1204
  bind_as = *bind_as_ptr; // copy because name2address points to a static
1194
1205
 
1195
1206
  int sd = EmSocket (family, SOCK_STREAM, 0);
@@ -1229,7 +1240,7 @@ const uintptr_t EventMachine_t::ConnectToServer (const char *bind_addr, int bind
1229
1240
 
1230
1241
  #ifdef OS_UNIX
1231
1242
  //if (connect (sd, (sockaddr*)&pin, sizeof pin) == 0) {
1232
- if (connect (sd, &bind_as, bind_size) == 0) {
1243
+ if (connect (sd, (struct sockaddr*)&bind_as, bind_size) == 0) {
1233
1244
  // This is a connect success, which Linux appears
1234
1245
  // never to give when the socket is nonblocking,
1235
1246
  // even if the connection is intramachine or to
@@ -1420,8 +1431,13 @@ EventMachine_t::AttachFD
1420
1431
  const uintptr_t EventMachine_t::AttachFD (int fd, bool watch_mode)
1421
1432
  {
1422
1433
  #ifdef OS_UNIX
1423
- if (fcntl(fd, F_GETFL, 0) < 0)
1424
- throw std::runtime_error ("invalid file descriptor");
1434
+ if (fcntl(fd, F_GETFL, 0) < 0) {
1435
+ if (errno) {
1436
+ throw std::runtime_error (strerror(errno));
1437
+ } else {
1438
+ throw std::runtime_error ("invalid file descriptor");
1439
+ }
1440
+ }
1425
1441
  #endif
1426
1442
 
1427
1443
  #ifdef OS_WIN32
data/ext/em.h CHANGED
@@ -93,6 +93,19 @@ typedef fd_set rb_fdset_t;
93
93
  rb_thread_select(fd_check((n)-1) ? (n) : FD_SETSIZE, (rfds), (wfds), (efds), (timeout))
94
94
  #endif
95
95
 
96
+
97
+ // This Solaris fix is adapted from eval_intern.h in Ruby 1.9.3:
98
+ // Solaris sys/select.h switches select to select_large_fdset to support larger
99
+ // file descriptors if FD_SETSIZE is larger than 1024 on 32bit environment.
100
+ // But Ruby doesn't change FD_SETSIZE because fd_set is allocated dynamically.
101
+ // So following definition is required to use select_large_fdset.
102
+ #ifdef HAVE_SELECT_LARGE_FDSET
103
+ #define select(n, r, w, e, t) select_large_fdset((n), (r), (w), (e), (t))
104
+ extern "C" {
105
+ int select_large_fdset(int, fd_set *, fd_set *, fd_set *, struct timeval *);
106
+ }
107
+ #endif
108
+
96
109
  class EventableDescriptor;
97
110
  class InotifyDescriptor;
98
111
  struct SelectData_t;
@@ -1,6 +1,9 @@
1
1
  require 'fileutils'
2
2
  require 'mkmf'
3
3
 
4
+ # Eager check devs tools
5
+ have_devel? if respond_to?(:have_devel?)
6
+
4
7
  def check_libs libs = [], fatal = false
5
8
  libs.all? { |lib| have_library(lib) || (abort("could not find library: #{lib}") if fatal) }
6
9
  end
@@ -22,34 +25,58 @@ def append_library(libs, lib)
22
25
  libs + " " + format(LIBARG, lib)
23
26
  end
24
27
 
25
- def manual_ssl_config
26
- ssl_libs_heads_args = {
27
- :unix => [%w[ssl crypto], %w[openssl/ssl.h openssl/err.h]],
28
- :mswin => [%w[ssleay32 libeay32], %w[openssl/ssl.h openssl/err.h]],
29
- }
28
+ SSL_HEADS = %w(openssl/ssl.h openssl/err.h)
29
+ SSL_LIBS = case RUBY_PLATFORM
30
+ when /mswin|mingw|bccwin/ ; %w(ssleay32 libeay32)
31
+ else ; %w(crypto ssl)
32
+ end
30
33
 
31
- dc_flags = ['ssl']
32
- dc_flags += ["#{ENV['OPENSSL']}/include", ENV['OPENSSL']] if /linux/ =~ RUBY_PLATFORM and ENV['OPENSSL']
34
+ def dir_config_wrapper(pretty_name, name, idefault=nil, ldefault=nil)
35
+ inc, lib = dir_config(name, idefault, ldefault)
36
+ if inc && lib
37
+ # TODO: Remove when 2.0.0 is the minimum supported version
38
+ # Ruby versions not incorporating the mkmf fix at
39
+ # https://bugs.ruby-lang.org/projects/ruby-trunk/repository/revisions/39717
40
+ # do not properly search for lib directories, and must be corrected
41
+ unless lib && lib[-3, 3] == 'lib'
42
+ @libdir_basename = 'lib'
43
+ inc, lib = dir_config(name, idefault, ldefault)
44
+ end
45
+ unless idefault && ldefault
46
+ abort "-----\nCannot find #{pretty_name} include path #{inc}\n-----" unless inc && inc.split(File::PATH_SEPARATOR).any? { |dir| File.directory?(dir) }
47
+ abort "-----\nCannot find #{pretty_name} library path #{lib}\n-----" unless lib && lib.split(File::PATH_SEPARATOR).any? { |dir| File.directory?(dir) }
48
+ warn "-----\nUsing #{pretty_name} in path #{File.dirname inc}\n-----"
49
+ end
50
+ true
51
+ end
52
+ end
33
53
 
34
- libs, heads = case RUBY_PLATFORM
35
- when /mswin|mingw|bccwin/ ; ssl_libs_heads_args[:mswin]
36
- else ssl_libs_heads_args[:unix]
54
+ def dir_config_search(pretty_name, name, paths, &b)
55
+ paths.each do |p|
56
+ if dir_config_wrapper('OpenSSL', 'ssl', p + '/include', p + '/lib') && yield
57
+ warn "-----\nFound #{pretty_name} in path #{p}\n-----"
58
+ return true
59
+ end
37
60
  end
38
- dir_config(*dc_flags)
39
- check_libs(libs) and check_heads(heads)
40
61
  end
41
62
 
42
- # Eager check devs tools
43
- have_devel? if respond_to?(:have_devel?)
63
+ def pkg_config_wrapper(pretty_name, name)
64
+ cflags, ldflags, libs = pkg_config(name)
65
+ unless [cflags, ldflags, libs].any?(&:nil?) || [cflags, ldflags, libs].any?(&:empty?)
66
+ warn "-----\nUsing #{pretty_name} from pkg-config #{cflags} && #{ldflags} && #{libs}\n-----"
67
+ true
68
+ end
69
+ end
44
70
 
45
71
  if ENV['CROSS_COMPILING']
46
- openssl_version = ENV.fetch("OPENSSL_VERSION", "1.0.1i")
72
+ openssl_version = ENV.fetch("OPENSSL_VERSION", "1.0.2e")
47
73
  openssl_dir = File.expand_path("~/.rake-compiler/builds/openssl-#{openssl_version}/")
48
74
  if File.exist?(openssl_dir)
49
75
  FileUtils.mkdir_p Dir.pwd+"/openssl/"
50
76
  FileUtils.cp Dir[openssl_dir+"/include/openssl/*.h"], Dir.pwd+"/openssl/", :verbose => true
51
77
  FileUtils.cp Dir[openssl_dir+"/lib*.a"], Dir.pwd, :verbose => true
52
78
  $INCFLAGS << " -I#{Dir.pwd}" # for the openssl headers
79
+ add_define "WITH_SSL"
53
80
  else
54
81
  STDERR.puts
55
82
  STDERR.puts "**************************************************************************************"
@@ -58,13 +85,20 @@ if ENV['CROSS_COMPILING']
58
85
  STDERR.puts "**************************************************************************************"
59
86
  STDERR.puts
60
87
  end
61
- end
62
-
63
- # Try to use pkg_config first, fixes #73
64
- if (!ENV['CROSS_COMPILING'] and pkg_config('openssl')) || manual_ssl_config
65
- add_define "WITH_SSL"
66
- else
67
- add_define "WITHOUT_SSL"
88
+ elsif dir_config_wrapper('OpenSSL', 'ssl')
89
+ # If the user has provided a --with-ssl-dir argument, we must respect it or fail.
90
+ add_define 'WITH_SSL' if check_libs(SSL_LIBS) && check_heads(SSL_HEADS)
91
+ elsif pkg_config_wrapper('OpenSSL', 'openssl')
92
+ # If we can detect OpenSSL by pkg-config, use it as the next-best option
93
+ add_define 'WITH_SSL' if check_libs(SSL_LIBS) && check_heads(SSL_HEADS)
94
+ elsif check_libs(SSL_LIBS) && check_heads(SSL_HEADS)
95
+ # If we don't even need any options to find a usable OpenSSL, go with it
96
+ add_define 'WITH_SSL'
97
+ elsif dir_config_search('OpenSSL', 'ssl', ['/usr/local', '/opt/local', '/usr/local/opt/openssl']) do
98
+ check_libs(SSL_LIBS) && check_heads(SSL_HEADS)
99
+ end
100
+ # Finally, look for OpenSSL in alternate locations including MacPorts and HomeBrew
101
+ add_define 'WITH_SSL'
68
102
  end
69
103
 
70
104
  add_define 'BUILD_FOR_RUBY'
@@ -125,13 +159,21 @@ when /solaris/
125
159
  add_define 'OS_SOLARIS8'
126
160
  check_libs(%w[nsl socket], true)
127
161
 
128
- if CONFIG['CC'] == 'cc' and `cc -flags 2>&1` =~ /Sun/ # detect SUNWspro compiler
162
+ # If Ruby was compiled for 32-bits, then select() can only handle 1024 fds
163
+ # There is an alternate function, select_large_fdset, that supports more.
164
+ add_define 'HAVE_SELECT_LARGE_FDSET' if have_func('select_large_fdset', 'sys/select.h')
165
+
166
+ if CONFIG['CC'] == 'cc' && (
167
+ `cc -flags 2>&1` =~ /Sun/ || # detect SUNWspro compiler
168
+ `cc -V 2>&1` =~ /Sun/ # detect Solaris Studio compiler
169
+ )
129
170
  # SUN CHAIN
130
171
  add_define 'CC_SUNWspro'
131
172
  $preload = ["\nCXX = CC"] # hack a CXX= line into the makefile
132
173
  $CFLAGS = CONFIG['CFLAGS'] = "-KPIC"
133
174
  CONFIG['CCDLFLAGS'] = "-KPIC"
134
175
  CONFIG['LDSHARED'] = "$(CXX) -G -KPIC -lCstd"
176
+ CONFIG['LDSHAREDXX'] = "$(CXX) -G -KPIC -lCstd"
135
177
  else
136
178
  # GNU CHAIN
137
179
  # on Unix we need a g++ link, not gcc.
@@ -175,37 +217,39 @@ else
175
217
  CONFIG['LDSHARED'] = "$(CXX) -shared"
176
218
  end
177
219
 
220
+ # Platform-specific time functions
221
+ if have_func('clock_gettime')
222
+ # clock_gettime is POSIX, but the monotonic clocks are not
223
+ have_const('CLOCK_MONOTONIC_RAW', 'time.h') # Linux
224
+ have_const('CLOCK_MONOTONIC', 'time.h') # Linux, Solaris, BSDs
225
+ else
226
+ have_func('gethrtime') # Older Solaris and HP-UX
227
+ end
228
+
229
+ # Hack so that try_link will test with a C++ compiler instead of a C compiler
230
+ TRY_LINK.sub!('$(CC)', '$(CXX)')
231
+
178
232
  # This is our wishlist. We use whichever flags work on the host.
179
233
  # In the future, add -Werror to make sure all warnings are resolved.
180
234
  # deprecated-declarations are used in OS X OpenSSL
181
235
  # ignored-qualifiers are used by the Bindings (would-be void *)
182
236
  # unused-result because GCC 4.6 no longer silences (void) ignore_this(function)
237
+ # address because on Windows, rb_fd_select checks if &fds is non-NULL, which it cannot be
183
238
  %w(
184
239
  -Wall
185
240
  -Wextra
186
241
  -Wno-deprecated-declarations
187
242
  -Wno-ignored-qualifiers
188
243
  -Wno-unused-result
244
+ -Wno-address
189
245
  ).select do |flag|
190
246
  try_link('int main() {return 0;}', flag)
191
247
  end.each do |flag|
192
- $CFLAGS << ' ' << flag
193
- $CPPFLAGS << ' ' << flag
194
- end
195
- puts "CFLAGS=#{$CFLAGS}"
196
- puts "CPPFLAGS=#{$CPPFLAGS}"
197
-
198
- # Platform-specific time functions
199
- if have_func('clock_gettime')
200
- # clock_gettime is POSIX, but the monotonic clocks are not
201
- have_const('CLOCK_MONOTONIC_RAW', 'time.h') # Linux
202
- have_const('CLOCK_MONOTONIC', 'time.h') # Linux, Solaris, BSDs
203
- else
204
- have_func('gethrtime') # Older Solaris and HP-UX
248
+ CONFIG['CXXFLAGS'] << ' ' << flag
205
249
  end
250
+ puts "CXXFLAGS=#{CONFIG['CXXFLAGS']}"
206
251
 
207
- # solaris c++ compiler doesn't have make_pair()
208
- TRY_LINK.sub!('$(CC)', '$(CXX)')
252
+ # Solaris C++ compiler doesn't have make_pair()
209
253
  add_define 'HAVE_MAKE_PAIR' if try_link(<<SRC, '-lstdc++')
210
254
  #include <utility>
211
255
  using namespace std;
@@ -56,13 +56,17 @@ when /solaris/
56
56
  add_define 'OS_SOLARIS8'
57
57
  check_libs(%w[nsl socket], true)
58
58
 
59
- if CONFIG['CC'] == 'cc' and `cc -flags 2>&1` =~ /Sun/ # detect SUNWspro compiler
59
+ if CONFIG['CC'] == 'cc' && (
60
+ `cc -flags 2>&1` =~ /Sun/ || # detect SUNWspro compiler
61
+ `cc -V 2>&1` =~ /Sun/ # detect Solaris Studio compiler
62
+ )
60
63
  # SUN CHAIN
61
64
  add_define 'CC_SUNWspro'
62
65
  $preload = ["\nCXX = CC"] # hack a CXX= line into the makefile
63
66
  $CFLAGS = CONFIG['CFLAGS'] = "-KPIC"
64
67
  CONFIG['CCDLFLAGS'] = "-KPIC"
65
68
  CONFIG['LDSHARED'] = "$(CXX) -G -KPIC -lCstd"
69
+ CONFIG['LDSHAREDXX'] = "$(CXX) -G -KPIC -lCstd"
66
70
  else
67
71
  # GNU CHAIN
68
72
  # on Unix we need a g++ link, not gcc.
@@ -89,6 +89,8 @@ void Mapper_t::Close()
89
89
  // Calls to GetChunk are invalid after a call to Close.
90
90
  if (MapPoint) {
91
91
  #ifdef CC_SUNWspro
92
+ // TODO: The void * cast works fine on Solaris 11, but
93
+ // I don't know at what point that changed from older Solaris.
92
94
  munmap ((char*)MapPoint, FileSize);
93
95
  #else
94
96
  munmap ((void*)MapPoint, FileSize);
@@ -229,6 +229,11 @@ void PipeDescriptor::Write()
229
229
 
230
230
  assert (GetSocket() != INVALID_SOCKET);
231
231
  int bytes_written = write (GetSocket(), output_buffer, nbytes);
232
+ #ifdef OS_WIN32
233
+ int e = WSAGetLastError();
234
+ #else
235
+ int e = errno;
236
+ #endif
232
237
 
233
238
  if (bytes_written > 0) {
234
239
  OutboundDataSize -= bytes_written;
@@ -251,10 +256,10 @@ void PipeDescriptor::Write()
251
256
  }
252
257
  else {
253
258
  #ifdef OS_UNIX
254
- if ((errno != EINPROGRESS) && (errno != EWOULDBLOCK) && (errno != EINTR))
259
+ if ((e != EINPROGRESS) && (e != EWOULDBLOCK) && (e != EINTR))
255
260
  #endif
256
261
  #ifdef OS_WIN32
257
- if ((errno != WSAEINPROGRESS) && (errno != WSAEWOULDBLOCK))
262
+ if ((e != WSAEINPROGRESS) && (e != WSAEWOULDBLOCK))
258
263
  #endif
259
264
  Close();
260
265
  }
@@ -345,11 +345,11 @@ static VALUE t_set_tls_parms (VALUE self UNUSED, VALUE signature, VALUE privkeyf
345
345
  t_get_peer_cert
346
346
  ***************/
347
347
 
348
+ #ifdef WITH_SSL
348
349
  static VALUE t_get_peer_cert (VALUE self UNUSED, VALUE signature)
349
350
  {
350
351
  VALUE ret = Qnil;
351
352
 
352
- #ifdef WITH_SSL
353
353
  X509 *cert = NULL;
354
354
  BUF_MEM *buf;
355
355
  BIO *out;
@@ -364,10 +364,15 @@ static VALUE t_get_peer_cert (VALUE self UNUSED, VALUE signature)
364
364
  X509_free(cert);
365
365
  BIO_free(out);
366
366
  }
367
- #endif
368
367
 
369
368
  return ret;
370
369
  }
370
+ #else
371
+ static VALUE t_get_peer_cert (VALUE self UNUSED, VALUE signature UNUSED)
372
+ {
373
+ return Qnil;
374
+ }
375
+ #endif
371
376
 
372
377
  /**************
373
378
  t_get_peername
@@ -982,10 +987,8 @@ t__epoll
982
987
 
983
988
  static VALUE t__epoll (VALUE self UNUSED)
984
989
  {
985
- if (t__epoll_p(self) == Qfalse) {
986
- rb_warn ("epoll is not supported on this platform");
990
+ if (t__epoll_p(self) == Qfalse)
987
991
  return Qfalse;
988
- }
989
992
 
990
993
  evma_set_epoll (1);
991
994
  return Qtrue;
@@ -997,8 +1000,8 @@ t__epoll_set
997
1000
 
998
1001
  static VALUE t__epoll_set (VALUE self, VALUE val)
999
1002
  {
1000
- if (t__epoll_p(self) == Qfalse)
1001
- rb_warn ("epoll is not supported on this platform");
1003
+ if (t__epoll_p(self) == Qfalse && val == Qtrue)
1004
+ rb_raise (EM_eUnsupported, "%s", "epoll is not supported on this platform");
1002
1005
 
1003
1006
  evma_set_epoll (val == Qtrue ? 1 : 0);
1004
1007
  return val;
@@ -1024,10 +1027,8 @@ t__kqueue
1024
1027
 
1025
1028
  static VALUE t__kqueue (VALUE self UNUSED)
1026
1029
  {
1027
- if (t__kqueue_p(self) == Qfalse) {
1028
- rb_warn ("kqueue is not supported on this platform");
1030
+ if (t__kqueue_p(self) == Qfalse)
1029
1031
  return Qfalse;
1030
- }
1031
1032
 
1032
1033
  evma_set_kqueue (1);
1033
1034
  return Qtrue;
@@ -1039,8 +1040,8 @@ t__kqueue_set
1039
1040
 
1040
1041
  static VALUE t__kqueue_set (VALUE self, VALUE val)
1041
1042
  {
1042
- if (t__kqueue_p(self) == Qfalse)
1043
- rb_warn ("kqueue is not supported on this platform");
1043
+ if (t__kqueue_p(self) == Qfalse && val == Qtrue)
1044
+ rb_raise (EM_eUnsupported, "%s", "kqueue is not supported on this platform");
1044
1045
 
1045
1046
  evma_set_kqueue (val == Qtrue ? 1 : 0);
1046
1047
  return val;
@@ -296,7 +296,7 @@ int SslBox_t::GetPlaintext (char *buf, int bufsize)
296
296
  {
297
297
  if (!SSL_is_init_finished (pSSL)) {
298
298
  int e = bIsServer ? SSL_accept (pSSL) : SSL_connect (pSSL);
299
- if (e < 0) {
299
+ if (e != 1) {
300
300
  int er = SSL_get_error (pSSL, e);
301
301
  if (er != SSL_ERROR_WANT_READ) {
302
302
  // Return -1 for a nonfatal error, -2 for an error that should force the connection down.
@@ -312,7 +312,7 @@ int SslBox_t::GetPlaintext (char *buf, int bufsize)
312
312
  if (!SSL_is_init_finished (pSSL)) {
313
313
  // We can get here if a browser abandons a handshake.
314
314
  // The user can see a warning dialog and abort the connection.
315
- cerr << "<SSL_incomp>";
315
+ //cerr << "<SSL_incomp>";
316
316
  return 0;
317
317
  }
318
318
 
@@ -1,3 +1,3 @@
1
1
  module EventMachine
2
- VERSION = "1.0.8"
2
+ VERSION = "1.0.9"
3
3
  end
@@ -754,7 +754,12 @@ module EventMachine
754
754
  end
755
755
 
756
756
  if io.respond_to?(:fileno)
757
- fd = defined?(JRuby) ? JRuby.runtime.getDescriptorByFileno(io.fileno).getChannel : io.fileno
757
+ # getDescriptorByFileno deprecated in JRuby 1.7.x, removed in JRuby 9000
758
+ if defined?(JRuby) && JRuby.runtime.respond_to?(:getDescriptorByFileno)
759
+ fd = JRuby.runtime.getDescriptorByFileno(io.fileno).getChannel
760
+ else
761
+ fd = io.fileno
762
+ end
758
763
  else
759
764
  fd = io
760
765
  end
@@ -41,6 +41,10 @@ class Test::Unit::TestCase
41
41
  RbConfig::CONFIG['host_os'] =~ /mswin|mingw/
42
42
  end
43
43
 
44
+ def solaris?
45
+ RUBY_PLATFORM =~ /solaris/
46
+ end
47
+
44
48
  # http://stackoverflow.com/questions/1342535/how-can-i-tell-if-im-running-from-jruby-vs-ruby/1685970#1685970
45
49
  def jruby?
46
50
  defined? JRUBY_VERSION
@@ -34,6 +34,7 @@ class TestFileWatch < Test::Unit::TestCase
34
34
  end
35
35
 
36
36
  def test_events
37
+ omit_if(solaris?)
37
38
  EM.run{
38
39
  file = Tempfile.new('em-watch')
39
40
  $tmp_path = file.path
metadata CHANGED
@@ -1,58 +1,72 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: eventmachine
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.8
4
+ version: 1.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Francis Cianfrocca
8
8
  - Aman Gupta
9
- autorequire:
9
+ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-08-06 00:00:00.000000000 Z
12
+ date: 2016-01-13 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: test-unit
16
- version_requirements: !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
17
17
  requirements:
18
18
  - - ~>
19
19
  - !ruby/object:Gem::Version
20
20
  version: '2.0'
21
- requirement: !ruby/object:Gem::Requirement
21
+ type: :development
22
+ prerelease: false
23
+ version_requirements: !ruby/object:Gem::Requirement
22
24
  requirements:
23
25
  - - ~>
24
26
  - !ruby/object:Gem::Version
25
27
  version: '2.0'
26
- prerelease: false
27
- type: :development
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: rake-compiler
30
- version_requirements: !ruby/object:Gem::Requirement
30
+ requirement: !ruby/object:Gem::Requirement
31
31
  requirements:
32
32
  - - ~>
33
33
  - !ruby/object:Gem::Version
34
34
  version: 0.8.3
35
- requirement: !ruby/object:Gem::Requirement
35
+ type: :development
36
+ prerelease: false
37
+ version_requirements: !ruby/object:Gem::Requirement
36
38
  requirements:
37
39
  - - ~>
38
40
  - !ruby/object:Gem::Version
39
41
  version: 0.8.3
40
- prerelease: false
41
- type: :development
42
42
  - !ruby/object:Gem::Dependency
43
43
  name: yard
44
+ requirement: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - '>='
47
+ - !ruby/object:Gem::Version
48
+ version: 0.8.5.2
49
+ type: :development
50
+ prerelease: false
44
51
  version_requirements: !ruby/object:Gem::Requirement
45
52
  requirements:
46
53
  - - '>='
47
54
  - !ruby/object:Gem::Version
48
55
  version: 0.8.5.2
56
+ - !ruby/object:Gem::Dependency
57
+ name: bluecloth
49
58
  requirement: !ruby/object:Gem::Requirement
50
59
  requirements:
51
60
  - - '>='
52
61
  - !ruby/object:Gem::Version
53
- version: 0.8.5.2
54
- prerelease: false
62
+ version: '0'
55
63
  type: :development
64
+ prerelease: false
65
+ version_requirements: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - '>='
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
56
70
  description: |-
57
71
  EventMachine implements a fast, single-threaded engine for arbitrary network
58
72
  communications. It's extremely easy to use in Ruby. EventMachine wraps all
@@ -261,7 +275,7 @@ licenses:
261
275
  - Ruby
262
276
  - GPL
263
277
  metadata: {}
264
- post_install_message:
278
+ post_install_message:
265
279
  rdoc_options:
266
280
  - --title
267
281
  - EventMachine
@@ -285,8 +299,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
285
299
  version: '0'
286
300
  requirements: []
287
301
  rubyforge_project: eventmachine
288
- rubygems_version: 2.4.8
289
- signing_key:
302
+ rubygems_version: 2.0.14
303
+ signing_key:
290
304
  specification_version: 4
291
305
  summary: Ruby/EventMachine library
292
306
  test_files: []