eventmachine 0.12.8-x86-mswin32-60 → 0.12.10-x86-mswin32-60
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +14 -13
- data/Rakefile +374 -264
- data/eventmachine.gemspec +4 -5
- data/ext/binder.cpp +125 -126
- data/ext/binder.h +46 -48
- data/ext/cmain.cpp +184 -42
- data/ext/cplusplus.cpp +202 -202
- data/ext/ed.cpp +242 -81
- data/ext/ed.h +39 -22
- data/ext/em.cpp +127 -108
- data/ext/em.h +27 -18
- data/ext/emwin.cpp +3 -3
- data/ext/eventmachine.h +49 -38
- data/ext/eventmachine_cpp.h +96 -96
- data/ext/extconf.rb +147 -132
- data/ext/fastfilereader/extconf.rb +82 -76
- data/ext/project.h +151 -140
- data/ext/rubymain.cpp +222 -103
- data/ext/ssl.cpp +460 -460
- data/ext/ssl.h +94 -94
- data/java/src/com/rubyeventmachine/EmReactor.java +570 -423
- data/java/src/com/rubyeventmachine/EventableChannel.java +69 -57
- data/java/src/com/rubyeventmachine/EventableDatagramChannel.java +189 -171
- data/java/src/com/rubyeventmachine/EventableSocketChannel.java +364 -244
- data/java/src/com/rubyeventmachine/{Application.java → application/Application.java} +194 -200
- data/java/src/com/rubyeventmachine/{Connection.java → application/Connection.java} +74 -74
- data/java/src/com/rubyeventmachine/{ConnectionFactory.java → application/ConnectionFactory.java} +36 -36
- data/java/src/com/rubyeventmachine/{DefaultConnectionFactory.java → application/DefaultConnectionFactory.java} +46 -46
- data/java/src/com/rubyeventmachine/{PeriodicTimer.java → application/PeriodicTimer.java} +38 -38
- data/java/src/com/rubyeventmachine/{Timer.java → application/Timer.java} +54 -54
- data/java/src/com/rubyeventmachine/tests/ApplicationTest.java +109 -108
- data/java/src/com/rubyeventmachine/tests/ConnectTest.java +148 -146
- data/java/src/com/rubyeventmachine/tests/TestDatagrams.java +53 -53
- data/java/src/com/rubyeventmachine/tests/TestServers.java +75 -74
- data/java/src/com/rubyeventmachine/tests/TestTimers.java +90 -89
- data/lib/em/connection.rb +71 -12
- data/lib/em/deferrable.rb +191 -186
- data/lib/em/protocols.rb +36 -35
- data/lib/em/protocols/httpclient2.rb +590 -582
- data/lib/em/protocols/line_and_text.rb +125 -126
- data/lib/em/protocols/linetext2.rb +161 -160
- data/lib/em/protocols/object_protocol.rb +45 -39
- data/lib/em/protocols/smtpclient.rb +357 -331
- data/lib/em/protocols/socks4.rb +66 -0
- data/lib/em/queue.rb +60 -60
- data/lib/em/timers.rb +56 -55
- data/lib/em/version.rb +1 -1
- data/lib/eventmachine.rb +125 -169
- data/lib/jeventmachine.rb +257 -142
- data/tasks/{cpp.rake → cpp.rake_example} +76 -76
- data/tests/test_attach.rb +125 -100
- data/tests/test_basic.rb +1 -2
- data/tests/test_connection_count.rb +34 -44
- data/tests/test_epoll.rb +0 -2
- data/tests/test_get_sock_opt.rb +30 -0
- data/tests/test_httpclient2.rb +3 -3
- data/tests/test_inactivity_timeout.rb +21 -1
- data/tests/test_ltp.rb +182 -188
- data/tests/test_next_tick.rb +0 -2
- data/tests/test_pause.rb +70 -0
- data/tests/test_pending_connect_timeout.rb +48 -0
- data/tests/test_ssl_args.rb +78 -67
- data/tests/test_timers.rb +162 -141
- metadata +13 -11
- data/tasks/project.rake +0 -79
- data/tasks/tests.rake +0 -193
data/eventmachine.gemspec
CHANGED
@@ -2,11 +2,11 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{eventmachine}
|
5
|
-
s.version = "0.12.
|
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-
|
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.
|
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.
|
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
|
data/ext/binder.cpp
CHANGED
@@ -1,126 +1,125 @@
|
|
1
|
-
/*****************************************************************************
|
2
|
-
|
3
|
-
$Id$
|
4
|
-
|
5
|
-
File: binder.cpp
|
6
|
-
Date: 07Apr06
|
7
|
-
|
8
|
-
Copyright (C) 2006-07 by Francis Cianfrocca. All Rights Reserved.
|
9
|
-
Gmail: blackhedd
|
10
|
-
|
11
|
-
This program is free software; you can redistribute it and/or modify
|
12
|
-
it under the terms of either: 1) the GNU General Public License
|
13
|
-
as published by the Free Software Foundation; either version 2 of the
|
14
|
-
License, or (at your option) any later version; or 2) Ruby's License.
|
15
|
-
|
16
|
-
See the file COPYING for complete licensing information.
|
17
|
-
|
18
|
-
*****************************************************************************/
|
19
|
-
|
20
|
-
#include "project.h"
|
21
|
-
|
22
|
-
#define DEV_URANDOM "/dev/urandom"
|
23
|
-
|
24
|
-
|
25
|
-
map<
|
26
|
-
|
27
|
-
|
28
|
-
/********************************
|
29
|
-
STATIC Bindable_t::CreateBinding
|
30
|
-
********************************/
|
31
|
-
|
32
|
-
|
33
|
-
{
|
34
|
-
|
35
|
-
static
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
Binding =
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
1
|
+
/*****************************************************************************
|
2
|
+
|
3
|
+
$Id$
|
4
|
+
|
5
|
+
File: binder.cpp
|
6
|
+
Date: 07Apr06
|
7
|
+
|
8
|
+
Copyright (C) 2006-07 by Francis Cianfrocca. All Rights Reserved.
|
9
|
+
Gmail: blackhedd
|
10
|
+
|
11
|
+
This program is free software; you can redistribute it and/or modify
|
12
|
+
it under the terms of either: 1) the GNU General Public License
|
13
|
+
as published by the Free Software Foundation; either version 2 of the
|
14
|
+
License, or (at your option) any later version; or 2) Ruby's License.
|
15
|
+
|
16
|
+
See the file COPYING for complete licensing information.
|
17
|
+
|
18
|
+
*****************************************************************************/
|
19
|
+
|
20
|
+
#include "project.h"
|
21
|
+
|
22
|
+
#define DEV_URANDOM "/dev/urandom"
|
23
|
+
|
24
|
+
|
25
|
+
map<unsigned long, Bindable_t*> Bindable_t::BindingBag;
|
26
|
+
|
27
|
+
|
28
|
+
/********************************
|
29
|
+
STATIC Bindable_t::CreateBinding
|
30
|
+
********************************/
|
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
|
41
|
+
string Bindable_t::CreateBinding()
|
42
|
+
{
|
43
|
+
static int index = 0;
|
44
|
+
static string seed;
|
45
|
+
|
46
|
+
if ((index >= 1000000) || (seed.length() == 0)) {
|
47
|
+
#ifdef OS_UNIX
|
48
|
+
int fd = open (DEV_URANDOM, O_RDONLY);
|
49
|
+
if (fd < 0)
|
50
|
+
throw std::runtime_error ("No entropy device");
|
51
|
+
|
52
|
+
unsigned char u[16];
|
53
|
+
size_t r = read (fd, u, sizeof(u));
|
54
|
+
if (r < sizeof(u))
|
55
|
+
throw std::runtime_error ("Unable to read entropy device");
|
56
|
+
|
57
|
+
unsigned char *u1 = (unsigned char*)u;
|
58
|
+
char u2 [sizeof(u) * 2 + 1];
|
59
|
+
|
60
|
+
for (size_t i=0; i < sizeof(u); i++)
|
61
|
+
sprintf (u2 + (i * 2), "%02x", u1[i]);
|
62
|
+
|
63
|
+
seed = string (u2);
|
64
|
+
#endif
|
65
|
+
|
66
|
+
|
67
|
+
#ifdef OS_WIN32
|
68
|
+
UUID uuid;
|
69
|
+
UuidCreate (&uuid);
|
70
|
+
unsigned char *uuidstring = NULL;
|
71
|
+
UuidToString (&uuid, &uuidstring);
|
72
|
+
if (!uuidstring)
|
73
|
+
throw std::runtime_error ("Unable to read uuid");
|
74
|
+
seed = string ((const char*)uuidstring);
|
75
|
+
|
76
|
+
RpcStringFree (&uuidstring);
|
77
|
+
#endif
|
78
|
+
|
79
|
+
index = 0;
|
80
|
+
|
81
|
+
|
82
|
+
}
|
83
|
+
|
84
|
+
stringstream ss;
|
85
|
+
ss << seed << (++index);
|
86
|
+
return ss.str();
|
87
|
+
}
|
88
|
+
#endif
|
89
|
+
|
90
|
+
/*****************************
|
91
|
+
STATIC: Bindable_t::GetObject
|
92
|
+
*****************************/
|
93
|
+
|
94
|
+
Bindable_t *Bindable_t::GetObject (const unsigned long binding)
|
95
|
+
{
|
96
|
+
map<unsigned long, Bindable_t*>::const_iterator i = BindingBag.find (binding);
|
97
|
+
if (i != BindingBag.end())
|
98
|
+
return i->second;
|
99
|
+
else
|
100
|
+
return NULL;
|
101
|
+
}
|
102
|
+
|
103
|
+
|
104
|
+
/**********************
|
105
|
+
Bindable_t::Bindable_t
|
106
|
+
**********************/
|
107
|
+
|
108
|
+
Bindable_t::Bindable_t()
|
109
|
+
{
|
110
|
+
Binding = Bindable_t::CreateBinding();
|
111
|
+
BindingBag [Binding] = this;
|
112
|
+
}
|
113
|
+
|
114
|
+
|
115
|
+
|
116
|
+
/***********************
|
117
|
+
Bindable_t::~Bindable_t
|
118
|
+
***********************/
|
119
|
+
|
120
|
+
Bindable_t::~Bindable_t()
|
121
|
+
{
|
122
|
+
BindingBag.erase (Binding);
|
123
|
+
}
|
124
|
+
|
125
|
+
|
data/ext/binder.h
CHANGED
@@ -1,48 +1,46 @@
|
|
1
|
-
/*****************************************************************************
|
2
|
-
|
3
|
-
$Id$
|
4
|
-
|
5
|
-
File: binder.h
|
6
|
-
Date: 07Apr06
|
7
|
-
|
8
|
-
Copyright (C) 2006-07 by Francis Cianfrocca. All Rights Reserved.
|
9
|
-
Gmail: blackhedd
|
10
|
-
|
11
|
-
This program is free software; you can redistribute it and/or modify
|
12
|
-
it under the terms of either: 1) the GNU General Public License
|
13
|
-
as published by the Free Software Foundation; either version 2 of the
|
14
|
-
License, or (at your option) any later version; or 2) Ruby's License.
|
15
|
-
|
16
|
-
See the file COPYING for complete licensing information.
|
17
|
-
|
18
|
-
*****************************************************************************/
|
19
|
-
|
20
|
-
#ifndef __ObjectBindings__H_
|
21
|
-
#define __ObjectBindings__H_
|
22
|
-
|
23
|
-
|
24
|
-
class Bindable_t
|
25
|
-
{
|
26
|
-
public:
|
27
|
-
static
|
28
|
-
static Bindable_t *GetObject (const
|
29
|
-
static
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
Bindable_t();
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
#endif // __ObjectBindings__H_
|
48
|
-
|
1
|
+
/*****************************************************************************
|
2
|
+
|
3
|
+
$Id$
|
4
|
+
|
5
|
+
File: binder.h
|
6
|
+
Date: 07Apr06
|
7
|
+
|
8
|
+
Copyright (C) 2006-07 by Francis Cianfrocca. All Rights Reserved.
|
9
|
+
Gmail: blackhedd
|
10
|
+
|
11
|
+
This program is free software; you can redistribute it and/or modify
|
12
|
+
it under the terms of either: 1) the GNU General Public License
|
13
|
+
as published by the Free Software Foundation; either version 2 of the
|
14
|
+
License, or (at your option) any later version; or 2) Ruby's License.
|
15
|
+
|
16
|
+
See the file COPYING for complete licensing information.
|
17
|
+
|
18
|
+
*****************************************************************************/
|
19
|
+
|
20
|
+
#ifndef __ObjectBindings__H_
|
21
|
+
#define __ObjectBindings__H_
|
22
|
+
|
23
|
+
|
24
|
+
class Bindable_t
|
25
|
+
{
|
26
|
+
public:
|
27
|
+
static unsigned long CreateBinding();
|
28
|
+
static Bindable_t *GetObject (const unsigned long);
|
29
|
+
static map<unsigned long, Bindable_t*> BindingBag;
|
30
|
+
|
31
|
+
public:
|
32
|
+
Bindable_t();
|
33
|
+
virtual ~Bindable_t();
|
34
|
+
|
35
|
+
const unsigned long GetBinding() {return Binding;}
|
36
|
+
|
37
|
+
private:
|
38
|
+
unsigned long Binding;
|
39
|
+
};
|
40
|
+
|
41
|
+
|
42
|
+
|
43
|
+
|
44
|
+
|
45
|
+
#endif // __ObjectBindings__H_
|
46
|
+
|
data/ext/cmain.cpp
CHANGED
@@ -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
|
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
|
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
|
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
|
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
|
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,
|
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
|
139
|
+
extern "C" int evma_detach_fd (const unsigned long binding)
|
133
140
|
{
|
134
|
-
ensure_eventmachine("
|
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
|
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
|
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
|
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
|
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
|
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
|
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
|
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
|
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
|
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
|
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
|
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
|
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
|
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
|
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
|
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
|
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
|
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
|
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
|
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
|
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
|
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
|
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
|
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
|
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
|
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
|
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
|
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
|
-
|
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
|
-
|
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
|
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
|
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));
|