eventmachine 1.0.0.beta.2-java → 1.0.0.beta.3-java
Sign up to get free protection for your applications and to get access to all the features.
- data/.yardopts +3 -0
- data/Gemfile +1 -0
- data/eventmachine.gemspec +1 -3
- data/ext/cmain.cpp +4 -4
- data/ext/ed.cpp +13 -16
- data/ext/ed.h +9 -10
- data/ext/em.cpp +14 -24
- data/ext/eventmachine.h +2 -2
- data/ext/extconf.rb +1 -1
- data/ext/rubymain.cpp +8 -6
- data/lib/em/connection.rb +3 -1
- data/lib/em/pure_ruby.rb +17 -17
- data/lib/em/resolver.rb +186 -0
- data/lib/em/spawnable.rb +3 -7
- data/lib/em/version.rb +1 -1
- data/lib/eventmachine.rb +6 -4
- data/lib/jeventmachine.rb +1 -1
- data/tasks/package.rake +4 -1
- data/tasks/test.rake +1 -0
- data/tests/em_test_helper.rb +55 -0
- data/tests/test_attach.rb +46 -56
- data/tests/test_basic.rb +74 -96
- data/tests/test_channel.rb +2 -4
- data/tests/test_connection_count.rb +1 -3
- data/tests/test_defer.rb +13 -44
- data/tests/test_deferrable.rb +19 -19
- data/tests/test_epoll.rb +25 -55
- data/tests/test_error_handler.rb +10 -7
- data/tests/test_exc.rb +6 -33
- data/tests/test_file_watch.rb +51 -35
- data/tests/test_futures.rb +9 -37
- data/tests/test_get_sock_opt.rb +27 -20
- data/tests/test_handler_check.rb +1 -3
- data/tests/test_hc.rb +24 -59
- data/tests/test_httpclient.rb +27 -64
- data/tests/test_httpclient2.rb +1 -29
- data/tests/test_inactivity_timeout.rb +44 -40
- data/tests/test_kb.rb +26 -52
- data/tests/test_ltp.rb +23 -67
- data/tests/test_ltp2.rb +1 -30
- data/tests/test_next_tick.rb +1 -30
- data/tests/test_object_protocol.rb +8 -9
- data/tests/test_pause.rb +45 -37
- data/tests/test_pending_connect_timeout.rb +42 -38
- data/tests/test_process_watch.rb +1 -3
- data/tests/test_processes.rb +92 -110
- data/tests/test_proxy_connection.rb +128 -104
- data/tests/test_pure.rb +29 -75
- data/tests/test_queue.rb +2 -4
- data/tests/test_resolver.rb +55 -0
- data/tests/test_running.rb +1 -29
- data/tests/test_sasl.rb +7 -32
- data/tests/test_send_file.rb +162 -196
- data/tests/test_servers.rb +13 -56
- data/tests/test_smtpclient.rb +1 -29
- data/tests/test_smtpserver.rb +1 -29
- data/tests/test_spawn.rb +2 -31
- data/tests/test_ssl_args.rb +9 -10
- data/tests/test_ssl_methods.rb +1 -3
- data/tests/test_ssl_verify.rb +63 -63
- data/tests/test_tick_loop.rb +1 -1
- data/tests/test_timers.rb +52 -89
- data/tests/test_ud.rb +1 -29
- metadata +11 -8
- data/setup.rb +0 -1585
- data/tests/test_errors.rb +0 -82
- data/tests/testem.rb +0 -31
data/.yardopts
ADDED
data/Gemfile
CHANGED
data/eventmachine.gemspec
CHANGED
@@ -2,8 +2,6 @@
|
|
2
2
|
require File.expand_path('../lib/em/version', __FILE__)
|
3
3
|
|
4
4
|
Gem::Specification.new do |s|
|
5
|
-
s.date = "2010-11-13"
|
6
|
-
|
7
5
|
s.name = 'eventmachine'
|
8
6
|
s.version = EventMachine::VERSION
|
9
7
|
s.homepage = 'http://rubyeventmachine.com'
|
@@ -15,7 +13,7 @@ Gem::Specification.new do |s|
|
|
15
13
|
s.files = `git ls-files`.split("\n")
|
16
14
|
s.extensions = ["ext/extconf.rb", "ext/fastfilereader/extconf.rb"]
|
17
15
|
|
18
|
-
s.add_development_dependency 'rake-compiler'
|
16
|
+
s.add_development_dependency 'rake-compiler', '0.7.6'
|
19
17
|
|
20
18
|
s.summary = 'Ruby/EventMachine library'
|
21
19
|
s.description = "EventMachine implements a fast, single-threaded engine for arbitrary network
|
data/ext/cmain.cpp
CHANGED
@@ -464,12 +464,12 @@ extern "C" void evma_accept_ssl_peer (const unsigned long binding)
|
|
464
464
|
evma_get_peername
|
465
465
|
*****************/
|
466
466
|
|
467
|
-
extern "C" int evma_get_peername (const unsigned long binding, struct sockaddr *sa)
|
467
|
+
extern "C" int evma_get_peername (const unsigned long binding, struct sockaddr *sa, socklen_t *len)
|
468
468
|
{
|
469
469
|
ensure_eventmachine("evma_get_peername");
|
470
470
|
EventableDescriptor *ed = dynamic_cast <EventableDescriptor*> (Bindable_t::GetObject (binding));
|
471
471
|
if (ed) {
|
472
|
-
return ed->GetPeername (sa) ? 1 : 0;
|
472
|
+
return ed->GetPeername (sa, len) ? 1 : 0;
|
473
473
|
}
|
474
474
|
else
|
475
475
|
return 0;
|
@@ -479,12 +479,12 @@ extern "C" int evma_get_peername (const unsigned long binding, struct sockaddr *
|
|
479
479
|
evma_get_sockname
|
480
480
|
*****************/
|
481
481
|
|
482
|
-
extern "C" int evma_get_sockname (const unsigned long binding, struct sockaddr *sa)
|
482
|
+
extern "C" int evma_get_sockname (const unsigned long binding, struct sockaddr *sa, socklen_t *len)
|
483
483
|
{
|
484
484
|
ensure_eventmachine("evma_get_sockname");
|
485
485
|
EventableDescriptor *ed = dynamic_cast <EventableDescriptor*> (Bindable_t::GetObject (binding));
|
486
486
|
if (ed) {
|
487
|
-
return ed->GetSockname (sa) ? 1 : 0;
|
487
|
+
return ed->GetSockname (sa, len) ? 1 : 0;
|
488
488
|
}
|
489
489
|
else
|
490
490
|
return 0;
|
data/ext/ed.cpp
CHANGED
@@ -54,6 +54,7 @@ EventableDescriptor::EventableDescriptor (int sd, EventMachine_t *em):
|
|
54
54
|
bCloseNow (false),
|
55
55
|
bCloseAfterWriting (false),
|
56
56
|
MySocket (sd),
|
57
|
+
bWatchOnly (false),
|
57
58
|
EventCallback (NULL),
|
58
59
|
bCallbackUnbind (true),
|
59
60
|
UnbindReasonCode (0),
|
@@ -135,7 +136,7 @@ EventableDescriptor::Close
|
|
135
136
|
void EventableDescriptor::Close()
|
136
137
|
{
|
137
138
|
// Close the socket right now. Intended for emergencies.
|
138
|
-
if (MySocket != INVALID_SOCKET) {
|
139
|
+
if (MySocket != INVALID_SOCKET && !bWatchOnly) {
|
139
140
|
shutdown (MySocket, 1);
|
140
141
|
close (MySocket);
|
141
142
|
MySocket = INVALID_SOCKET;
|
@@ -298,7 +299,7 @@ uint64_t EventableDescriptor::GetNextHeartbeat()
|
|
298
299
|
NextHeartbeat = 0;
|
299
300
|
|
300
301
|
if (!ShouldDelete()) {
|
301
|
-
uint64_t time_til_next =
|
302
|
+
uint64_t time_til_next = InactivityTimeout;
|
302
303
|
if (IsConnectPending()) {
|
303
304
|
if (time_til_next == 0 || PendingConnectTimeout < time_til_next)
|
304
305
|
time_til_next = PendingConnectTimeout;
|
@@ -322,7 +323,6 @@ ConnectionDescriptor::ConnectionDescriptor (int sd, EventMachine_t *em):
|
|
322
323
|
bConnectPending (false),
|
323
324
|
bNotifyReadable (false),
|
324
325
|
bNotifyWritable (false),
|
325
|
-
bWatchOnly (false),
|
326
326
|
bReadAttemptedAfterClose (false),
|
327
327
|
bWriteAttemptedAfterClose (false),
|
328
328
|
OutboundDataSize (0),
|
@@ -1393,12 +1393,11 @@ void AcceptorDescriptor::Heartbeat()
|
|
1393
1393
|
AcceptorDescriptor::GetSockname
|
1394
1394
|
*******************************/
|
1395
1395
|
|
1396
|
-
bool AcceptorDescriptor::GetSockname (struct sockaddr *s)
|
1396
|
+
bool AcceptorDescriptor::GetSockname (struct sockaddr *s, socklen_t *len)
|
1397
1397
|
{
|
1398
1398
|
bool ok = false;
|
1399
1399
|
if (s) {
|
1400
|
-
|
1401
|
-
int gp = getsockname (GetSocket(), s, &len);
|
1400
|
+
int gp = getsockname (GetSocket(), s, len);
|
1402
1401
|
if (gp == 0)
|
1403
1402
|
ok = true;
|
1404
1403
|
}
|
@@ -1716,12 +1715,11 @@ int DatagramDescriptor::SendOutboundDatagram (const char *data, int length, cons
|
|
1716
1715
|
ConnectionDescriptor::GetPeername
|
1717
1716
|
*********************************/
|
1718
1717
|
|
1719
|
-
bool ConnectionDescriptor::GetPeername (struct sockaddr *s)
|
1718
|
+
bool ConnectionDescriptor::GetPeername (struct sockaddr *s, socklen_t *len)
|
1720
1719
|
{
|
1721
1720
|
bool ok = false;
|
1722
1721
|
if (s) {
|
1723
|
-
|
1724
|
-
int gp = getpeername (GetSocket(), s, &len);
|
1722
|
+
int gp = getpeername (GetSocket(), s, len);
|
1725
1723
|
if (gp == 0)
|
1726
1724
|
ok = true;
|
1727
1725
|
}
|
@@ -1732,12 +1730,11 @@ bool ConnectionDescriptor::GetPeername (struct sockaddr *s)
|
|
1732
1730
|
ConnectionDescriptor::GetSockname
|
1733
1731
|
*********************************/
|
1734
1732
|
|
1735
|
-
bool ConnectionDescriptor::GetSockname (struct sockaddr *s)
|
1733
|
+
bool ConnectionDescriptor::GetSockname (struct sockaddr *s, socklen_t *len)
|
1736
1734
|
{
|
1737
1735
|
bool ok = false;
|
1738
1736
|
if (s) {
|
1739
|
-
|
1740
|
-
int gp = getsockname (GetSocket(), s, &len);
|
1737
|
+
int gp = getsockname (GetSocket(), s, len);
|
1741
1738
|
if (gp == 0)
|
1742
1739
|
ok = true;
|
1743
1740
|
}
|
@@ -1770,10 +1767,11 @@ int ConnectionDescriptor::SetCommInactivityTimeout (uint64_t value)
|
|
1770
1767
|
DatagramDescriptor::GetPeername
|
1771
1768
|
*******************************/
|
1772
1769
|
|
1773
|
-
bool DatagramDescriptor::GetPeername (struct sockaddr *s)
|
1770
|
+
bool DatagramDescriptor::GetPeername (struct sockaddr *s, socklen_t *len)
|
1774
1771
|
{
|
1775
1772
|
bool ok = false;
|
1776
1773
|
if (s) {
|
1774
|
+
*len = sizeof(struct sockaddr);
|
1777
1775
|
memset (s, 0, sizeof(struct sockaddr));
|
1778
1776
|
memcpy (s, &ReturnAddress, sizeof(ReturnAddress));
|
1779
1777
|
ok = true;
|
@@ -1785,12 +1783,11 @@ bool DatagramDescriptor::GetPeername (struct sockaddr *s)
|
|
1785
1783
|
DatagramDescriptor::GetSockname
|
1786
1784
|
*******************************/
|
1787
1785
|
|
1788
|
-
bool DatagramDescriptor::GetSockname (struct sockaddr *s)
|
1786
|
+
bool DatagramDescriptor::GetSockname (struct sockaddr *s, socklen_t *len)
|
1789
1787
|
{
|
1790
1788
|
bool ok = false;
|
1791
1789
|
if (s) {
|
1792
|
-
|
1793
|
-
int gp = getsockname (GetSocket(), s, &len);
|
1790
|
+
int gp = getsockname (GetSocket(), s, len);
|
1794
1791
|
if (gp == 0)
|
1795
1792
|
ok = true;
|
1796
1793
|
}
|
data/ext/ed.h
CHANGED
@@ -56,7 +56,7 @@ class EventableDescriptor: public Bindable_t
|
|
56
56
|
bool ShouldDelete();
|
57
57
|
// Do we have any data to write? This is used by ShouldDelete.
|
58
58
|
virtual int GetOutboundDataSize() {return 0;}
|
59
|
-
virtual bool IsWatchOnly(){ return
|
59
|
+
virtual bool IsWatchOnly(){ return bWatchOnly; }
|
60
60
|
|
61
61
|
virtual void ScheduleClose (bool after_writing);
|
62
62
|
bool IsCloseScheduled();
|
@@ -64,8 +64,8 @@ class EventableDescriptor: public Bindable_t
|
|
64
64
|
|
65
65
|
void SetEventCallback (EMCallback);
|
66
66
|
|
67
|
-
virtual bool GetPeername (struct sockaddr*) {return false;}
|
68
|
-
virtual bool GetSockname (struct sockaddr*) {return false;}
|
67
|
+
virtual bool GetPeername (struct sockaddr*, socklen_t*) {return false;}
|
68
|
+
virtual bool GetSockname (struct sockaddr*, socklen_t*) {return false;}
|
69
69
|
virtual bool GetSubprocessPid (pid_t*) {return false;}
|
70
70
|
|
71
71
|
virtual void StartTls() {}
|
@@ -102,6 +102,7 @@ class EventableDescriptor: public Bindable_t
|
|
102
102
|
|
103
103
|
protected:
|
104
104
|
int MySocket;
|
105
|
+
bool bWatchOnly;
|
105
106
|
|
106
107
|
EMCallback EventCallback;
|
107
108
|
void _GenericInboundDispatch(const char*, int);
|
@@ -174,7 +175,6 @@ class ConnectionDescriptor: public EventableDescriptor
|
|
174
175
|
|
175
176
|
bool IsNotifyReadable(){ return bNotifyReadable; }
|
176
177
|
bool IsNotifyWritable(){ return bNotifyWritable; }
|
177
|
-
virtual bool IsWatchOnly(){ return bWatchOnly; }
|
178
178
|
|
179
179
|
virtual void Read();
|
180
180
|
virtual void Write();
|
@@ -197,8 +197,8 @@ class ConnectionDescriptor: public EventableDescriptor
|
|
197
197
|
|
198
198
|
void SetServerMode() {bIsServer = true;}
|
199
199
|
|
200
|
-
virtual bool GetPeername (struct sockaddr*);
|
201
|
-
virtual bool GetSockname (struct sockaddr*);
|
200
|
+
virtual bool GetPeername (struct sockaddr*, socklen_t*);
|
201
|
+
virtual bool GetSockname (struct sockaddr*, socklen_t*);
|
202
202
|
|
203
203
|
virtual uint64_t GetCommInactivityTimeout();
|
204
204
|
virtual int SetCommInactivityTimeout (uint64_t value);
|
@@ -221,7 +221,6 @@ class ConnectionDescriptor: public EventableDescriptor
|
|
221
221
|
|
222
222
|
bool bNotifyReadable;
|
223
223
|
bool bNotifyWritable;
|
224
|
-
bool bWatchOnly;
|
225
224
|
|
226
225
|
bool bReadAttemptedAfterClose;
|
227
226
|
bool bWriteAttemptedAfterClose;
|
@@ -279,8 +278,8 @@ class DatagramDescriptor: public EventableDescriptor
|
|
279
278
|
// Do we have any data to write? This is used by ShouldDelete.
|
280
279
|
virtual int GetOutboundDataSize() {return OutboundDataSize;}
|
281
280
|
|
282
|
-
virtual bool GetPeername (struct sockaddr*);
|
283
|
-
virtual bool GetSockname (struct sockaddr*);
|
281
|
+
virtual bool GetPeername (struct sockaddr*, socklen_t*);
|
282
|
+
virtual bool GetSockname (struct sockaddr*, socklen_t*);
|
284
283
|
|
285
284
|
virtual uint64_t GetCommInactivityTimeout();
|
286
285
|
virtual int SetCommInactivityTimeout (uint64_t value);
|
@@ -319,7 +318,7 @@ class AcceptorDescriptor: public EventableDescriptor
|
|
319
318
|
virtual bool SelectForRead() {return true;}
|
320
319
|
virtual bool SelectForWrite() {return false;}
|
321
320
|
|
322
|
-
virtual bool GetSockname (struct sockaddr*);
|
321
|
+
virtual bool GetSockname (struct sockaddr*, socklen_t*);
|
323
322
|
|
324
323
|
static void StopAcceptor (const unsigned long binding);
|
325
324
|
};
|
data/ext/em.cpp
CHANGED
@@ -308,6 +308,10 @@ void EventMachine_t::_InitializeLoopBreaker()
|
|
308
308
|
|
309
309
|
LoopBreakerWriter = fd[1];
|
310
310
|
LoopBreakerReader = fd[0];
|
311
|
+
|
312
|
+
/* 16Jan11: Make sure the pipe is non-blocking, so more than 65k loopbreaks
|
313
|
+
* in one tick do not fill up the pipe and block the process on write() */
|
314
|
+
SetSocketNonblocking (LoopBreakerWriter);
|
311
315
|
#endif
|
312
316
|
|
313
317
|
#ifdef OS_WIN32
|
@@ -351,6 +355,7 @@ EventMachine_t::GetRealTime
|
|
351
355
|
uint64_t EventMachine_t::GetRealTime()
|
352
356
|
{
|
353
357
|
uint64_t current_time;
|
358
|
+
|
354
359
|
#if defined(OS_UNIX)
|
355
360
|
struct timeval tv;
|
356
361
|
gettimeofday (&tv, NULL);
|
@@ -362,10 +367,12 @@ uint64_t EventMachine_t::GetRealTime()
|
|
362
367
|
TickCountTickover += 1;
|
363
368
|
LastTickCount = tick;
|
364
369
|
current_time = ((uint64_t)TickCountTickover << 32) + (uint64_t)tick;
|
370
|
+
current_time *= 1000; // convert to microseconds
|
365
371
|
|
366
372
|
#else
|
367
373
|
current_time = (uint64_t)time(NULL) * 1000000LL;
|
368
374
|
#endif
|
375
|
+
|
369
376
|
return current_time;
|
370
377
|
}
|
371
378
|
|
@@ -578,6 +585,10 @@ bool EventMachine_t::_RunKqueueOnce()
|
|
578
585
|
|
579
586
|
timeval tv = _TimeTilNextEvent();
|
580
587
|
|
588
|
+
struct timespec ts;
|
589
|
+
ts.tv_sec = tv.tv_sec;
|
590
|
+
ts.tv_nsec = tv.tv_usec * 1000;
|
591
|
+
|
581
592
|
#ifdef BUILD_FOR_RUBY
|
582
593
|
int ret = 0;
|
583
594
|
fd_set fdreads;
|
@@ -594,12 +605,10 @@ bool EventMachine_t::_RunKqueueOnce()
|
|
594
605
|
}
|
595
606
|
|
596
607
|
TRAP_BEG;
|
597
|
-
|
608
|
+
ts.tv_sec = ts.tv_nsec = 0;
|
609
|
+
k = kevent (kqfd, NULL, 0, Karray, MaxEvents, &ts);
|
598
610
|
TRAP_END;
|
599
611
|
#else
|
600
|
-
struct timespec ts;
|
601
|
-
ts.tv_sec = tv.tv_sec;
|
602
|
-
ts.tv_nsec = tv.tv_usec * 1000;
|
603
612
|
k = kevent (kqfd, NULL, 0, Karray, MaxEvents, &ts);
|
604
613
|
#endif
|
605
614
|
|
@@ -1028,28 +1037,9 @@ const unsigned long EventMachine_t::InstallOneshotTimer (int milliseconds)
|
|
1028
1037
|
{
|
1029
1038
|
if (Timers.size() > MaxOutstandingTimers)
|
1030
1039
|
return false;
|
1031
|
-
// Don't use the global loop-time variable here, because we might
|
1032
|
-
// get called before the main event machine is running.
|
1033
1040
|
|
1034
|
-
|
1035
|
-
// understand if this is a bug or not? For OS_UNIX we multiply the argument
|
1036
|
-
// milliseconds by 1000, but for OS_WIN32 we do not? This needs to be sorted out.
|
1037
|
-
#ifdef OS_UNIX
|
1038
|
-
struct timeval tv;
|
1039
|
-
gettimeofday (&tv, NULL);
|
1040
|
-
uint64_t fire_at = (((uint64_t)(tv.tv_sec)) * 1000000LL) + ((uint64_t)(tv.tv_usec));
|
1041
|
+
uint64_t fire_at = GetRealTime();
|
1041
1042
|
fire_at += ((uint64_t)milliseconds) * 1000LL;
|
1042
|
-
#endif
|
1043
|
-
|
1044
|
-
#ifdef OS_WIN32
|
1045
|
-
unsigned tick = GetTickCount();
|
1046
|
-
if (tick < LastTickCount)
|
1047
|
-
TickCountTickover += 1;
|
1048
|
-
LastTickCount = tick;
|
1049
|
-
|
1050
|
-
uint64_t fire_at = ((uint64_t)TickCountTickover << 32) + (uint64_t)tick;
|
1051
|
-
fire_at += (uint64_t)milliseconds;
|
1052
|
-
#endif
|
1053
1043
|
|
1054
1044
|
Timer_t t;
|
1055
1045
|
#ifndef HAVE_MAKE_PAIR
|
data/ext/eventmachine.h
CHANGED
@@ -72,8 +72,8 @@ extern "C" {
|
|
72
72
|
void evma_accept_ssl_peer (const unsigned long binding);
|
73
73
|
#endif
|
74
74
|
|
75
|
-
int evma_get_peername (const unsigned long binding, struct sockaddr*);
|
76
|
-
int evma_get_sockname (const unsigned long binding, struct sockaddr*);
|
75
|
+
int evma_get_peername (const unsigned long binding, struct sockaddr*, socklen_t*);
|
76
|
+
int evma_get_sockname (const unsigned long binding, struct sockaddr*, socklen_t*);
|
77
77
|
int evma_get_subprocess_pid (const unsigned long binding, pid_t*);
|
78
78
|
int evma_get_subprocess_status (const unsigned long binding, int*);
|
79
79
|
int evma_get_connection_count();
|
data/ext/extconf.rb
CHANGED
data/ext/rubymain.cpp
CHANGED
@@ -341,9 +341,10 @@ t_get_peername
|
|
341
341
|
|
342
342
|
static VALUE t_get_peername (VALUE self, VALUE signature)
|
343
343
|
{
|
344
|
-
|
345
|
-
|
346
|
-
|
344
|
+
char buf[1024];
|
345
|
+
socklen_t len = sizeof buf;
|
346
|
+
if (evma_get_peername (NUM2ULONG (signature), (struct sockaddr*)buf, &len)) {
|
347
|
+
return rb_str_new (buf, len);
|
347
348
|
}
|
348
349
|
|
349
350
|
return Qnil;
|
@@ -355,9 +356,10 @@ t_get_sockname
|
|
355
356
|
|
356
357
|
static VALUE t_get_sockname (VALUE self, VALUE signature)
|
357
358
|
{
|
358
|
-
|
359
|
-
|
360
|
-
|
359
|
+
char buf[1024];
|
360
|
+
socklen_t len = sizeof buf;
|
361
|
+
if (evma_get_sockname (NUM2ULONG (signature), (struct sockaddr*)buf, &len)) {
|
362
|
+
return rb_str_new (buf, len);
|
361
363
|
}
|
362
364
|
|
363
365
|
return Qnil;
|
data/lib/em/connection.rb
CHANGED
@@ -405,7 +405,9 @@ module EventMachine
|
|
405
405
|
#
|
406
406
|
def send_datagram data, recipient_address, recipient_port
|
407
407
|
data = data.to_s
|
408
|
-
|
408
|
+
size = data.bytesize if data.respond_to?(:bytesize)
|
409
|
+
size ||= data.size
|
410
|
+
EventMachine::send_datagram @signature, data, size, recipient_address, Integer(recipient_port)
|
409
411
|
end
|
410
412
|
|
411
413
|
|
data/lib/em/pure_ruby.rb
CHANGED
@@ -34,7 +34,7 @@ require 'socket'
|
|
34
34
|
require 'fcntl'
|
35
35
|
require 'set'
|
36
36
|
|
37
|
-
module EventMachine
|
37
|
+
module EventMachine #:nodoc: all
|
38
38
|
class << self
|
39
39
|
# This is mostly useful for automated tests.
|
40
40
|
# Return a distinctive symbol so the caller knows whether he's dealing
|
@@ -208,7 +208,7 @@ end
|
|
208
208
|
|
209
209
|
#-----------------------------------------------------------------
|
210
210
|
|
211
|
-
module EventMachine
|
211
|
+
module EventMachine #:nodoc: all
|
212
212
|
|
213
213
|
class Error < Exception; end
|
214
214
|
|
@@ -216,7 +216,7 @@ end
|
|
216
216
|
|
217
217
|
#-----------------------------------------------------------------
|
218
218
|
|
219
|
-
module EventMachine
|
219
|
+
module EventMachine #:nodoc: all
|
220
220
|
class Connection
|
221
221
|
def get_outbound_data_size
|
222
222
|
EventMachine::get_outbound_data_size @signature
|
@@ -226,7 +226,7 @@ end
|
|
226
226
|
|
227
227
|
#-----------------------------------------------------------------
|
228
228
|
|
229
|
-
module EventMachine
|
229
|
+
module EventMachine #:nodoc: all
|
230
230
|
|
231
231
|
# Factored out so we can substitute other implementations
|
232
232
|
# here if desired, such as the one in ActiveRBAC.
|
@@ -243,7 +243,7 @@ end
|
|
243
243
|
|
244
244
|
#-----------------------------------------------------------------
|
245
245
|
|
246
|
-
module EventMachine
|
246
|
+
module EventMachine #:nodoc: all
|
247
247
|
|
248
248
|
TimerFired = 100
|
249
249
|
ConnectionData = 101
|
@@ -256,7 +256,7 @@ end
|
|
256
256
|
|
257
257
|
#-----------------------------------------------------------------
|
258
258
|
|
259
|
-
module EventMachine
|
259
|
+
module EventMachine #:nodoc: all
|
260
260
|
class Reactor
|
261
261
|
include Singleton
|
262
262
|
|
@@ -414,7 +414,7 @@ end
|
|
414
414
|
|
415
415
|
#--------------------------------------------------------------
|
416
416
|
|
417
|
-
class IO
|
417
|
+
class IO #:nodoc: all
|
418
418
|
extend Forwardable
|
419
419
|
def_delegator :@my_selectable, :close_scheduled?
|
420
420
|
def_delegator :@my_selectable, :select_for_reading?
|
@@ -433,7 +433,7 @@ end
|
|
433
433
|
|
434
434
|
#--------------------------------------------------------------
|
435
435
|
|
436
|
-
module EventMachine
|
436
|
+
module EventMachine #:nodoc: all
|
437
437
|
class Selectable
|
438
438
|
|
439
439
|
attr_reader :io, :uuid
|
@@ -494,7 +494,7 @@ end
|
|
494
494
|
#--------------------------------------------------------------
|
495
495
|
|
496
496
|
|
497
|
-
module EventMachine
|
497
|
+
module EventMachine #:nodoc: all
|
498
498
|
|
499
499
|
class StreamObject < Selectable
|
500
500
|
def initialize io
|
@@ -636,7 +636,7 @@ end
|
|
636
636
|
|
637
637
|
|
638
638
|
|
639
|
-
module EventMachine
|
639
|
+
module EventMachine #:nodoc: all
|
640
640
|
class EvmaTCPClient < StreamObject
|
641
641
|
|
642
642
|
def self.connect bind_addr, bind_port, host, port
|
@@ -687,7 +687,7 @@ end
|
|
687
687
|
|
688
688
|
|
689
689
|
|
690
|
-
module EventMachine
|
690
|
+
module EventMachine #:nodoc: all
|
691
691
|
class EvmaKeyboard < StreamObject
|
692
692
|
|
693
693
|
def self.open
|
@@ -717,7 +717,7 @@ end
|
|
717
717
|
|
718
718
|
|
719
719
|
|
720
|
-
module EventMachine
|
720
|
+
module EventMachine #:nodoc: all
|
721
721
|
class EvmaUNIXClient < StreamObject
|
722
722
|
|
723
723
|
def self.connect chain
|
@@ -765,7 +765,7 @@ end
|
|
765
765
|
|
766
766
|
#--------------------------------------------------------------
|
767
767
|
|
768
|
-
module EventMachine
|
768
|
+
module EventMachine #:nodoc: all
|
769
769
|
class EvmaTCPServer < Selectable
|
770
770
|
|
771
771
|
# TODO, refactor and unify with EvmaUNIXServer.
|
@@ -820,7 +820,7 @@ end
|
|
820
820
|
|
821
821
|
#--------------------------------------------------------------
|
822
822
|
|
823
|
-
module EventMachine
|
823
|
+
module EventMachine #:nodoc: all
|
824
824
|
class EvmaUNIXServer < Selectable
|
825
825
|
|
826
826
|
# TODO, refactor and unify with EvmaTCPServer.
|
@@ -876,7 +876,7 @@ end
|
|
876
876
|
|
877
877
|
#--------------------------------------------------------------
|
878
878
|
|
879
|
-
module EventMachine
|
879
|
+
module EventMachine #:nodoc: all
|
880
880
|
class LoopbreakReader < Selectable
|
881
881
|
|
882
882
|
def select_for_reading?
|
@@ -894,7 +894,7 @@ end
|
|
894
894
|
#--------------------------------------------------------------
|
895
895
|
|
896
896
|
|
897
|
-
module EventMachine
|
897
|
+
module EventMachine #:nodoc: all
|
898
898
|
|
899
899
|
class DatagramObject < Selectable
|
900
900
|
def initialize io
|
@@ -941,7 +941,7 @@ end
|
|
941
941
|
|
942
942
|
#--------------------------------------------------------------
|
943
943
|
|
944
|
-
module EventMachine
|
944
|
+
module EventMachine #:nodoc: all
|
945
945
|
class EvmaUDPSocket < DatagramObject
|
946
946
|
|
947
947
|
class << self
|