eventmachine 1.0.6-java → 1.0.7-java
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +1 -0
- data/CHANGELOG.md +6 -0
- data/ext/cmain.cpp +15 -1
- data/ext/ed.cpp +2 -1
- data/ext/em.cpp +67 -34
- data/ext/em.h +16 -5
- data/ext/eventmachine.h +2 -0
- data/ext/extconf.rb +1 -0
- data/ext/rubymain.cpp +17 -0
- data/lib/em/protocols/httpclient.rb +2 -0
- data/lib/em/version.rb +1 -1
- data/lib/eventmachine.rb +4 -1
- data/tests/test_completion.rb +1 -0
- data/tests/test_pool.rb +2 -0
- data/tests/test_resolver.rb +4 -4
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b93017d412c61150a4d664be575d7ce87907d5ed
|
4
|
+
data.tar.gz: bd2358d58e8b21db9cdcd962651a674fb9eb607e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f1f260562d40ed19f4a483080840de34afc7df80d5c31c184e6c52ebf8000596f63d076590a94cc9164922e3d201b24639850f16eae109d2f6af80b72b6eccea
|
7
|
+
data.tar.gz: b521218d7da6dadc59f531932f0e7e03983f326a3bda6ce8728b4b0a052f0a92117de3745a57f539d4fba782b23beebf55f2b30672ccff930ba5db4475f24996
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,11 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## 1.0.7 (February 10, 2015)
|
4
|
+
* fix delay in kqueue/epoll reactor shutdown when timers exist [#587]
|
5
|
+
* fix memory leak introduced in v1.0.5 [#586]
|
6
|
+
* expose EM.set_simultaneous_accept_count [#420]
|
7
|
+
* fix busy loop when EM.run and EM.next_tick are invoked from exception handler [#452]
|
8
|
+
|
3
9
|
## 1.0.6 (February 3, 2015)
|
4
10
|
* add support for Rubinius Process::Status [#568]
|
5
11
|
* small bugfixes for SmtpServer [#449]
|
data/ext/cmain.cpp
CHANGED
@@ -653,7 +653,6 @@ extern "C" int evma_get_max_timer_count()
|
|
653
653
|
return EventMachine_t::GetMaxTimerCount();
|
654
654
|
}
|
655
655
|
|
656
|
-
|
657
656
|
/************************
|
658
657
|
evma_set_max_timer_count
|
659
658
|
************************/
|
@@ -671,6 +670,21 @@ extern "C" void evma_set_max_timer_count (int ct)
|
|
671
670
|
EventMachine_t::SetMaxTimerCount (ct);
|
672
671
|
}
|
673
672
|
|
673
|
+
/******************
|
674
|
+
evma_get/set_simultaneous_accept_count
|
675
|
+
******************/
|
676
|
+
|
677
|
+
extern "C" void evma_set_simultaneous_accept_count (int count)
|
678
|
+
{
|
679
|
+
EventMachine_t::SetSimultaneousAcceptCount(count);
|
680
|
+
}
|
681
|
+
|
682
|
+
extern "C" int evma_get_simultaneous_accept_count()
|
683
|
+
{
|
684
|
+
return EventMachine_t::GetSimultaneousAcceptCount();
|
685
|
+
}
|
686
|
+
|
687
|
+
|
674
688
|
/******************
|
675
689
|
evma_setuid_string
|
676
690
|
******************/
|
data/ext/ed.cpp
CHANGED
@@ -1431,8 +1431,9 @@ void AcceptorDescriptor::Read()
|
|
1431
1431
|
|
1432
1432
|
struct sockaddr_in pin;
|
1433
1433
|
socklen_t addrlen = sizeof (pin);
|
1434
|
+
int accept_count = EventMachine_t::GetSimultaneousAcceptCount();
|
1434
1435
|
|
1435
|
-
for (int i=0; i <
|
1436
|
+
for (int i=0; i < accept_count; i++) {
|
1436
1437
|
int sd = accept (GetSocket(), (struct sockaddr*)&pin, &addrlen);
|
1437
1438
|
if (sd == INVALID_SOCKET) {
|
1438
1439
|
// This breaks the loop when we've accepted everything on the kernel queue,
|
data/ext/em.cpp
CHANGED
@@ -27,6 +27,11 @@ See the file COPYING for complete licensing information.
|
|
27
27
|
*/
|
28
28
|
static unsigned int MaxOutstandingTimers = 100000;
|
29
29
|
|
30
|
+
/* The number of accept() done at once in a single tick when the acceptor
|
31
|
+
* socket becomes readable.
|
32
|
+
*/
|
33
|
+
static unsigned int SimultaneousAcceptCount = 10;
|
34
|
+
|
30
35
|
|
31
36
|
/* Internal helper to convert strings to internet addresses. IPv6-aware.
|
32
37
|
* Not reentrant or threadsafe, optimized for speed.
|
@@ -61,6 +66,17 @@ void EventMachine_t::SetMaxTimerCount (int count)
|
|
61
66
|
MaxOutstandingTimers = count;
|
62
67
|
}
|
63
68
|
|
69
|
+
int EventMachine_t::GetSimultaneousAcceptCount()
|
70
|
+
{
|
71
|
+
return SimultaneousAcceptCount;
|
72
|
+
}
|
73
|
+
|
74
|
+
void EventMachine_t::SetSimultaneousAcceptCount (int count)
|
75
|
+
{
|
76
|
+
if (count < 1)
|
77
|
+
count = 1;
|
78
|
+
SimultaneousAcceptCount = count;
|
79
|
+
}
|
64
80
|
|
65
81
|
|
66
82
|
/******************************
|
@@ -68,12 +84,12 @@ EventMachine_t::EventMachine_t
|
|
68
84
|
******************************/
|
69
85
|
|
70
86
|
EventMachine_t::EventMachine_t (EMCallback event_callback):
|
87
|
+
NumCloseScheduled (0),
|
71
88
|
HeartbeatInterval(2000000),
|
72
89
|
EventCallback (event_callback),
|
73
90
|
NextHeartbeatTime (0),
|
74
91
|
LoopBreakerReader (-1),
|
75
92
|
LoopBreakerWriter (-1),
|
76
|
-
NumCloseScheduled (0),
|
77
93
|
bTerminateSignalReceived (false),
|
78
94
|
bEpoll (false),
|
79
95
|
epfd (-1),
|
@@ -106,6 +122,7 @@ EventMachine_t::EventMachine_t (EMCallback event_callback):
|
|
106
122
|
#endif
|
107
123
|
|
108
124
|
_InitializeLoopBreaker();
|
125
|
+
SelectData = new SelectData_t();
|
109
126
|
}
|
110
127
|
|
111
128
|
|
@@ -135,6 +152,8 @@ EventMachine_t::~EventMachine_t()
|
|
135
152
|
close (epfd);
|
136
153
|
if (kqfd != -1)
|
137
154
|
close (kqfd);
|
155
|
+
|
156
|
+
delete SelectData;
|
138
157
|
}
|
139
158
|
|
140
159
|
|
@@ -192,6 +211,12 @@ void EventMachine_t::ScheduleHalt()
|
|
192
211
|
* The answer is to call evma_stop_machine, which calls here, from a SIGINT handler.
|
193
212
|
*/
|
194
213
|
bTerminateSignalReceived = true;
|
214
|
+
|
215
|
+
/* Signal the loopbreaker so we break out of long-running select/epoll/kqueue and
|
216
|
+
* notice the halt boolean is set. Signalling the loopbreaker also uses a single
|
217
|
+
* signal-safe syscall.
|
218
|
+
*/
|
219
|
+
SignalLoopBreaker();
|
195
220
|
}
|
196
221
|
|
197
222
|
|
@@ -576,12 +601,12 @@ void EventMachine_t::_RunEpollOnce()
|
|
576
601
|
#ifdef HAVE_RB_WAIT_FOR_SINGLE_FD
|
577
602
|
if ((ret = rb_wait_for_single_fd(epfd, RB_WAITFD_IN|RB_WAITFD_PRI, &tv)) < 1) {
|
578
603
|
#else
|
579
|
-
|
604
|
+
fd_set fdreads;
|
580
605
|
|
581
|
-
|
582
|
-
|
606
|
+
FD_ZERO(&fdreads);
|
607
|
+
FD_SET(epfd, &fdreads);
|
583
608
|
|
584
|
-
if ((ret =
|
609
|
+
if ((ret = rb_thread_select(epfd + 1, &fdreads, NULL, NULL, &tv)) < 1) {
|
585
610
|
#endif
|
586
611
|
if (ret == -1) {
|
587
612
|
assert(errno != EINVAL);
|
@@ -653,12 +678,12 @@ void EventMachine_t::_RunKqueueOnce()
|
|
653
678
|
#ifdef HAVE_RB_WAIT_FOR_SINGLE_FD
|
654
679
|
if ((ret = rb_wait_for_single_fd(kqfd, RB_WAITFD_IN|RB_WAITFD_PRI, &tv)) < 1) {
|
655
680
|
#else
|
656
|
-
|
681
|
+
fd_set fdreads;
|
657
682
|
|
658
|
-
|
659
|
-
|
683
|
+
FD_ZERO(&fdreads);
|
684
|
+
FD_SET(kqfd, &fdreads);
|
660
685
|
|
661
|
-
if ((ret =
|
686
|
+
if ((ret = rb_thread_select(kqfd + 1, &fdreads, NULL, NULL, &tv)) < 1) {
|
662
687
|
#endif
|
663
688
|
if (ret == -1) {
|
664
689
|
assert(errno != EINVAL);
|
@@ -851,6 +876,12 @@ SelectData_t::SelectData_t()
|
|
851
876
|
rb_fd_init (&fderrors);
|
852
877
|
}
|
853
878
|
|
879
|
+
SelectData_t::~SelectData_t()
|
880
|
+
{
|
881
|
+
rb_fd_term (&fdreads);
|
882
|
+
rb_fd_term (&fdwrites);
|
883
|
+
rb_fd_term (&fderrors);
|
884
|
+
}
|
854
885
|
|
855
886
|
#ifdef BUILD_FOR_RUBY
|
856
887
|
/*****************
|
@@ -861,7 +892,7 @@ _SelectDataSelect
|
|
861
892
|
static VALUE _SelectDataSelect (void *v)
|
862
893
|
{
|
863
894
|
SelectData_t *sd = (SelectData_t*)v;
|
864
|
-
sd->nSockets =
|
895
|
+
sd->nSockets = select (sd->maxsocket+1, rb_fd_ptr(&(sd->fdreads)), rb_fd_ptr(&(sd->fdwrites)), rb_fd_ptr(&(sd->fderrors)), &(sd->tv));
|
865
896
|
return Qnil;
|
866
897
|
}
|
867
898
|
#endif
|
@@ -873,9 +904,11 @@ SelectData_t::_Select
|
|
873
904
|
int SelectData_t::_Select()
|
874
905
|
{
|
875
906
|
#if defined(HAVE_RB_THREAD_CALL_WITHOUT_GVL)
|
907
|
+
// added in ruby 1.9.3
|
876
908
|
rb_thread_call_without_gvl ((void *(*)(void *))_SelectDataSelect, (void*)this, RUBY_UBF_IO, 0);
|
877
909
|
return nSockets;
|
878
910
|
#elif defined(HAVE_TBR)
|
911
|
+
// added in ruby 1.9.1, deprecated in ruby 2.0.0
|
879
912
|
rb_thread_blocking_region (_SelectDataSelect, (void*)this, RUBY_UBF_IO, 0);
|
880
913
|
return nSockets;
|
881
914
|
#else
|
@@ -884,7 +917,13 @@ int SelectData_t::_Select()
|
|
884
917
|
}
|
885
918
|
#endif
|
886
919
|
|
887
|
-
|
920
|
+
void SelectData_t::_Clear()
|
921
|
+
{
|
922
|
+
maxsocket = 0;
|
923
|
+
rb_fd_zero (&fdreads);
|
924
|
+
rb_fd_zero (&fdwrites);
|
925
|
+
rb_fd_zero (&fderrors);
|
926
|
+
}
|
888
927
|
|
889
928
|
/******************************
|
890
929
|
EventMachine_t::_RunSelectOnce
|
@@ -901,23 +940,17 @@ void EventMachine_t::_RunSelectOnce()
|
|
901
940
|
// however it has the same problem interoperating with Ruby
|
902
941
|
// threads that select does.
|
903
942
|
|
904
|
-
|
905
|
-
|
906
|
-
rb_fdset_t fdreads, fdwrites;
|
907
|
-
rb_fd_init (&fdreads);
|
908
|
-
rb_fd_init (&fdwrites);
|
909
|
-
|
910
|
-
int maxsocket = 0;
|
911
|
-
*/
|
943
|
+
// Get ready for select()
|
944
|
+
SelectData->_Clear();
|
912
945
|
|
913
946
|
// Always read the loop-breaker reader.
|
914
947
|
// Changed 23Aug06, provisionally implemented for Windows with a UDP socket
|
915
948
|
// running on localhost with a randomly-chosen port. (*Puke*)
|
916
949
|
// Windows has a version of the Unix pipe() library function, but it doesn't
|
917
950
|
// give you back descriptors that are selectable.
|
918
|
-
rb_fd_set (LoopBreakerReader, &(SelectData
|
919
|
-
if (SelectData
|
920
|
-
SelectData
|
951
|
+
rb_fd_set (LoopBreakerReader, &(SelectData->fdreads));
|
952
|
+
if (SelectData->maxsocket < LoopBreakerReader)
|
953
|
+
SelectData->maxsocket = LoopBreakerReader;
|
921
954
|
|
922
955
|
// prepare the sockets for reading and writing
|
923
956
|
size_t i;
|
@@ -930,28 +963,28 @@ void EventMachine_t::_RunSelectOnce()
|
|
930
963
|
assert (sd != INVALID_SOCKET);
|
931
964
|
|
932
965
|
if (ed->SelectForRead())
|
933
|
-
rb_fd_set (sd, &(SelectData
|
966
|
+
rb_fd_set (sd, &(SelectData->fdreads));
|
934
967
|
if (ed->SelectForWrite())
|
935
|
-
rb_fd_set (sd, &(SelectData
|
968
|
+
rb_fd_set (sd, &(SelectData->fdwrites));
|
936
969
|
|
937
970
|
#ifdef OS_WIN32
|
938
971
|
/* 21Sep09: on windows, a non-blocking connect() that fails does not come up as writable.
|
939
972
|
Instead, it is added to the error set. See http://www.mail-archive.com/openssl-users@openssl.org/msg58500.html
|
940
973
|
*/
|
941
974
|
if (ed->IsConnectPending())
|
942
|
-
rb_fd_set (sd, &(SelectData
|
975
|
+
rb_fd_set (sd, &(SelectData->fderrors));
|
943
976
|
#endif
|
944
977
|
|
945
|
-
if (SelectData
|
946
|
-
SelectData
|
978
|
+
if (SelectData->maxsocket < sd)
|
979
|
+
SelectData->maxsocket = sd;
|
947
980
|
}
|
948
981
|
|
949
982
|
|
950
983
|
{ // read and write the sockets
|
951
984
|
//timeval tv = {1, 0}; // Solaris fails if the microseconds member is >= 1000000.
|
952
985
|
//timeval tv = Quantum;
|
953
|
-
SelectData
|
954
|
-
int s = SelectData
|
986
|
+
SelectData->tv = _TimeTilNextEvent();
|
987
|
+
int s = SelectData->_Select();
|
955
988
|
//rb_thread_blocking_region(xxx,(void*)&SelectData,RUBY_UBF_IO,0);
|
956
989
|
//int s = EmSelect (SelectData.maxsocket+1, &(SelectData.fdreads), &(SelectData.fdwrites), NULL, &(SelectData.tv));
|
957
990
|
//int s = SelectData.nSockets;
|
@@ -974,19 +1007,19 @@ void EventMachine_t::_RunSelectOnce()
|
|
974
1007
|
continue;
|
975
1008
|
assert (sd != INVALID_SOCKET);
|
976
1009
|
|
977
|
-
if (rb_fd_isset (sd, &(SelectData
|
1010
|
+
if (rb_fd_isset (sd, &(SelectData->fdwrites))) {
|
978
1011
|
// Double-check SelectForWrite() still returns true. If not, one of the callbacks must have
|
979
1012
|
// modified some value since we checked SelectForWrite() earlier in this method.
|
980
1013
|
if (ed->SelectForWrite())
|
981
1014
|
ed->Write();
|
982
1015
|
}
|
983
|
-
if (rb_fd_isset (sd, &(SelectData
|
1016
|
+
if (rb_fd_isset (sd, &(SelectData->fdreads)))
|
984
1017
|
ed->Read();
|
985
|
-
if (rb_fd_isset (sd, &(SelectData
|
1018
|
+
if (rb_fd_isset (sd, &(SelectData->fderrors)))
|
986
1019
|
ed->HandleError();
|
987
1020
|
}
|
988
1021
|
|
989
|
-
if (rb_fd_isset (LoopBreakerReader, &(SelectData
|
1022
|
+
if (rb_fd_isset (LoopBreakerReader, &(SelectData->fdreads)))
|
990
1023
|
_ReadLoopBreaker();
|
991
1024
|
}
|
992
1025
|
else if (s < 0) {
|
@@ -1029,6 +1062,7 @@ void EventMachine_t::_CleanBadDescriptors()
|
|
1029
1062
|
rb_fd_set(sd, &fds);
|
1030
1063
|
|
1031
1064
|
int ret = rb_fd_select(sd + 1, &fds, NULL, NULL, &tv);
|
1065
|
+
rb_fd_term(&fds);
|
1032
1066
|
|
1033
1067
|
if (ret == -1) {
|
1034
1068
|
if (errno == EBADF)
|
@@ -2353,4 +2387,3 @@ int EventMachine_t::SetHeartbeatInterval(float interval)
|
|
2353
2387
|
return 0;
|
2354
2388
|
}
|
2355
2389
|
//#endif // OS_UNIX
|
2356
|
-
|
data/ext/em.h
CHANGED
@@ -22,7 +22,12 @@ See the file COPYING for complete licensing information.
|
|
22
22
|
|
23
23
|
#ifdef BUILD_FOR_RUBY
|
24
24
|
#include <ruby.h>
|
25
|
-
#
|
25
|
+
#ifdef HAVE_RB_THREAD_FD_SELECT
|
26
|
+
#define EmSelect rb_thread_fd_select
|
27
|
+
#else
|
28
|
+
// ruby 1.9.1 and below
|
29
|
+
#define EmSelect rb_thread_select
|
30
|
+
#endif
|
26
31
|
|
27
32
|
#ifdef HAVE_RB_THREAD_CALL_WITHOUT_GVL
|
28
33
|
#include <ruby/thread.h>
|
@@ -61,10 +66,10 @@ See the file COPYING for complete licensing information.
|
|
61
66
|
#define RSTRING_LENINT(str) RSTRING_LEN(str)
|
62
67
|
#endif
|
63
68
|
#else
|
64
|
-
#define EmSelect
|
69
|
+
#define EmSelect select
|
65
70
|
#endif
|
66
71
|
|
67
|
-
#
|
72
|
+
#if !defined(HAVE_RB_FDSET_T)
|
68
73
|
#define fd_check(n) (((n) < FD_SETSIZE) ? 1 : 0*fprintf(stderr, "fd %d too large for select\n", (n)))
|
69
74
|
// These definitions are cribbed from include/ruby/intern.h in Ruby 1.9.3,
|
70
75
|
// with this change: any macros that read or write the nth element of an
|
@@ -90,7 +95,7 @@ typedef fd_set rb_fdset_t;
|
|
90
95
|
|
91
96
|
class EventableDescriptor;
|
92
97
|
class InotifyDescriptor;
|
93
|
-
|
98
|
+
struct SelectData_t;
|
94
99
|
|
95
100
|
/********************
|
96
101
|
class EventMachine_t
|
@@ -102,6 +107,9 @@ class EventMachine_t
|
|
102
107
|
static int GetMaxTimerCount();
|
103
108
|
static void SetMaxTimerCount (int);
|
104
109
|
|
110
|
+
static int GetSimultaneousAcceptCount();
|
111
|
+
static void SetSimultaneousAcceptCount (int);
|
112
|
+
|
105
113
|
public:
|
106
114
|
EventMachine_t (EMCallback);
|
107
115
|
virtual ~EventMachine_t();
|
@@ -194,7 +202,7 @@ class EventMachine_t
|
|
194
202
|
public:
|
195
203
|
void _ReadLoopBreaker();
|
196
204
|
void _ReadInotifyEvents();
|
197
|
-
|
205
|
+
int NumCloseScheduled;
|
198
206
|
|
199
207
|
private:
|
200
208
|
enum {
|
@@ -238,6 +246,7 @@ class EventMachine_t
|
|
238
246
|
|
239
247
|
private:
|
240
248
|
bool bTerminateSignalReceived;
|
249
|
+
SelectData_t *SelectData;
|
241
250
|
|
242
251
|
bool bEpoll;
|
243
252
|
int epfd; // Epoll file-descriptor
|
@@ -262,8 +271,10 @@ struct SelectData_t
|
|
262
271
|
struct SelectData_t
|
263
272
|
{
|
264
273
|
SelectData_t();
|
274
|
+
~SelectData_t();
|
265
275
|
|
266
276
|
int _Select();
|
277
|
+
void _Clear();
|
267
278
|
|
268
279
|
int maxsocket;
|
269
280
|
rb_fdset_t fdreads;
|
data/ext/eventmachine.h
CHANGED
@@ -96,6 +96,8 @@ extern "C" {
|
|
96
96
|
void evma_set_timer_quantum (int);
|
97
97
|
int evma_get_max_timer_count();
|
98
98
|
void evma_set_max_timer_count (int);
|
99
|
+
int evma_get_simultaneous_accept_count();
|
100
|
+
void evma_set_simultaneous_accept_count (int);
|
99
101
|
void evma_setuid_string (const char *username);
|
100
102
|
void evma_stop_machine();
|
101
103
|
float evma_get_heartbeat_interval();
|
data/ext/extconf.rb
CHANGED
@@ -75,6 +75,7 @@ add_define "HAVE_INOTIFY" if inotify = have_func('inotify_init', 'sys/inotify.h'
|
|
75
75
|
add_define "HAVE_OLD_INOTIFY" if !inotify && have_macro('__NR_inotify_init', 'sys/syscall.h')
|
76
76
|
add_define 'HAVE_WRITEV' if have_func('writev', 'sys/uio.h')
|
77
77
|
add_define 'HAVE_RB_THREAD_FD_SELECT' if have_func('rb_thread_fd_select')
|
78
|
+
add_define 'HAVE_RB_FDSET_T' if have_type('rb_fdset_t', 'ruby/intern.h')
|
78
79
|
|
79
80
|
have_func('rb_wait_for_single_fd')
|
80
81
|
have_func('rb_enable_interrupt')
|
data/ext/rubymain.cpp
CHANGED
@@ -813,6 +813,21 @@ static VALUE t_set_max_timer_count (VALUE self, VALUE ct)
|
|
813
813
|
return Qnil;
|
814
814
|
}
|
815
815
|
|
816
|
+
/********************
|
817
|
+
t_get/set_simultaneous_accept_count
|
818
|
+
********************/
|
819
|
+
|
820
|
+
static VALUE t_get_simultaneous_accept_count (VALUE self)
|
821
|
+
{
|
822
|
+
return INT2FIX (evma_get_simultaneous_accept_count());
|
823
|
+
}
|
824
|
+
|
825
|
+
static VALUE t_set_simultaneous_accept_count (VALUE self, VALUE ct)
|
826
|
+
{
|
827
|
+
evma_set_simultaneous_accept_count (FIX2INT (ct));
|
828
|
+
return Qnil;
|
829
|
+
}
|
830
|
+
|
816
831
|
/***************
|
817
832
|
t_setuid_string
|
818
833
|
***************/
|
@@ -1290,6 +1305,8 @@ extern "C" void Init_rubyeventmachine()
|
|
1290
1305
|
rb_define_module_function (EmModule, "set_timer_quantum", (VALUE(*)(...))t_set_timer_quantum, 1);
|
1291
1306
|
rb_define_module_function (EmModule, "get_max_timer_count", (VALUE(*)(...))t_get_max_timer_count, 0);
|
1292
1307
|
rb_define_module_function (EmModule, "set_max_timer_count", (VALUE(*)(...))t_set_max_timer_count, 1);
|
1308
|
+
rb_define_module_function (EmModule, "get_simultaneous_accept_count", (VALUE(*)(...))t_get_simultaneous_accept_count, 0);
|
1309
|
+
rb_define_module_function (EmModule, "set_simultaneous_accept_count", (VALUE(*)(...))t_set_simultaneous_accept_count, 1);
|
1293
1310
|
rb_define_module_function (EmModule, "setuid_string", (VALUE(*)(...))t_setuid_string, 1);
|
1294
1311
|
rb_define_module_function (EmModule, "invoke_popen", (VALUE(*)(...))t_invoke_popen, 1);
|
1295
1312
|
rb_define_module_function (EmModule, "send_file_data", (VALUE(*)(...))t_send_file_data, 2);
|
data/lib/em/version.rb
CHANGED
data/lib/eventmachine.rb
CHANGED
@@ -966,13 +966,16 @@ module EventMachine
|
|
966
966
|
callback = @next_tick_mutex.synchronize { @next_tick_queue.shift }
|
967
967
|
begin
|
968
968
|
callback.call
|
969
|
+
rescue
|
970
|
+
exception_raised = true
|
971
|
+
raise
|
969
972
|
ensure
|
970
973
|
# This is a little nasty. The problem is, if an exception occurs during
|
971
974
|
# the callback, then we need to send a signal to the reactor to actually
|
972
975
|
# do some work during the next_tick. The only mechanism we have from the
|
973
976
|
# ruby side is next_tick itself, although ideally, we'd just drop a byte
|
974
977
|
# on the loopback descriptor.
|
975
|
-
EM.next_tick {} if
|
978
|
+
EM.next_tick {} if exception_raised
|
976
979
|
end
|
977
980
|
end
|
978
981
|
end
|
data/tests/test_completion.rb
CHANGED
data/tests/test_pool.rb
CHANGED
data/tests/test_resolver.rb
CHANGED
@@ -30,11 +30,11 @@ class TestResolver < Test::Unit::TestCase
|
|
30
30
|
|
31
31
|
def test_a_pair
|
32
32
|
EM.run {
|
33
|
-
d = EM::DNS::Resolver.resolve "
|
34
|
-
d.errback { assert false }
|
33
|
+
d = EM::DNS::Resolver.resolve "yahoo.com"
|
34
|
+
d.errback { |err| assert false, "failed to resolve yahoo.com: #{err}" }
|
35
35
|
d.callback { |r|
|
36
36
|
assert_kind_of(Array, r)
|
37
|
-
assert r.size > 1
|
37
|
+
assert r.size > 1, "returned #{r.size} results: #{r.inspect}"
|
38
38
|
EM.stop
|
39
39
|
}
|
40
40
|
}
|
@@ -56,7 +56,7 @@ class TestResolver < Test::Unit::TestCase
|
|
56
56
|
def test_timer_cleanup
|
57
57
|
EM.run {
|
58
58
|
d = EM::DNS::Resolver.resolve "google.com"
|
59
|
-
d.errback { assert false }
|
59
|
+
d.errback { |err| assert false, "failed to resolve google.com: #{err}" }
|
60
60
|
d.callback { |r|
|
61
61
|
# This isn't a great test, but it's hard to get more canonical
|
62
62
|
# confirmation that the timer is cancelled
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: eventmachine
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.7
|
5
5
|
platform: java
|
6
6
|
authors:
|
7
7
|
- Francis Cianfrocca
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-02-
|
12
|
+
date: 2015-02-10 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: test-unit
|