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,37 +1,37 @@
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
-
31
- package com.rubyeventmachine;
32
-
33
- //import com.rubyeventmachine.*;
34
-
35
- public interface ConnectionFactory {
36
- public Connection connection();
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
+
31
+ package com.rubyeventmachine.application;
32
+
33
+ //import com.rubyeventmachine.*;
34
+
35
+ public interface ConnectionFactory {
36
+ public Connection connection();
37
37
  }
@@ -1,46 +1,46 @@
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
-
31
- package com.rubyeventmachine;
32
-
33
- import com.rubyeventmachine.ConnectionFactory;
34
-
35
- public class DefaultConnectionFactory implements ConnectionFactory {
36
-
37
- /**
38
- * Convenience class. Its connection() method returns an instance of class
39
- * Connection, which is usually overridden. This class is probably most
40
- * useful for unit testing.
41
- */
42
- public Connection connection() {
43
- return new Connection();
44
- }
45
-
46
- }
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
+
31
+ package com.rubyeventmachine.application;
32
+
33
+ import com.rubyeventmachine.application.ConnectionFactory;
34
+
35
+ public class DefaultConnectionFactory implements ConnectionFactory {
36
+
37
+ /**
38
+ * Convenience class. Its connection() method returns an instance of class
39
+ * Connection, which is usually overridden. This class is probably most
40
+ * useful for unit testing.
41
+ */
42
+ public Connection connection() {
43
+ return new Connection();
44
+ }
45
+
46
+ }
@@ -1,38 +1,38 @@
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;
31
-
32
- public class PeriodicTimer extends Timer {
33
-
34
- public void _fire() {
35
- fire();
36
- application.addTimer(interval, this);
37
- }
38
- }
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.application;
31
+
32
+ public class PeriodicTimer extends Timer {
33
+
34
+ public void _fire() {
35
+ fire();
36
+ application.addTimer(interval, this);
37
+ }
38
+ }
@@ -1,54 +1,54 @@
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;
31
-
32
- public class Timer {
33
- /**
34
- * User code is expected to call a method on a controlling Application,
35
- * which will fill in this field so subsequent user code can access it.
36
- */
37
- public Application application;
38
- public double interval;
39
-
40
- /**
41
- * The reactor calls here, and it may be overridden in subclasses.
42
- * User code should never call this method.
43
- */
44
- public void _fire() {
45
- fire();
46
- }
47
-
48
- /**
49
- * User code is expected to override this method.
50
- */
51
- public void fire() {
52
- }
53
-
54
- }
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.application;
31
+
32
+ public class Timer {
33
+ /**
34
+ * User code is expected to call a method on a controlling Application,
35
+ * which will fill in this field so subsequent user code can access it.
36
+ */
37
+ public Application application;
38
+ public double interval;
39
+
40
+ /**
41
+ * The reactor calls here, and it may be overridden in subclasses.
42
+ * User code should never call this method.
43
+ */
44
+ public void _fire() {
45
+ fire();
46
+ }
47
+
48
+ /**
49
+ * User code is expected to override this method.
50
+ */
51
+ public void fire() {
52
+ }
53
+
54
+ }
@@ -1,108 +1,109 @@
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
-
31
- package com.rubyeventmachine.tests;
32
-
33
-
34
- import org.junit.After;
35
- import org.junit.AfterClass;
36
- import org.junit.Before;
37
- import org.junit.BeforeClass;
38
- import org.junit.Test;
39
- import org.junit.Assert;
40
- import java.net.*;
41
- import java.io.*;
42
- import java.nio.*;
43
-
44
- import com.rubyeventmachine.*;
45
-
46
- public class ApplicationTest {
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 void testRunnableArgument() {
66
- final Application a = new Application();
67
- a.run (new Runnable() {
68
- public void run() {
69
- a.stop();
70
- }
71
- });
72
- }
73
-
74
-
75
-
76
- class F implements ConnectionFactory {
77
- public Connection connection() {
78
- return new Connection() {
79
- public void receiveData (ByteBuffer bb) {
80
- application.stop();
81
- }
82
- };
83
- }
84
-
85
- };
86
-
87
- @Test
88
- public void testTcpServer() throws EmReactorException {
89
- final Application a = new Application();
90
- final SocketAddress saddr = new InetSocketAddress ("127.0.0.1", 9008);
91
- a.run (new Runnable() {
92
- public void run() {
93
- try {
94
- a.startServer (saddr, new F());
95
- } catch (EmReactorException e) { Assert.fail(); }
96
- new Thread() {
97
- public void run() {
98
- try {
99
- Socket s = new Socket ("127.0.0.1", 9008);
100
- s.getOutputStream().write(new String ("boo").getBytes());
101
- } catch (UnknownHostException e) {
102
- } catch (IOException e) {}
103
- }
104
- }.start();
105
- }
106
- });
107
- }
108
- }
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
+
31
+ package com.rubyeventmachine.tests;
32
+
33
+
34
+ import org.junit.After;
35
+ import org.junit.AfterClass;
36
+ import org.junit.Before;
37
+ import org.junit.BeforeClass;
38
+ import org.junit.Test;
39
+ import org.junit.Assert;
40
+ import java.net.*;
41
+ import java.io.*;
42
+ import java.nio.*;
43
+
44
+ import com.rubyeventmachine.*;
45
+ import com.rubyeventmachine.application.*;
46
+
47
+ public class ApplicationTest {
48
+
49
+ @BeforeClass
50
+ public static void setUpBeforeClass() throws Exception {
51
+ }
52
+
53
+ @AfterClass
54
+ public static void tearDownAfterClass() throws Exception {
55
+ }
56
+
57
+ @Before
58
+ public void setUp() throws Exception {
59
+ }
60
+
61
+ @After
62
+ public void tearDown() throws Exception {
63
+ }
64
+
65
+ @Test
66
+ public void testRunnableArgument() {
67
+ final Application a = new Application();
68
+ a.run (new Runnable() {
69
+ public void run() {
70
+ a.stop();
71
+ }
72
+ });
73
+ }
74
+
75
+
76
+
77
+ class F implements ConnectionFactory {
78
+ public Connection connection() {
79
+ return new Connection() {
80
+ public void receiveData (ByteBuffer bb) {
81
+ application.stop();
82
+ }
83
+ };
84
+ }
85
+
86
+ };
87
+
88
+ @Test
89
+ public void testTcpServer() throws EmReactorException {
90
+ final Application a = new Application();
91
+ final SocketAddress saddr = new InetSocketAddress ("127.0.0.1", 9008);
92
+ a.run (new Runnable() {
93
+ public void run() {
94
+ try {
95
+ a.startServer (saddr, new F());
96
+ } catch (EmReactorException e) { Assert.fail(); }
97
+ new Thread() {
98
+ public void run() {
99
+ try {
100
+ Socket s = new Socket ("127.0.0.1", 9008);
101
+ s.getOutputStream().write(new String ("boo").getBytes());
102
+ } catch (UnknownHostException e) {
103
+ } catch (IOException e) {}
104
+ }
105
+ }.start();
106
+ }
107
+ });
108
+ }
109
+ }