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.
Files changed (66) hide show
  1. data/.gitignore +14 -13
  2. data/Rakefile +374 -264
  3. data/eventmachine.gemspec +4 -5
  4. data/ext/binder.cpp +125 -126
  5. data/ext/binder.h +46 -48
  6. data/ext/cmain.cpp +184 -42
  7. data/ext/cplusplus.cpp +202 -202
  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 +96 -96
  15. data/ext/extconf.rb +147 -132
  16. data/ext/fastfilereader/extconf.rb +82 -76
  17. data/ext/project.h +151 -140
  18. data/ext/rubymain.cpp +222 -103
  19. data/ext/ssl.cpp +460 -460
  20. data/ext/ssl.h +94 -94
  21. data/java/src/com/rubyeventmachine/EmReactor.java +570 -423
  22. data/java/src/com/rubyeventmachine/EventableChannel.java +69 -57
  23. data/java/src/com/rubyeventmachine/EventableDatagramChannel.java +189 -171
  24. data/java/src/com/rubyeventmachine/EventableSocketChannel.java +364 -244
  25. data/java/src/com/rubyeventmachine/{Application.java → application/Application.java} +194 -200
  26. data/java/src/com/rubyeventmachine/{Connection.java → application/Connection.java} +74 -74
  27. data/java/src/com/rubyeventmachine/{ConnectionFactory.java → application/ConnectionFactory.java} +36 -36
  28. data/java/src/com/rubyeventmachine/{DefaultConnectionFactory.java → application/DefaultConnectionFactory.java} +46 -46
  29. data/java/src/com/rubyeventmachine/{PeriodicTimer.java → application/PeriodicTimer.java} +38 -38
  30. data/java/src/com/rubyeventmachine/{Timer.java → application/Timer.java} +54 -54
  31. data/java/src/com/rubyeventmachine/tests/ApplicationTest.java +109 -108
  32. data/java/src/com/rubyeventmachine/tests/ConnectTest.java +148 -146
  33. data/java/src/com/rubyeventmachine/tests/TestDatagrams.java +53 -53
  34. data/java/src/com/rubyeventmachine/tests/TestServers.java +75 -74
  35. data/java/src/com/rubyeventmachine/tests/TestTimers.java +90 -89
  36. data/lib/em/connection.rb +71 -12
  37. data/lib/em/deferrable.rb +191 -186
  38. data/lib/em/protocols.rb +36 -35
  39. data/lib/em/protocols/httpclient2.rb +590 -582
  40. data/lib/em/protocols/line_and_text.rb +125 -126
  41. data/lib/em/protocols/linetext2.rb +161 -160
  42. data/lib/em/protocols/object_protocol.rb +45 -39
  43. data/lib/em/protocols/smtpclient.rb +357 -331
  44. data/lib/em/protocols/socks4.rb +66 -0
  45. data/lib/em/queue.rb +60 -60
  46. data/lib/em/timers.rb +56 -55
  47. data/lib/em/version.rb +1 -1
  48. data/lib/eventmachine.rb +125 -169
  49. data/lib/jeventmachine.rb +257 -142
  50. data/tasks/{cpp.rake → cpp.rake_example} +76 -76
  51. data/tests/test_attach.rb +125 -100
  52. data/tests/test_basic.rb +1 -2
  53. data/tests/test_connection_count.rb +34 -44
  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 +182 -188
  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 +78 -67
  63. data/tests/test_timers.rb +162 -141
  64. metadata +13 -11
  65. data/tasks/project.rake +0 -79
  66. data/tasks/tests.rake +0 -193
@@ -1,146 +1,148 @@
1
- /**
2
- * $Id$
3
- *
4
- * Author:: Francis Cianfrocca (gmail: blackhedd)
5
- * Homepage:: http://rubyeventmachine.com
6
- * Date:: 15 Jul 2007
7
- *
8
- * See EventMachine and EventMachine::Connection for documentation and
9
- * usage examples.
10
- *
11
- *
12
- *----------------------------------------------------------------------------
13
- *
14
- * Copyright (C) 2006-07 by Francis Cianfrocca. All Rights Reserved.
15
- * Gmail: blackhedd
16
- *
17
- * This program is free software; you can redistribute it and/or modify
18
- * it under the terms of either: 1) the GNU General Public License
19
- * as published by the Free Software Foundation; either version 2 of the
20
- * License, or (at your option) any later version; or 2) Ruby's License.
21
- *
22
- * See the file COPYING for complete licensing information.
23
- *
24
- *---------------------------------------------------------------------------
25
- *
26
- *
27
- */
28
-
29
-
30
- package com.rubyeventmachine.tests;
31
-
32
-
33
- import org.junit.After;
34
- import org.junit.AfterClass;
35
- import org.junit.Before;
36
- import org.junit.BeforeClass;
37
- import org.junit.Test;
38
- import java.io.*;
39
- import java.nio.*;
40
- import java.nio.channels.*;
41
-
42
- import com.rubyeventmachine.*;
43
-
44
- public class ConnectTest {
45
-
46
- @BeforeClass
47
- public static void setUpBeforeClass() throws Exception {
48
- }
49
-
50
- @AfterClass
51
- public static void tearDownAfterClass() throws Exception {
52
- }
53
-
54
- @Before
55
- public void setUp() throws Exception {
56
- }
57
-
58
- @After
59
- public void tearDown() throws Exception {
60
- }
61
-
62
- @Test
63
- public final void test1() throws IOException, ClosedChannelException {
64
- Application a = new Application();
65
- a.addTimer(0, new Timer() {
66
- public void fire() {
67
- application.connect("www.bayshorenetworks.com", 80, new Connection() {
68
- public void connectionCompleted() {
69
- close();
70
- }
71
- public void unbind() {
72
- application.stop();
73
- }
74
- });
75
- }
76
- });
77
- a.run();
78
- }
79
-
80
- @Test
81
- public final void test2() throws IOException {
82
- class Bays extends Connection {
83
- public void connectionCompleted() {
84
- sendData (ByteBuffer.wrap( new String ("GET / HTTP/1.1\r\nHost: _\r\n\r\n").getBytes()));
85
- }
86
- public void receiveData (ByteBuffer b) {
87
- System.out.println (new String(b.array()));
88
- application.stop();
89
- }
90
- };
91
-
92
- Application a = new Application();
93
- a.addTimer(0, new Timer() {
94
- public void fire() {
95
- application.connect("www.bayshorenetworks.com", 80, new Bays());
96
- }
97
- });
98
- a.run();
99
- }
100
-
101
- public final void testBindConnect() throws IOException {
102
- class Server extends Connection {
103
- public void postInit() {
104
- // TODO: get peername here and check if the port is 33333
105
- // doesnt seem like peername is impl yet?
106
- System.out.println("post init!");
107
- }
108
- };
109
-
110
- Application a = new Application();
111
- a.addTimer(0, new Timer() {
112
- public void fire() {
113
- application.startServer(new InetSocketAddress("localhost", 20000), new Server());
114
- }
115
- });
116
- a.addTimer(500, new Timer() {
117
- public void fire() {
118
- application.bindConnect("localhost", 33333, "localhost", 20000);
119
- }
120
- });
121
-
122
- a.run();
123
- }
124
-
125
- class C1 extends Connection {
126
- Application application;
127
- public C1 (Application a) {
128
- application = a;
129
- }
130
- public void postInit() {
131
- application.stop();
132
- }
133
- }
134
- @Test
135
- public final void test3() {
136
- final Application a = new Application();
137
- a.run (new Runnable() {
138
- public void run() {
139
- a.connect("www.bayshorenetworks.com", 80, new C1(a));
140
- }
141
- });
142
- }
143
-
144
-
145
-
146
- }
1
+ /**
2
+ * $Id$
3
+ *
4
+ * Author:: Francis Cianfrocca (gmail: blackhedd)
5
+ * Homepage:: http://rubyeventmachine.com
6
+ * Date:: 15 Jul 2007
7
+ *
8
+ * See EventMachine and EventMachine::Connection for documentation and
9
+ * usage examples.
10
+ *
11
+ *
12
+ *----------------------------------------------------------------------------
13
+ *
14
+ * Copyright (C) 2006-07 by Francis Cianfrocca. All Rights Reserved.
15
+ * Gmail: blackhedd
16
+ *
17
+ * This program is free software; you can redistribute it and/or modify
18
+ * it under the terms of either: 1) the GNU General Public License
19
+ * as published by the Free Software Foundation; either version 2 of the
20
+ * License, or (at your option) any later version; or 2) Ruby's License.
21
+ *
22
+ * See the file COPYING for complete licensing information.
23
+ *
24
+ *---------------------------------------------------------------------------
25
+ *
26
+ *
27
+ */
28
+
29
+
30
+ package com.rubyeventmachine.tests;
31
+
32
+
33
+ import org.junit.After;
34
+ import org.junit.AfterClass;
35
+ import org.junit.Before;
36
+ import org.junit.BeforeClass;
37
+ import org.junit.Test;
38
+ import java.net.*;
39
+ import java.io.*;
40
+ import java.nio.*;
41
+ import java.nio.channels.*;
42
+
43
+ import com.rubyeventmachine.*;
44
+ import com.rubyeventmachine.application.*;
45
+
46
+ public class ConnectTest {
47
+
48
+ @BeforeClass
49
+ public static void setUpBeforeClass() throws Exception {
50
+ }
51
+
52
+ @AfterClass
53
+ public static void tearDownAfterClass() throws Exception {
54
+ }
55
+
56
+ @Before
57
+ public void setUp() throws Exception {
58
+ }
59
+
60
+ @After
61
+ public void tearDown() throws Exception {
62
+ }
63
+
64
+ @Test
65
+ public final void test1() throws IOException, ClosedChannelException {
66
+ Application a = new Application();
67
+ a.addTimer(0, new Timer() {
68
+ public void fire() {
69
+ application.connect("www.bayshorenetworks.com", 80, new Connection() {
70
+ public void connectionCompleted() {
71
+ close();
72
+ }
73
+ public void unbind() {
74
+ application.stop();
75
+ }
76
+ });
77
+ }
78
+ });
79
+ a.run();
80
+ }
81
+
82
+ @Test
83
+ public final void test2() throws IOException {
84
+ class Bays extends Connection {
85
+ public void connectionCompleted() {
86
+ sendData (ByteBuffer.wrap( new String ("GET / HTTP/1.1\r\nHost: _\r\n\r\n").getBytes()));
87
+ }
88
+ public void receiveData (ByteBuffer b) {
89
+ System.out.println (new String(b.array()));
90
+ application.stop();
91
+ }
92
+ };
93
+
94
+ Application a = new Application();
95
+ a.addTimer(0, new Timer() {
96
+ public void fire() {
97
+ application.connect("www.bayshorenetworks.com", 80, new Bays());
98
+ }
99
+ });
100
+ a.run();
101
+ }
102
+
103
+ public final void testBindConnect() throws IOException {
104
+ class Server extends Connection {
105
+ public void postInit() {
106
+ // TODO: get peername here and check if the port is 33333
107
+ // doesnt seem like peername is impl yet?
108
+ System.out.println("post init!");
109
+ }
110
+ };
111
+
112
+ Application a = new Application();
113
+ a.addTimer(0, new Timer() {
114
+ public void fire() {
115
+ application.startServer(new InetSocketAddress("localhost", 20000), new DefaultConnectionFactory());
116
+ }
117
+ });
118
+ a.addTimer(500, new Timer() {
119
+ public void fire() {
120
+ application.bindConnect("localhost", 33333, "localhost", 20000, new Connection());
121
+ }
122
+ });
123
+
124
+ a.run();
125
+ }
126
+
127
+ class C1 extends Connection {
128
+ Application application;
129
+ public C1 (Application a) {
130
+ application = a;
131
+ }
132
+ public void postInit() {
133
+ application.stop();
134
+ }
135
+ }
136
+ @Test
137
+ public final void test3() {
138
+ final Application a = new Application();
139
+ a.run (new Runnable() {
140
+ public void run() {
141
+ a.connect("www.bayshorenetworks.com", 80, new C1(a));
142
+ }
143
+ });
144
+ }
145
+
146
+
147
+
148
+ }
@@ -1,53 +1,53 @@
1
- package com.rubyeventmachine.tests;
2
-
3
- import com.rubyeventmachine.*;
4
- import java.net.*;
5
- import java.nio.*;
6
-
7
- import org.junit.After;
8
- import org.junit.AfterClass;
9
- import org.junit.Before;
10
- import org.junit.BeforeClass;
11
- import org.junit.Test;
12
-
13
-
14
- public class TestDatagrams {
15
-
16
- @BeforeClass
17
- public static void setUpBeforeClass() throws Exception {
18
- }
19
-
20
- @AfterClass
21
- public static void tearDownAfterClass() throws Exception {
22
- }
23
-
24
- @Before
25
- public void setUp() throws Exception {
26
- }
27
-
28
- @After
29
- public void tearDown() throws Exception {
30
- }
31
-
32
- class A extends Connection {
33
- public void receiveData (ByteBuffer bb) {
34
- application.stop();
35
- }
36
- }
37
- class B extends Connection {
38
- public void postInit() {
39
- this.sendDatagram(ByteBuffer.wrap(new String("ABC").getBytes()), new InetSocketAddress ("127.0.0.1", 9550));
40
- }
41
-
42
- }
43
- @Test
44
- public final void testA() {
45
- final Application a = new Application();
46
- a.run (new Runnable() {
47
- public void run() {
48
- a.openDatagramSocket( new InetSocketAddress ("0.0.0.0", 9550), new A() );
49
- a.openDatagramSocket( new B() );
50
- }
51
- });
52
- }
53
- }
1
+ package com.rubyeventmachine.tests;
2
+
3
+ import com.rubyeventmachine.application.*;
4
+ import java.net.*;
5
+ import java.nio.*;
6
+
7
+ import org.junit.After;
8
+ import org.junit.AfterClass;
9
+ import org.junit.Before;
10
+ import org.junit.BeforeClass;
11
+ import org.junit.Test;
12
+
13
+
14
+ public class TestDatagrams {
15
+
16
+ @BeforeClass
17
+ public static void setUpBeforeClass() throws Exception {
18
+ }
19
+
20
+ @AfterClass
21
+ public static void tearDownAfterClass() throws Exception {
22
+ }
23
+
24
+ @Before
25
+ public void setUp() throws Exception {
26
+ }
27
+
28
+ @After
29
+ public void tearDown() throws Exception {
30
+ }
31
+
32
+ class A extends Connection {
33
+ public void receiveData (ByteBuffer bb) {
34
+ application.stop();
35
+ }
36
+ }
37
+ class B extends Connection {
38
+ public void postInit() {
39
+ this.sendDatagram(ByteBuffer.wrap(new String("ABC").getBytes()), new InetSocketAddress ("127.0.0.1", 9550));
40
+ }
41
+
42
+ }
43
+ @Test
44
+ public final void testA() {
45
+ final Application a = new Application();
46
+ a.run (new Runnable() {
47
+ public void run() {
48
+ a.openDatagramSocket( new InetSocketAddress ("0.0.0.0", 9550), new A() );
49
+ a.openDatagramSocket( new B() );
50
+ }
51
+ });
52
+ }
53
+ }
@@ -1,74 +1,75 @@
1
- /**
2
- * $Id$
3
- *
4
- * Author:: Francis Cianfrocca (gmail: blackhedd)
5
- * Homepage:: http://rubyeventmachine.com
6
- * Date:: 15 Jul 2007
7
- *
8
- * See EventMachine and EventMachine::Connection for documentation and
9
- * usage examples.
10
- *
11
- *
12
- *----------------------------------------------------------------------------
13
- *
14
- * Copyright (C) 2006-07 by Francis Cianfrocca. All Rights Reserved.
15
- * Gmail: blackhedd
16
- *
17
- * This program is free software; you can redistribute it and/or modify
18
- * it under the terms of either: 1) the GNU General Public License
19
- * as published by the Free Software Foundation; either version 2 of the
20
- * License, or (at your option) any later version; or 2) Ruby's License.
21
- *
22
- * See the file COPYING for complete licensing information.
23
- *
24
- *---------------------------------------------------------------------------
25
- *
26
- *
27
- */
28
-
29
-
30
- package com.rubyeventmachine.tests;
31
-
32
-
33
- import com.rubyeventmachine.*;
34
- import java.net.*;
35
- import org.junit.After;
36
- import org.junit.AfterClass;
37
- import org.junit.Before;
38
- import org.junit.BeforeClass;
39
- import org.junit.Test;
40
- import org.junit.Assert;
41
-
42
- public class TestServers {
43
-
44
- @BeforeClass
45
- public static void setUpBeforeClass() throws Exception {
46
- }
47
-
48
- @AfterClass
49
- public static void tearDownAfterClass() throws Exception {
50
- }
51
-
52
- @Before
53
- public void setUp() throws Exception {
54
- }
55
-
56
- @After
57
- public void tearDown() throws Exception {
58
- }
59
-
60
-
61
- @Test
62
- public void testBadServerAddress() {
63
- final Application a = new Application();
64
- a.run (new Runnable() {
65
- public void run() {
66
- try {
67
- a.startServer(new InetSocketAddress ("100.100.100.100", 100), new DefaultConnectionFactory());
68
- Assert.fail ("was supposed to throw a reactor exception");
69
- } catch (EmReactorException e) {}
70
- a.stop();
71
- }
72
- });
73
- }
74
- }
1
+ /**
2
+ * $Id$
3
+ *
4
+ * Author:: Francis Cianfrocca (gmail: blackhedd)
5
+ * Homepage:: http://rubyeventmachine.com
6
+ * Date:: 15 Jul 2007
7
+ *
8
+ * See EventMachine and EventMachine::Connection for documentation and
9
+ * usage examples.
10
+ *
11
+ *
12
+ *----------------------------------------------------------------------------
13
+ *
14
+ * Copyright (C) 2006-07 by Francis Cianfrocca. All Rights Reserved.
15
+ * Gmail: blackhedd
16
+ *
17
+ * This program is free software; you can redistribute it and/or modify
18
+ * it under the terms of either: 1) the GNU General Public License
19
+ * as published by the Free Software Foundation; either version 2 of the
20
+ * License, or (at your option) any later version; or 2) Ruby's License.
21
+ *
22
+ * See the file COPYING for complete licensing information.
23
+ *
24
+ *---------------------------------------------------------------------------
25
+ *
26
+ *
27
+ */
28
+
29
+
30
+ package com.rubyeventmachine.tests;
31
+
32
+
33
+ import com.rubyeventmachine.*;
34
+ import com.rubyeventmachine.application.*;
35
+ import java.net.*;
36
+ import org.junit.After;
37
+ import org.junit.AfterClass;
38
+ import org.junit.Before;
39
+ import org.junit.BeforeClass;
40
+ import org.junit.Test;
41
+ import org.junit.Assert;
42
+
43
+ public class TestServers {
44
+
45
+ @BeforeClass
46
+ public static void setUpBeforeClass() throws Exception {
47
+ }
48
+
49
+ @AfterClass
50
+ public static void tearDownAfterClass() throws Exception {
51
+ }
52
+
53
+ @Before
54
+ public void setUp() throws Exception {
55
+ }
56
+
57
+ @After
58
+ public void tearDown() throws Exception {
59
+ }
60
+
61
+
62
+ @Test
63
+ public void testBadServerAddress() {
64
+ final Application a = new Application();
65
+ a.run (new Runnable() {
66
+ public void run() {
67
+ try {
68
+ a.startServer(new InetSocketAddress ("100.100.100.100", 100), new DefaultConnectionFactory());
69
+ Assert.fail ("was supposed to throw a reactor exception");
70
+ } catch (EmReactorException e) {}
71
+ a.stop();
72
+ }
73
+ });
74
+ }
75
+ }