eventmachine 0.12.8-java → 0.12.10-java

Sign up to get free protection for your applications and to get access to all the features.
Files changed (66) hide show
  1. data/.gitignore +2 -1
  2. data/Rakefile +155 -45
  3. data/eventmachine.gemspec +4 -5
  4. data/ext/binder.cpp +13 -14
  5. data/ext/binder.h +5 -7
  6. data/ext/cmain.cpp +184 -42
  7. data/ext/cplusplus.cpp +20 -20
  8. data/ext/ed.cpp +242 -81
  9. data/ext/ed.h +39 -22
  10. data/ext/em.cpp +127 -108
  11. data/ext/em.h +27 -18
  12. data/ext/emwin.cpp +3 -3
  13. data/ext/eventmachine.h +49 -38
  14. data/ext/eventmachine_cpp.h +4 -4
  15. data/ext/extconf.rb +28 -13
  16. data/ext/fastfilereader/extconf.rb +11 -5
  17. data/ext/project.h +12 -1
  18. data/ext/rubymain.cpp +222 -103
  19. data/ext/ssl.cpp +3 -3
  20. data/ext/ssl.h +2 -2
  21. data/java/src/com/rubyeventmachine/EmReactor.java +396 -249
  22. data/java/src/com/rubyeventmachine/EventableChannel.java +16 -4
  23. data/java/src/com/rubyeventmachine/EventableDatagramChannel.java +23 -5
  24. data/java/src/com/rubyeventmachine/EventableSocketChannel.java +181 -61
  25. data/java/src/com/rubyeventmachine/{Application.java → application/Application.java} +25 -31
  26. data/java/src/com/rubyeventmachine/{Connection.java → application/Connection.java} +2 -2
  27. data/java/src/com/rubyeventmachine/{ConnectionFactory.java → application/ConnectionFactory.java} +1 -1
  28. data/java/src/com/rubyeventmachine/{DefaultConnectionFactory.java → application/DefaultConnectionFactory.java} +2 -2
  29. data/java/src/com/rubyeventmachine/{PeriodicTimer.java → application/PeriodicTimer.java} +1 -1
  30. data/java/src/com/rubyeventmachine/{Timer.java → application/Timer.java} +1 -1
  31. data/java/src/com/rubyeventmachine/tests/ApplicationTest.java +1 -0
  32. data/java/src/com/rubyeventmachine/tests/ConnectTest.java +4 -2
  33. data/java/src/com/rubyeventmachine/tests/TestDatagrams.java +1 -1
  34. data/java/src/com/rubyeventmachine/tests/TestServers.java +1 -0
  35. data/java/src/com/rubyeventmachine/tests/TestTimers.java +1 -0
  36. data/lib/em/connection.rb +71 -12
  37. data/lib/em/deferrable.rb +5 -0
  38. data/lib/em/protocols.rb +1 -0
  39. data/lib/em/protocols/httpclient2.rb +8 -0
  40. data/lib/em/protocols/line_and_text.rb +0 -1
  41. data/lib/em/protocols/linetext2.rb +1 -0
  42. data/lib/em/protocols/object_protocol.rb +8 -2
  43. data/lib/em/protocols/smtpclient.rb +42 -16
  44. data/lib/em/protocols/socks4.rb +66 -0
  45. data/lib/em/queue.rb +1 -1
  46. data/lib/em/timers.rb +2 -1
  47. data/lib/em/version.rb +1 -1
  48. data/lib/eventmachine.rb +125 -169
  49. data/lib/jeventmachine.rb +124 -9
  50. data/tasks/{cpp.rake → cpp.rake_example} +0 -0
  51. data/tests/test_attach.rb +29 -4
  52. data/tests/test_basic.rb +1 -2
  53. data/tests/test_connection_count.rb +10 -20
  54. data/tests/test_epoll.rb +0 -2
  55. data/tests/test_get_sock_opt.rb +30 -0
  56. data/tests/test_httpclient2.rb +3 -3
  57. data/tests/test_inactivity_timeout.rb +21 -1
  58. data/tests/test_ltp.rb +0 -6
  59. data/tests/test_next_tick.rb +0 -2
  60. data/tests/test_pause.rb +70 -0
  61. data/tests/test_pending_connect_timeout.rb +48 -0
  62. data/tests/test_ssl_args.rb +16 -5
  63. data/tests/test_timers.rb +22 -1
  64. metadata +59 -52
  65. data/tasks/project.rake +0 -79
  66. data/tasks/tests.rake +0 -193
data/.gitignore CHANGED
@@ -10,4 +10,5 @@ Makefile
10
10
  *.o
11
11
  *.log
12
12
  *.def
13
- *.pdb
13
+ *.pdb
14
+ java/src/.project
data/Rakefile CHANGED
@@ -20,7 +20,7 @@
20
20
  # # both contain the proper references to OPENSSL. Use the static version
21
21
  # # of the libraries, not the dynamic, otherwise we expose the user to a
22
22
  # # runtime dependency.
23
- #
23
+ #
24
24
  # # To build a binary gem for win32, first build rubyeventmachine.so
25
25
  # # using VC6 outside of the build tree (the normal way: ruby extconf.rb,
26
26
  # # and then nmake). Then copy rubyeventmachine.so into the lib directory,
@@ -29,7 +29,6 @@
29
29
 
30
30
  require 'rubygems' unless defined?(Gem)
31
31
  require 'rake' unless defined?(Rake)
32
- require 'rake/gempackagetask'
33
32
 
34
33
  Package = false # Build zips and tarballs?
35
34
  Dir.glob('tasks/*.rake').each { |r| Rake.application.add_import r }
@@ -44,17 +43,8 @@ else
44
43
  'make'
45
44
  end
46
45
 
47
- # If running under rubygems...
48
- __DIR__ ||= File.expand_path(File.dirname(__FILE__))
49
- if Gem.path.map{|path| Dir.chdir(path){ Dir.pwd } rescue path }.any? {|path| %r(^#{Regexp.escape path}) =~ __DIR__}
50
- task :default => :gem_build
51
- else
52
- desc "Build gemspec, then build eventmachine, then run tests."
53
- task :default => [:build, :test]
54
- end
55
-
56
- desc ":default build when running under rubygems."
57
- task :gem_build => :build
46
+ desc "Build gemspec, then build eventmachine, then run tests."
47
+ task :default => [:build, :test]
58
48
 
59
49
  desc "Build extension (or EVENTMACHINE_LIBRARY) and place in lib"
60
50
  build_task = 'ext:build'
@@ -68,6 +58,12 @@ end
68
58
 
69
59
  task :dummy_build
70
60
 
61
+ require 'rake/testtask'
62
+ Rake::TestTask.new(:test) do |t|
63
+ t.pattern = 'tests/**/test_*.rb'
64
+ t.warning = true
65
+ end
66
+
71
67
  # Basic clean definition, this is enhanced by imports aswell.
72
68
  task :clean do
73
69
  chdir 'ext' do
@@ -94,7 +90,7 @@ Spec = Gem::Specification.new do |s|
94
90
 
95
91
  s.require_path = 'lib'
96
92
 
97
- # TODO / XXX - should we enable this? rubygems fails the install if anything
93
+ # TODO / XXX - should we enable this? rubygems fails the install if anything
98
94
  # is broken. What we could do is CI submission, though, and always terminate
99
95
  # with a positive code...
100
96
  # s.test_file = "tests/testem.rb"
@@ -195,31 +191,32 @@ end
195
191
  namespace :ext do
196
192
  ext_sources = FileList['ext/*.{h,cpp,rb,c}']
197
193
  ffr_sources = FileList['ext/fastfilereader/*.{h,cpp,rb}']
194
+ file ext_extconf = 'ext/extconf.rb'
195
+ file ffr_extconf = 'ext/fastfilereader/extconf.rb'
196
+ ext_libname = "lib/rubyeventmachine.#{Config::CONFIG['DLEXT']}"
197
+ ffr_libname = "lib/fastfilereaderext.#{Config::CONFIG['DLEXT']}"
198
+
199
+ file ext_libname => ext_sources + ['ext/Makefile'] do
200
+ chdir('ext') { sh MAKE }
201
+ end
198
202
 
203
+ file ffr_libname => ffr_sources + ['ext/fastfilereader/Makefile'] do
204
+ chdir('ext/fastfilereader') { sh MAKE }
205
+ end
206
+
199
207
  desc "Build C++ extension"
200
208
  task :build => [:make]
201
-
202
- desc "make extensions"
203
- task :make => ext_sources + ['ext/Makefile'] do
204
- chdir 'ext' do
205
- sh MAKE
206
- end
207
- end
208
- task :make => ffr_sources + ['ext/fastfilereader/Makefile'] do
209
- chdir 'ext/fastfilereader' do
210
- sh MAKE
211
- end
212
- end
213
-
214
- desc 'Compile the makefile'
215
- file 'ext/Makefile' => ext_sources do
209
+
210
+ task :make => ext_libname
211
+ task :make => ffr_libname
212
+
213
+ file 'ext/Makefile' => ext_extconf do
216
214
  chdir 'ext' do
217
215
  ruby 'extconf.rb'
218
216
  end
219
217
  end
220
218
 
221
- desc 'Compile fastfilereader makefile'
222
- file 'ext/fastfilereader/Makefile' => ffr_sources do
219
+ file 'ext/fastfilereader/Makefile' => ffr_extconf do
223
220
  chdir 'ext/fastfilereader' do
224
221
  ruby 'extconf.rb'
225
222
  end
@@ -231,34 +228,147 @@ namespace :java do
231
228
  # This step is required before executing the jgem task.
232
229
  desc "Build java extension"
233
230
  task :build => [:jar] do |t|
234
- chdir('java/src') do
235
- mv 'em_reactor.jar', '../../lib/em_reactor.jar'
236
- end
231
+ mv 'java/em_reactor.jar', 'lib/'
237
232
  end
238
-
239
- desc "compile .java to .class"
233
+
240
234
  task :compile do
241
- chdir('java/src') do
242
- sh 'javac com/rubyeventmachine/*.java'
235
+ chdir('java') do
236
+ mkdir_p "build"
237
+ sh 'javac src/com/rubyeventmachine/*.java -d build'
243
238
  end
244
239
  end
245
-
246
- desc "compile .classes to .jar"
240
+
247
241
  task :jar => [:compile] do
248
- chdir('java/src') do
249
- sh "jar -cf em_reactor.jar com/rubyeventmachine/*.class"
242
+ chdir('java/build') do
243
+ sh "jar -cf ../em_reactor.jar com/rubyeventmachine/*.class"
250
244
  end
251
245
  end
252
246
 
253
247
  desc "build a java binary gem"
254
248
  task :gem => :build do
249
+ Spec.platform = 'java'
250
+ Spec.files += %w[ lib/em_reactor.jar ]
251
+ Spec.extensions = nil
252
+
255
253
  Rake::Task['gem'].invoke
256
254
  end
257
255
  end
258
256
 
259
- task :gemspec => :clobber do
260
- open("eventmachine.gemspec", 'w') { |f| f.write Spec.to_ruby }
257
+ namespace :osx do
258
+ desc "Build OSX binary gem"
259
+ task :gem do
260
+ Spec.platform = RUBY_PLATFORM.sub(/darwin.+$/, 'darwin')
261
+ Spec.files += %w[ lib/rubyeventmachine.bundle lib/fastfilereaderext.bundle ]
262
+ Spec.extensions = nil
263
+
264
+ Rake::Task['build'].invoke
265
+ Rake::Task['gem'].invoke
266
+ end
267
+
268
+ # XXX gcc will still prefer the shared libssl on the system, so we need to hack the extconf
269
+ # XXX to use the static library to make this actually work
270
+ task :static_gem => [:build_openssl, :gem]
271
+
272
+ task :build_openssl do
273
+ mkdir_p 'build'
274
+ chdir 'build' do
275
+ unless File.exists?('openssl-0.9.8j')
276
+ sh 'curl http://www.openssl.org/source/openssl-0.9.8j.tar.gz > openssl-0.9.8j.tar.gz'
277
+ sh 'tar zxvf openssl-0.9.8j.tar.gz'
278
+ end
279
+
280
+ mkdir_p 'local'
281
+ chdir 'openssl-0.9.8j' do
282
+ local_dir = File.expand_path(File.join(File.dirname(__FILE__),'build','local'))
283
+ sh "./config --prefix=#{local_dir}"
284
+ sh 'make'
285
+ sh 'make install'
286
+ end
287
+
288
+ chdir '../ext' do
289
+ sh 'git clean -fd .'
290
+ end
291
+
292
+ mv 'local/include/openssl', '../ext/'
293
+ mv 'local/lib/libssl.a', '../ext/'
294
+ mv 'local/lib/libcrypto.a', '../ext/'
295
+ end
296
+ end
297
+ end
298
+
299
+ require 'rake/clean'
300
+
301
+ rdoc_task_type = begin
302
+ require 'rdoc/task'
303
+ RDoc::Task
304
+ rescue LoadError
305
+ require 'rake/rdoctask'
306
+ Rake::RDocTask
307
+ end
308
+ df = begin; require 'rdoc/generator/darkfish'; true; rescue LoadError; end
309
+ rdtask = rdoc_task_type.new do |rd|
310
+ rd.title = Spec.name
311
+ rd.rdoc_dir = 'rdoc'
312
+ rd.main = "README"
313
+ rd.rdoc_files.include("lib/**/*.rb", *Spec.extra_rdoc_files)
314
+ rd.rdoc_files.exclude(*%w(lib/em/version lib/emva lib/evma/ lib/pr_eventmachine lib/jeventmachine))
315
+ rd.template = 'darkfish' if df
316
+ end
317
+ Rake::Task[:clean].enhance [:clobber_rdoc]
318
+
319
+ desc 'Generate and open documentation'
320
+ task :docs => :rdoc do
321
+ case RUBY_PLATFORM
322
+ when /darwin/ ; sh 'open rdoc/index.html'
323
+ when /mswin|mingw/ ; sh 'start rdoc\index.html'
324
+ else
325
+ sh 'firefox rdoc/index.html'
326
+ end
327
+ end
328
+
329
+ def windows?; RUBY_PLATFORM =~ /mswin|mingw/; end
330
+ def sudo(cmd)
331
+ if windows? || (require 'etc'; Etc.getpwuid.uid == 0)
332
+ sh cmd
333
+ else
334
+ sh "sudo #{cmd}"
335
+ end
336
+ end
337
+ def gem_cmd(action, name, *args)
338
+ rb = Gem.ruby rescue nil
339
+ rb ||= (require 'rbconfig'; File.join(Config::CONFIG['bindir'], Config::CONFIG['ruby_install_name']))
340
+ sudo "#{rb} -r rubygems -e 'require %{rubygems/gem_runner}; Gem::GemRunner.new.run(%w{#{action} #{name} #{args.join(' ')}})'"
341
+ end
342
+
343
+ begin
344
+ require 'rubygems/package_task'
345
+ Gem::PackageTask
346
+ rescue LoadError
347
+ require 'rake/gempackagetask'
348
+ Rake::GemPackageTask
349
+ end.new(Spec) do |pkg|
350
+ pkg.need_tar, pkg.need_tar_gz, pkg.need_zip = true, true, true if Package
351
+ pkg.gem_spec = Spec
352
+ end
353
+
354
+ Rake::Task[:clean].enhance [:clobber_package]
355
+
356
+ namespace :gem do
357
+ desc 'Install gem (and sudo if required)'
358
+ task :install => :package do
359
+ gem_cmd(:install, "pkg/#{Spec.name}-#{Spec.version}.gem")
360
+ end
361
+
362
+ desc 'Uninstall gem (and sudo if required)'
363
+ task :uninstall do
364
+ gem_cmd(:uninstall, "#{Spec.name}", "-v=#{Spec.version}")
365
+ end
366
+
367
+ desc "Generate new gemspec"
368
+ task :spec => :clobber do
369
+ open("eventmachine.gemspec", 'w') { |f| f.write Spec.to_ruby }
370
+ end
261
371
  end
262
372
 
263
373
  task :clobber => :clean
264
- task :test => :build
374
+ task :test => :build
@@ -2,11 +2,11 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{eventmachine}
5
- s.version = "0.12.8"
5
+ s.version = "0.12.10"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Francis Cianfrocca"]
9
- s.date = %q{2009-05-22}
9
+ s.date = %q{2009-10-24}
10
10
  s.description = %q{EventMachine implements a fast, single-threaded engine for arbitrary network
11
11
  communications. It's extremely easy to use in Ruby. EventMachine wraps all
12
12
  interactions with IP sockets, allowing programs to concentrate on the
@@ -20,13 +20,12 @@ using TCP/IP, especially if custom protocols are required.
20
20
  }
21
21
  s.email = %q{garbagecat10@gmail.com}
22
22
  s.extensions = ["ext/extconf.rb", "ext/fastfilereader/extconf.rb"]
23
- s.has_rdoc = true
24
- s.files = [".gitignore", "README", "Rakefile", "docs/COPYING", "docs/ChangeLog", "docs/DEFERRABLES", "docs/EPOLL", "docs/GNU", "docs/INSTALL", "docs/KEYBOARD", "docs/LEGAL", "docs/LIGHTWEIGHT_CONCURRENCY", "docs/PURE_RUBY", "docs/RELEASE_NOTES", "docs/SMTP", "docs/SPAWNED_PROCESSES", "docs/TODO", "eventmachine.gemspec", "examples/ex_channel.rb", "examples/ex_queue.rb", "examples/helper.rb", "ext/binder.cpp", "ext/binder.h", "ext/cmain.cpp", "ext/cplusplus.cpp", "ext/ed.cpp", "ext/ed.h", "ext/em.cpp", "ext/em.h", "ext/emwin.cpp", "ext/emwin.h", "ext/epoll.cpp", "ext/epoll.h", "ext/eventmachine.h", "ext/eventmachine_cpp.h", "ext/extconf.rb", "ext/fastfilereader/extconf.rb", "ext/fastfilereader/mapper.cpp", "ext/fastfilereader/mapper.h", "ext/fastfilereader/rubymain.cpp", "ext/files.cpp", "ext/files.h", "ext/kb.cpp", "ext/page.cpp", "ext/page.h", "ext/pipe.cpp", "ext/project.h", "ext/rubymain.cpp", "ext/sigs.cpp", "ext/sigs.h", "ext/ssl.cpp", "ext/ssl.h", "java/.classpath", "java/.project", "java/src/com/rubyeventmachine/Application.java", "java/src/com/rubyeventmachine/Connection.java", "java/src/com/rubyeventmachine/ConnectionFactory.java", "java/src/com/rubyeventmachine/DefaultConnectionFactory.java", "java/src/com/rubyeventmachine/EmReactor.java", "java/src/com/rubyeventmachine/EmReactorException.java", "java/src/com/rubyeventmachine/EventableChannel.java", "java/src/com/rubyeventmachine/EventableDatagramChannel.java", "java/src/com/rubyeventmachine/EventableSocketChannel.java", "java/src/com/rubyeventmachine/PeriodicTimer.java", "java/src/com/rubyeventmachine/Timer.java", "java/src/com/rubyeventmachine/tests/ApplicationTest.java", "java/src/com/rubyeventmachine/tests/ConnectTest.java", "java/src/com/rubyeventmachine/tests/EMTest.java", "java/src/com/rubyeventmachine/tests/TestDatagrams.java", "java/src/com/rubyeventmachine/tests/TestServers.java", "java/src/com/rubyeventmachine/tests/TestTimers.java", "lib/em/buftok.rb", "lib/em/callback.rb", "lib/em/channel.rb", "lib/em/connection.rb", "lib/em/deferrable.rb", "lib/em/file_watch.rb", "lib/em/future.rb", "lib/em/messages.rb", "lib/em/process_watch.rb", "lib/em/processes.rb", "lib/em/protocols.rb", "lib/em/protocols/header_and_content.rb", "lib/em/protocols/httpclient.rb", "lib/em/protocols/httpclient2.rb", "lib/em/protocols/line_and_text.rb", "lib/em/protocols/linetext2.rb", "lib/em/protocols/memcache.rb", "lib/em/protocols/object_protocol.rb", "lib/em/protocols/postgres3.rb", "lib/em/protocols/saslauth.rb", "lib/em/protocols/smtpclient.rb", "lib/em/protocols/smtpserver.rb", "lib/em/protocols/stomp.rb", "lib/em/protocols/tcptest.rb", "lib/em/queue.rb", "lib/em/spawnable.rb", "lib/em/streamer.rb", "lib/em/timers.rb", "lib/em/version.rb", "lib/eventmachine.rb", "lib/evma.rb", "lib/evma/callback.rb", "lib/evma/container.rb", "lib/evma/factory.rb", "lib/evma/protocol.rb", "lib/evma/reactor.rb", "lib/jeventmachine.rb", "lib/pr_eventmachine.rb", "setup.rb", "tasks/cpp.rake", "tasks/project.rake", "tasks/tests.rake", "tests/client.crt", "tests/client.key", "tests/test_attach.rb", "tests/test_basic.rb", "tests/test_channel.rb", "tests/test_connection_count.rb", "tests/test_defer.rb", "tests/test_epoll.rb", "tests/test_error_handler.rb", "tests/test_errors.rb", "tests/test_exc.rb", "tests/test_file_watch.rb", "tests/test_futures.rb", "tests/test_handler_check.rb", "tests/test_hc.rb", "tests/test_httpclient.rb", "tests/test_httpclient2.rb", "tests/test_inactivity_timeout.rb", "tests/test_kb.rb", "tests/test_ltp.rb", "tests/test_ltp2.rb", "tests/test_next_tick.rb", "tests/test_object_protocol.rb", "tests/test_process_watch.rb", "tests/test_processes.rb", "tests/test_proxy_connection.rb", "tests/test_pure.rb", "tests/test_queue.rb", "tests/test_running.rb", "tests/test_sasl.rb", "tests/test_send_file.rb", "tests/test_servers.rb", "tests/test_smtpclient.rb", "tests/test_smtpserver.rb", "tests/test_spawn.rb", "tests/test_ssl_args.rb", "tests/test_ssl_methods.rb", "tests/test_ssl_verify.rb", "tests/test_timers.rb", "tests/test_ud.rb", "tests/testem.rb", "web/whatis"]
23
+ s.files = [".gitignore", "README", "Rakefile", "docs/COPYING", "docs/ChangeLog", "docs/DEFERRABLES", "docs/EPOLL", "docs/GNU", "docs/INSTALL", "docs/KEYBOARD", "docs/LEGAL", "docs/LIGHTWEIGHT_CONCURRENCY", "docs/PURE_RUBY", "docs/RELEASE_NOTES", "docs/SMTP", "docs/SPAWNED_PROCESSES", "docs/TODO", "eventmachine.gemspec", "examples/ex_channel.rb", "examples/ex_queue.rb", "examples/helper.rb", "ext/binder.cpp", "ext/binder.h", "ext/cmain.cpp", "ext/cplusplus.cpp", "ext/ed.cpp", "ext/ed.h", "ext/em.cpp", "ext/em.h", "ext/emwin.cpp", "ext/emwin.h", "ext/epoll.cpp", "ext/epoll.h", "ext/eventmachine.h", "ext/eventmachine_cpp.h", "ext/extconf.rb", "ext/fastfilereader/extconf.rb", "ext/fastfilereader/mapper.cpp", "ext/fastfilereader/mapper.h", "ext/fastfilereader/rubymain.cpp", "ext/files.cpp", "ext/files.h", "ext/kb.cpp", "ext/page.cpp", "ext/page.h", "ext/pipe.cpp", "ext/project.h", "ext/rubymain.cpp", "ext/sigs.cpp", "ext/sigs.h", "ext/ssl.cpp", "ext/ssl.h", "java/.classpath", "java/.project", "java/src/com/rubyeventmachine/EmReactor.java", "java/src/com/rubyeventmachine/EmReactorException.java", "java/src/com/rubyeventmachine/EventableChannel.java", "java/src/com/rubyeventmachine/EventableDatagramChannel.java", "java/src/com/rubyeventmachine/EventableSocketChannel.java", "java/src/com/rubyeventmachine/application/Application.java", "java/src/com/rubyeventmachine/application/Connection.java", "java/src/com/rubyeventmachine/application/ConnectionFactory.java", "java/src/com/rubyeventmachine/application/DefaultConnectionFactory.java", "java/src/com/rubyeventmachine/application/PeriodicTimer.java", "java/src/com/rubyeventmachine/application/Timer.java", "java/src/com/rubyeventmachine/tests/ApplicationTest.java", "java/src/com/rubyeventmachine/tests/ConnectTest.java", "java/src/com/rubyeventmachine/tests/EMTest.java", "java/src/com/rubyeventmachine/tests/TestDatagrams.java", "java/src/com/rubyeventmachine/tests/TestServers.java", "java/src/com/rubyeventmachine/tests/TestTimers.java", "lib/em/buftok.rb", "lib/em/callback.rb", "lib/em/channel.rb", "lib/em/connection.rb", "lib/em/deferrable.rb", "lib/em/file_watch.rb", "lib/em/future.rb", "lib/em/messages.rb", "lib/em/process_watch.rb", "lib/em/processes.rb", "lib/em/protocols.rb", "lib/em/protocols/header_and_content.rb", "lib/em/protocols/httpclient.rb", "lib/em/protocols/httpclient2.rb", "lib/em/protocols/line_and_text.rb", "lib/em/protocols/linetext2.rb", "lib/em/protocols/memcache.rb", "lib/em/protocols/object_protocol.rb", "lib/em/protocols/postgres3.rb", "lib/em/protocols/saslauth.rb", "lib/em/protocols/smtpclient.rb", "lib/em/protocols/smtpserver.rb", "lib/em/protocols/socks4.rb", "lib/em/protocols/stomp.rb", "lib/em/protocols/tcptest.rb", "lib/em/queue.rb", "lib/em/spawnable.rb", "lib/em/streamer.rb", "lib/em/timers.rb", "lib/em/version.rb", "lib/eventmachine.rb", "lib/evma.rb", "lib/evma/callback.rb", "lib/evma/container.rb", "lib/evma/factory.rb", "lib/evma/protocol.rb", "lib/evma/reactor.rb", "lib/jeventmachine.rb", "lib/pr_eventmachine.rb", "setup.rb", "tasks/cpp.rake_example", "tests/client.crt", "tests/client.key", "tests/test_attach.rb", "tests/test_basic.rb", "tests/test_channel.rb", "tests/test_connection_count.rb", "tests/test_defer.rb", "tests/test_epoll.rb", "tests/test_error_handler.rb", "tests/test_errors.rb", "tests/test_exc.rb", "tests/test_file_watch.rb", "tests/test_futures.rb", "tests/test_get_sock_opt.rb", "tests/test_handler_check.rb", "tests/test_hc.rb", "tests/test_httpclient.rb", "tests/test_httpclient2.rb", "tests/test_inactivity_timeout.rb", "tests/test_kb.rb", "tests/test_ltp.rb", "tests/test_ltp2.rb", "tests/test_next_tick.rb", "tests/test_object_protocol.rb", "tests/test_pause.rb", "tests/test_pending_connect_timeout.rb", "tests/test_process_watch.rb", "tests/test_processes.rb", "tests/test_proxy_connection.rb", "tests/test_pure.rb", "tests/test_queue.rb", "tests/test_running.rb", "tests/test_sasl.rb", "tests/test_send_file.rb", "tests/test_servers.rb", "tests/test_smtpclient.rb", "tests/test_smtpserver.rb", "tests/test_spawn.rb", "tests/test_ssl_args.rb", "tests/test_ssl_methods.rb", "tests/test_ssl_verify.rb", "tests/test_timers.rb", "tests/test_ud.rb", "tests/testem.rb", "web/whatis"]
25
24
  s.homepage = %q{http://rubyeventmachine.com}
26
25
  s.rdoc_options = ["--title", "EventMachine", "--main", "README", "--line-numbers", "-x", "lib/em/version", "-x", "lib/emva", "-x", "lib/evma/", "-x", "lib/pr_eventmachine", "-x", "lib/jeventmachine"]
27
26
  s.require_paths = ["lib"]
28
27
  s.rubyforge_project = %q{eventmachine}
29
- s.rubygems_version = %q{1.3.3}
28
+ s.rubygems_version = %q{1.3.5}
30
29
  s.summary = %q{Ruby/EventMachine library}
31
30
 
32
31
  if s.respond_to? :specification_version then
@@ -22,13 +22,22 @@ See the file COPYING for complete licensing information.
22
22
  #define DEV_URANDOM "/dev/urandom"
23
23
 
24
24
 
25
- map<string, Bindable_t*> Bindable_t::BindingBag;
25
+ map<unsigned long, Bindable_t*> Bindable_t::BindingBag;
26
26
 
27
27
 
28
28
  /********************************
29
29
  STATIC Bindable_t::CreateBinding
30
30
  ********************************/
31
31
 
32
+ unsigned long Bindable_t::CreateBinding()
33
+ {
34
+ // XXX use atomic_t to prevent thread-safety issues
35
+ static unsigned long num = 0;
36
+ while(BindingBag[++num]);
37
+ return num;
38
+ }
39
+
40
+ #if 0
32
41
  string Bindable_t::CreateBinding()
33
42
  {
34
43
  static int index = 0;
@@ -76,25 +85,15 @@ string Bindable_t::CreateBinding()
76
85
  ss << seed << (++index);
77
86
  return ss.str();
78
87
  }
79
-
80
-
81
- /*****************************
82
- STATIC: Bindable_t::GetObject
83
- *****************************/
84
-
85
- Bindable_t *Bindable_t::GetObject (const char *binding)
86
- {
87
- string s (binding ? binding : "");
88
- return GetObject (s);
89
- }
88
+ #endif
90
89
 
91
90
  /*****************************
92
91
  STATIC: Bindable_t::GetObject
93
92
  *****************************/
94
93
 
95
- Bindable_t *Bindable_t::GetObject (const string &binding)
94
+ Bindable_t *Bindable_t::GetObject (const unsigned long binding)
96
95
  {
97
- map<string, Bindable_t*>::const_iterator i = BindingBag.find (binding);
96
+ map<unsigned long, Bindable_t*>::const_iterator i = BindingBag.find (binding);
98
97
  if (i != BindingBag.end())
99
98
  return i->second;
100
99
  else
@@ -24,20 +24,18 @@ See the file COPYING for complete licensing information.
24
24
  class Bindable_t
25
25
  {
26
26
  public:
27
- static string CreateBinding();
28
- static Bindable_t *GetObject (const string&);
29
- static Bindable_t *GetObject (const char*);
30
- static map<string, Bindable_t*> BindingBag;
27
+ static unsigned long CreateBinding();
28
+ static Bindable_t *GetObject (const unsigned long);
29
+ static map<unsigned long, Bindable_t*> BindingBag;
31
30
 
32
31
  public:
33
32
  Bindable_t();
34
33
  virtual ~Bindable_t();
35
34
 
36
- const string &GetBinding() {return Binding;}
37
- const char *GetBindingChars() {return Binding.c_str();}
35
+ const unsigned long GetBinding() {return Binding;}
38
36
 
39
37
  private:
40
- string Binding;
38
+ unsigned long Binding;
41
39
  };
42
40
 
43
41
 
@@ -19,6 +19,13 @@ See the file COPYING for complete licensing information.
19
19
 
20
20
  #include "project.h"
21
21
 
22
+ /* 21Sep09: ruby 1.9 defines macros for common i/o functions that point to rb_w32_* implementations.
23
+ We need to undef the stat to fix a build failure in evma_send_file_data_to_connection.
24
+ See http://groups.google.com/group/eventmachine/browse_thread/thread/fc60d9bb738ffc71
25
+ */
26
+ #if defined(BUILD_FOR_RUBY) && defined(OS_WIN32)
27
+ #undef stat
28
+ #endif
22
29
 
23
30
  static EventMachine_t *EventMachine;
24
31
  static int bUseEpoll = 0;
@@ -31,7 +38,7 @@ extern "C" void ensure_eventmachine (const char *caller = "unknown caller")
31
38
  char err_string[err_size];
32
39
  snprintf (err_string, err_size, "eventmachine not initialized: %s", caller);
33
40
  #ifdef BUILD_FOR_RUBY
34
- rb_raise(rb_eRuntimeError, err_string);
41
+ rb_raise(rb_eRuntimeError, "%s", err_string);
35
42
  #else
36
43
  throw std::runtime_error (err_string);
37
44
  #endif
@@ -42,7 +49,7 @@ extern "C" void ensure_eventmachine (const char *caller = "unknown caller")
42
49
  evma_initialize_library
43
50
  ***********************/
44
51
 
45
- extern "C" void evma_initialize_library (void(*cb)(const char*, int, const char*, int))
52
+ extern "C" void evma_initialize_library (void(*cb)(const unsigned long, int, const char*, const unsigned long))
46
53
  {
47
54
  // Probably a bad idea to mess with the signal mask of a process
48
55
  // we're just being linked into.
@@ -88,7 +95,7 @@ extern "C" void evma_run_machine()
88
95
  evma_install_oneshot_timer
89
96
  **************************/
90
97
 
91
- extern "C" const char *evma_install_oneshot_timer (int seconds)
98
+ extern "C" const unsigned long evma_install_oneshot_timer (int seconds)
92
99
  {
93
100
  ensure_eventmachine("evma_install_oneshot_timer");
94
101
  return EventMachine->InstallOneshotTimer (seconds);
@@ -99,7 +106,7 @@ extern "C" const char *evma_install_oneshot_timer (int seconds)
99
106
  evma_connect_to_server
100
107
  **********************/
101
108
 
102
- extern "C" const char *evma_connect_to_server (const char *bind_addr, int bind_port, const char *server, int port)
109
+ extern "C" const unsigned long evma_connect_to_server (const char *bind_addr, int bind_port, const char *server, int port)
103
110
  {
104
111
  ensure_eventmachine("evma_connect_to_server");
105
112
  return EventMachine->ConnectToServer (bind_addr, bind_port, server, port);
@@ -109,7 +116,7 @@ extern "C" const char *evma_connect_to_server (const char *bind_addr, int bind_p
109
116
  evma_connect_to_unix_server
110
117
  ***************************/
111
118
 
112
- extern "C" const char *evma_connect_to_unix_server (const char *server)
119
+ extern "C" const unsigned long evma_connect_to_unix_server (const char *server)
113
120
  {
114
121
  ensure_eventmachine("evma_connect_to_unix_server");
115
122
  return EventMachine->ConnectToUnixServer (server);
@@ -119,19 +126,19 @@ extern "C" const char *evma_connect_to_unix_server (const char *server)
119
126
  evma_attach_fd
120
127
  **************/
121
128
 
122
- extern "C" const char *evma_attach_fd (int file_descriptor, int notify_readable, int notify_writable)
129
+ extern "C" const unsigned long evma_attach_fd (int file_descriptor, int watch_mode)
123
130
  {
124
131
  ensure_eventmachine("evma_attach_fd");
125
- return EventMachine->AttachFD (file_descriptor, (notify_readable ? true : false), (notify_writable ? true : false));
132
+ return EventMachine->AttachFD (file_descriptor, watch_mode ? true : false);
126
133
  }
127
134
 
128
135
  /**************
129
136
  evma_detach_fd
130
137
  **************/
131
138
 
132
- extern "C" int evma_detach_fd (const char *binding)
139
+ extern "C" int evma_detach_fd (const unsigned long binding)
133
140
  {
134
- ensure_eventmachine("evma_dettach_fd");
141
+ ensure_eventmachine("evma_detach_fd");
135
142
  EventableDescriptor *ed = dynamic_cast <EventableDescriptor*> (Bindable_t::GetObject (binding));
136
143
  if (ed)
137
144
  return EventMachine->DetachFD (ed);
@@ -143,11 +150,114 @@ extern "C" int evma_detach_fd (const char *binding)
143
150
  #endif
144
151
  }
145
152
 
153
+ /************************
154
+ evma_get_file_descriptor
155
+ ************************/
156
+
157
+ extern "C" int evma_get_file_descriptor (const unsigned long binding)
158
+ {
159
+ ensure_eventmachine("evma_get_file_descriptor");
160
+ EventableDescriptor *ed = dynamic_cast <EventableDescriptor*> (Bindable_t::GetObject (binding));
161
+ if (ed)
162
+ return ed->GetSocket();
163
+ else
164
+ #ifdef BUILD_FOR_RUBY
165
+ rb_raise(rb_eRuntimeError, "invalid binding to get_fd");
166
+ #else
167
+ throw std::runtime_error ("invalid binding to get_fd");
168
+ #endif
169
+ }
170
+
171
+ /***********************
172
+ evma_is_notify_readable
173
+ ***********************/
174
+
175
+ extern "C" int evma_is_notify_readable (const unsigned long binding)
176
+ {
177
+ ConnectionDescriptor *cd = dynamic_cast <ConnectionDescriptor*> (Bindable_t::GetObject (binding));
178
+ if (cd)
179
+ return cd->IsNotifyReadable() ? 1 : 0;
180
+ return -1;
181
+ }
182
+
183
+ /************************
184
+ evma_set_notify_readable
185
+ ************************/
186
+
187
+ extern "C" void evma_set_notify_readable (const unsigned long binding, int mode)
188
+ {
189
+ ConnectionDescriptor *cd = dynamic_cast <ConnectionDescriptor*> (Bindable_t::GetObject (binding));
190
+ if (cd)
191
+ cd->SetNotifyReadable (mode ? true : false);
192
+ }
193
+
194
+ /***********************
195
+ evma_is_notify_writable
196
+ ***********************/
197
+
198
+ extern "C" int evma_is_notify_writable (const unsigned long binding)
199
+ {
200
+ ConnectionDescriptor *cd = dynamic_cast <ConnectionDescriptor*> (Bindable_t::GetObject (binding));
201
+ if (cd)
202
+ return cd->IsNotifyWritable() ? 1 : 0;
203
+ return -1;
204
+ }
205
+
206
+ /************************
207
+ evma_set_notify_writable
208
+ ************************/
209
+
210
+ extern "C" void evma_set_notify_writable (const unsigned long binding, int mode)
211
+ {
212
+ ConnectionDescriptor *cd = dynamic_cast <ConnectionDescriptor*> (Bindable_t::GetObject (binding));
213
+ if (cd)
214
+ cd->SetNotifyWritable (mode ? true : false);
215
+ }
216
+
217
+ /**********
218
+ evma_pause
219
+ **********/
220
+
221
+ extern "C" int evma_pause (const unsigned long binding)
222
+ {
223
+ ConnectionDescriptor *cd = dynamic_cast <ConnectionDescriptor*> (Bindable_t::GetObject (binding));
224
+ if (cd)
225
+ return cd->Pause() ? 1 : 0;
226
+
227
+ return 0;
228
+ }
229
+
230
+ /***********
231
+ evma_resume
232
+ ***********/
233
+
234
+ extern "C" int evma_resume (const unsigned long binding)
235
+ {
236
+ ConnectionDescriptor *cd = dynamic_cast <ConnectionDescriptor*> (Bindable_t::GetObject (binding));
237
+ if (cd)
238
+ return cd->Resume() ? 1 : 0;
239
+
240
+ return 0;
241
+ }
242
+
243
+ /**************
244
+ evma_is_paused
245
+ **************/
246
+
247
+ extern "C" int evma_is_paused (const unsigned long binding)
248
+ {
249
+ ConnectionDescriptor *cd = dynamic_cast <ConnectionDescriptor*> (Bindable_t::GetObject (binding));
250
+ if (cd)
251
+ return cd->IsPaused() ? 1 : 0;
252
+
253
+ return 0;
254
+ }
255
+
146
256
  /**********************
147
257
  evma_create_tcp_server
148
258
  **********************/
149
259
 
150
- extern "C" const char *evma_create_tcp_server (const char *address, int port)
260
+ extern "C" const unsigned long evma_create_tcp_server (const char *address, int port)
151
261
  {
152
262
  ensure_eventmachine("evma_create_tcp_server");
153
263
  return EventMachine->CreateTcpServer (address, port);
@@ -157,7 +267,7 @@ extern "C" const char *evma_create_tcp_server (const char *address, int port)
157
267
  evma_create_unix_domain_server
158
268
  ******************************/
159
269
 
160
- extern "C" const char *evma_create_unix_domain_server (const char *filename)
270
+ extern "C" const unsigned long evma_create_unix_domain_server (const char *filename)
161
271
  {
162
272
  ensure_eventmachine("evma_create_unix_domain_server");
163
273
  return EventMachine->CreateUnixDomainServer (filename);
@@ -167,7 +277,7 @@ extern "C" const char *evma_create_unix_domain_server (const char *filename)
167
277
  evma_open_datagram_socket
168
278
  *************************/
169
279
 
170
- extern "C" const char *evma_open_datagram_socket (const char *address, int port)
280
+ extern "C" const unsigned long evma_open_datagram_socket (const char *address, int port)
171
281
  {
172
282
  ensure_eventmachine("evma_open_datagram_socket");
173
283
  return EventMachine->OpenDatagramSocket (address, port);
@@ -177,7 +287,7 @@ extern "C" const char *evma_open_datagram_socket (const char *address, int port)
177
287
  evma_open_keyboard
178
288
  ******************/
179
289
 
180
- extern "C" const char *evma_open_keyboard()
290
+ extern "C" const unsigned long evma_open_keyboard()
181
291
  {
182
292
  ensure_eventmachine("evma_open_keyboard");
183
293
  return EventMachine->OpenKeyboard();
@@ -187,7 +297,7 @@ extern "C" const char *evma_open_keyboard()
187
297
  evma_watch_filename
188
298
  *******************/
189
299
 
190
- extern "C" const char *evma_watch_filename (const char *fname)
300
+ extern "C" const unsigned long evma_watch_filename (const char *fname)
191
301
  {
192
302
  ensure_eventmachine("evma_watch_filename");
193
303
  return EventMachine->WatchFile(fname);
@@ -197,7 +307,7 @@ extern "C" const char *evma_watch_filename (const char *fname)
197
307
  evma_unwatch_filename
198
308
  *********************/
199
309
 
200
- extern "C" void evma_unwatch_filename (const char *sig)
310
+ extern "C" void evma_unwatch_filename (const unsigned long sig)
201
311
  {
202
312
  ensure_eventmachine("evma_unwatch_file");
203
313
  EventMachine->UnwatchFile(sig);
@@ -207,7 +317,7 @@ extern "C" void evma_unwatch_filename (const char *sig)
207
317
  evma_watch_pid
208
318
  **************/
209
319
 
210
- extern "C" const char *evma_watch_pid (int pid)
320
+ extern "C" const unsigned long evma_watch_pid (int pid)
211
321
  {
212
322
  ensure_eventmachine("evma_watch_pid");
213
323
  return EventMachine->WatchPid(pid);
@@ -217,7 +327,7 @@ extern "C" const char *evma_watch_pid (int pid)
217
327
  evma_unwatch_pid
218
328
  ****************/
219
329
 
220
- extern "C" void evma_unwatch_pid (const char *sig)
330
+ extern "C" void evma_unwatch_pid (const unsigned long sig)
221
331
  {
222
332
  ensure_eventmachine("evma_unwatch_pid");
223
333
  EventMachine->UnwatchPid(sig);
@@ -227,7 +337,7 @@ extern "C" void evma_unwatch_pid (const char *sig)
227
337
  evma_send_data_to_connection
228
338
  ****************************/
229
339
 
230
- extern "C" int evma_send_data_to_connection (const char *binding, const char *data, int data_length)
340
+ extern "C" int evma_send_data_to_connection (const unsigned long binding, const char *data, int data_length)
231
341
  {
232
342
  ensure_eventmachine("evma_send_data_to_connection");
233
343
  return ConnectionDescriptor::SendDataToConnection (binding, data, data_length);
@@ -237,7 +347,7 @@ extern "C" int evma_send_data_to_connection (const char *binding, const char *da
237
347
  evma_send_datagram
238
348
  ******************/
239
349
 
240
- extern "C" int evma_send_datagram (const char *binding, const char *data, int data_length, const char *address, int port)
350
+ extern "C" int evma_send_datagram (const unsigned long binding, const char *data, int data_length, const char *address, int port)
241
351
  {
242
352
  ensure_eventmachine("evma_send_datagram");
243
353
  return DatagramDescriptor::SendDatagram (binding, data, data_length, address, port);
@@ -248,7 +358,7 @@ extern "C" int evma_send_datagram (const char *binding, const char *data, int da
248
358
  evma_close_connection
249
359
  *********************/
250
360
 
251
- extern "C" void evma_close_connection (const char *binding, int after_writing)
361
+ extern "C" void evma_close_connection (const unsigned long binding, int after_writing)
252
362
  {
253
363
  ensure_eventmachine("evma_close_connection");
254
364
  ConnectionDescriptor::CloseConnection (binding, (after_writing ? true : false));
@@ -258,7 +368,7 @@ extern "C" void evma_close_connection (const char *binding, int after_writing)
258
368
  evma_report_connection_error_status
259
369
  ***********************************/
260
370
 
261
- extern "C" int evma_report_connection_error_status (const char *binding)
371
+ extern "C" int evma_report_connection_error_status (const unsigned long binding)
262
372
  {
263
373
  ensure_eventmachine("evma_report_connection_error_status");
264
374
  return ConnectionDescriptor::ReportErrorStatus (binding);
@@ -268,7 +378,7 @@ extern "C" int evma_report_connection_error_status (const char *binding)
268
378
  evma_stop_tcp_server
269
379
  ********************/
270
380
 
271
- extern "C" void evma_stop_tcp_server (const char *binding)
381
+ extern "C" void evma_stop_tcp_server (const unsigned long binding)
272
382
  {
273
383
  ensure_eventmachine("evma_stop_tcp_server");
274
384
  AcceptorDescriptor::StopAcceptor (binding);
@@ -290,7 +400,7 @@ extern "C" void evma_stop_machine()
290
400
  evma_start_tls
291
401
  **************/
292
402
 
293
- extern "C" void evma_start_tls (const char *binding)
403
+ extern "C" void evma_start_tls (const unsigned long binding)
294
404
  {
295
405
  ensure_eventmachine("evma_start_tls");
296
406
  EventableDescriptor *ed = dynamic_cast <EventableDescriptor*> (Bindable_t::GetObject (binding));
@@ -302,7 +412,7 @@ extern "C" void evma_start_tls (const char *binding)
302
412
  evma_set_tls_parms
303
413
  ******************/
304
414
 
305
- extern "C" void evma_set_tls_parms (const char *binding, const char *privatekey_filename, const char *certchain_filename, int verify_peer)
415
+ extern "C" void evma_set_tls_parms (const unsigned long binding, const char *privatekey_filename, const char *certchain_filename, int verify_peer)
306
416
  {
307
417
  ensure_eventmachine("evma_set_tls_parms");
308
418
  EventableDescriptor *ed = dynamic_cast <EventableDescriptor*> (Bindable_t::GetObject (binding));
@@ -315,7 +425,7 @@ evma_get_peer_cert
315
425
  ******************/
316
426
 
317
427
  #ifdef WITH_SSL
318
- extern "C" X509 *evma_get_peer_cert (const char *binding)
428
+ extern "C" X509 *evma_get_peer_cert (const unsigned long binding)
319
429
  {
320
430
  ensure_eventmachine("evma_get_peer_cert");
321
431
  EventableDescriptor *ed = dynamic_cast <EventableDescriptor*> (Bindable_t::GetObject (binding));
@@ -330,7 +440,7 @@ evma_accept_ssl_peer
330
440
  ********************/
331
441
 
332
442
  #ifdef WITH_SSL
333
- extern "C" void evma_accept_ssl_peer (const char *binding)
443
+ extern "C" void evma_accept_ssl_peer (const unsigned long binding)
334
444
  {
335
445
  ensure_eventmachine("evma_accept_ssl_peer");
336
446
  ConnectionDescriptor *cd = dynamic_cast <ConnectionDescriptor*> (Bindable_t::GetObject (binding));
@@ -343,7 +453,7 @@ extern "C" void evma_accept_ssl_peer (const char *binding)
343
453
  evma_get_peername
344
454
  *****************/
345
455
 
346
- extern "C" int evma_get_peername (const char *binding, struct sockaddr *sa)
456
+ extern "C" int evma_get_peername (const unsigned long binding, struct sockaddr *sa)
347
457
  {
348
458
  ensure_eventmachine("evma_get_peername");
349
459
  EventableDescriptor *ed = dynamic_cast <EventableDescriptor*> (Bindable_t::GetObject (binding));
@@ -358,7 +468,7 @@ extern "C" int evma_get_peername (const char *binding, struct sockaddr *sa)
358
468
  evma_get_sockname
359
469
  *****************/
360
470
 
361
- extern "C" int evma_get_sockname (const char *binding, struct sockaddr *sa)
471
+ extern "C" int evma_get_sockname (const unsigned long binding, struct sockaddr *sa)
362
472
  {
363
473
  ensure_eventmachine("evma_get_sockname");
364
474
  EventableDescriptor *ed = dynamic_cast <EventableDescriptor*> (Bindable_t::GetObject (binding));
@@ -373,7 +483,7 @@ extern "C" int evma_get_sockname (const char *binding, struct sockaddr *sa)
373
483
  evma_get_subprocess_pid
374
484
  ***********************/
375
485
 
376
- extern "C" int evma_get_subprocess_pid (const char *binding, pid_t *pid)
486
+ extern "C" int evma_get_subprocess_pid (const unsigned long binding, pid_t *pid)
377
487
  {
378
488
  ensure_eventmachine("evma_get_subprocess_pid");
379
489
  #ifdef OS_UNIX
@@ -396,7 +506,7 @@ extern "C" int evma_get_subprocess_pid (const char *binding, pid_t *pid)
396
506
  evma_get_subprocess_status
397
507
  **************************/
398
508
 
399
- extern "C" int evma_get_subprocess_status (const char *binding, int *status)
509
+ extern "C" int evma_get_subprocess_status (const unsigned long binding, int *status)
400
510
  {
401
511
  ensure_eventmachine("evma_get_subprocess_status");
402
512
  if (status) {
@@ -433,7 +543,7 @@ extern "C" void evma_signal_loopbreak()
433
543
  evma__write_file
434
544
  ****************/
435
545
 
436
- extern "C" const char *evma__write_file (const char *filename)
546
+ extern "C" const unsigned long evma__write_file (const char *filename)
437
547
  {
438
548
  ensure_eventmachine("evma__write_file");
439
549
  return EventMachine->_OpenFileForWriting (filename);
@@ -444,7 +554,7 @@ extern "C" const char *evma__write_file (const char *filename)
444
554
  evma_get_comm_inactivity_timeout
445
555
  ********************************/
446
556
 
447
- extern "C" float evma_get_comm_inactivity_timeout (const char *binding)
557
+ extern "C" float evma_get_comm_inactivity_timeout (const unsigned long binding)
448
558
  {
449
559
  ensure_eventmachine("evma_get_comm_inactivity_timeout");
450
560
  EventableDescriptor *ed = dynamic_cast <EventableDescriptor*> (Bindable_t::GetObject (binding));
@@ -459,7 +569,7 @@ extern "C" float evma_get_comm_inactivity_timeout (const char *binding)
459
569
  evma_set_comm_inactivity_timeout
460
570
  ********************************/
461
571
 
462
- extern "C" int evma_set_comm_inactivity_timeout (const char *binding, float value)
572
+ extern "C" int evma_set_comm_inactivity_timeout (const unsigned long binding, float value)
463
573
  {
464
574
  ensure_eventmachine("evma_set_comm_inactivity_timeout");
465
575
  EventableDescriptor *ed = dynamic_cast <EventableDescriptor*> (Bindable_t::GetObject (binding));
@@ -471,6 +581,38 @@ extern "C" int evma_set_comm_inactivity_timeout (const char *binding, float valu
471
581
  }
472
582
 
473
583
 
584
+ /********************************
585
+ evma_get_pending_connect_timeout
586
+ ********************************/
587
+
588
+ extern "C" float evma_get_pending_connect_timeout (const unsigned long binding)
589
+ {
590
+ ensure_eventmachine("evma_get_pending_connect_timeout");
591
+ EventableDescriptor *ed = dynamic_cast <EventableDescriptor*> (Bindable_t::GetObject (binding));
592
+ if (ed) {
593
+ return ed->GetPendingConnectTimeout();
594
+ }
595
+ else
596
+ return 0.0;
597
+ }
598
+
599
+
600
+ /********************************
601
+ evma_set_pending_connect_timeout
602
+ ********************************/
603
+
604
+ extern "C" int evma_set_pending_connect_timeout (const unsigned long binding, float value)
605
+ {
606
+ ensure_eventmachine("evma_set_pending_connect_timeout");
607
+ EventableDescriptor *ed = dynamic_cast <EventableDescriptor*> (Bindable_t::GetObject (binding));
608
+ if (ed) {
609
+ return ed->SetPendingConnectTimeout (value);
610
+ }
611
+ else
612
+ return 0;
613
+ }
614
+
615
+
474
616
  /**********************
475
617
  evma_set_timer_quantum
476
618
  **********************/
@@ -524,7 +666,7 @@ extern "C" void evma_setuid_string (const char *username)
524
666
  evma_popen
525
667
  **********/
526
668
 
527
- extern "C" const char *evma_popen (char * const*cmd_strings)
669
+ extern "C" const unsigned long evma_popen (char * const*cmd_strings)
528
670
  {
529
671
  ensure_eventmachine("evma_popen");
530
672
  return EventMachine->Socketpair (cmd_strings);
@@ -535,7 +677,7 @@ extern "C" const char *evma_popen (char * const*cmd_strings)
535
677
  evma_get_outbound_data_size
536
678
  ***************************/
537
679
 
538
- extern "C" int evma_get_outbound_data_size (const char *binding)
680
+ extern "C" int evma_get_outbound_data_size (const unsigned long binding)
539
681
  {
540
682
  ensure_eventmachine("evma_get_outbound_data_size");
541
683
  EventableDescriptor *ed = dynamic_cast <EventableDescriptor*> (Bindable_t::GetObject (binding));
@@ -576,7 +718,7 @@ extern "C" int evma_set_rlimit_nofile (int nofiles)
576
718
  evma_send_file_data_to_connection
577
719
  *********************************/
578
720
 
579
- extern "C" int evma_send_file_data_to_connection (const char *binding, const char *filename)
721
+ extern "C" int evma_send_file_data_to_connection (const unsigned long binding, const char *filename)
580
722
  {
581
723
  /* This is a sugaring over send_data_to_connection that reads a file into a
582
724
  * locally-allocated buffer, and sends the file data to the remote peer.
@@ -592,7 +734,7 @@ extern "C" int evma_send_file_data_to_connection (const char *binding, const cha
592
734
  * Modified 25Jul07. This now returns -1 on file-too-large; 0 for success, and a positive
593
735
  * errno in case of other errors.
594
736
  *
595
- /* Contributed by Kirk Haines.
737
+ * Contributed by Kirk Haines.
596
738
  */
597
739
 
598
740
  char data[32*1024];
@@ -613,12 +755,12 @@ extern "C" int evma_send_file_data_to_connection (const char *binding, const cha
613
755
  return e;
614
756
  }
615
757
 
616
- int filesize = st.st_size;
758
+ off_t filesize = st.st_size;
617
759
  if (filesize <= 0) {
618
760
  close (Fd);
619
761
  return 0;
620
762
  }
621
- else if (filesize > sizeof(data)) {
763
+ else if (filesize > (off_t) sizeof(data)) {
622
764
  close (Fd);
623
765
  return -1;
624
766
  }
@@ -641,12 +783,12 @@ extern "C" int evma_send_file_data_to_connection (const char *binding, const cha
641
783
  evma_start_proxy
642
784
  *****************/
643
785
 
644
- extern "C" void evma_start_proxy (const char *from, const char *to)
786
+ extern "C" void evma_start_proxy (const unsigned long from, const unsigned long to, const unsigned long bufsize)
645
787
  {
646
788
  ensure_eventmachine("evma_start_proxy");
647
789
  EventableDescriptor *ed = dynamic_cast <EventableDescriptor*> (Bindable_t::GetObject (from));
648
790
  if (ed)
649
- ed->StartProxy(to);
791
+ ed->StartProxy(to, bufsize);
650
792
  }
651
793
 
652
794
 
@@ -654,7 +796,7 @@ extern "C" void evma_start_proxy (const char *from, const char *to)
654
796
  evma_stop_proxy
655
797
  ****************/
656
798
 
657
- extern "C" void evma_stop_proxy (const char *from)
799
+ extern "C" void evma_stop_proxy (const unsigned long from)
658
800
  {
659
801
  ensure_eventmachine("evma_stop_proxy");
660
802
  EventableDescriptor *ed = dynamic_cast <EventableDescriptor*> (Bindable_t::GetObject (from));