rev 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES +11 -1
- data/README +10 -2
- data/ext/http11_client/http11_parser.c +256 -966
- data/ext/http11_client/http11_parser.rl +3 -3
- data/ext/libev/Changes +21 -0
- data/ext/libev/LICENSE +12 -1
- data/ext/libev/README +39 -111
- data/ext/libev/ev.c +495 -115
- data/ext/libev/ev.h +17 -5
- data/ext/libev/ev_epoll.c +1 -1
- data/ext/libev/ev_kqueue.c +1 -1
- data/ext/libev/ev_poll.c +1 -1
- data/ext/libev/ev_port.c +1 -1
- data/ext/libev/ev_select.c +25 -8
- data/ext/libev/ev_vars.h +2 -2
- data/ext/libev/ev_win32.c +1 -1
- data/ext/rev/rev_buffer.c +6 -4
- data/lib/rev.rb +1 -1
- data/lib/rev/io.rb +1 -1
- data/lib/rev/socket.rb +2 -0
- data/rev.gemspec +1 -1
- metadata +1 -1
data/ext/libev/ev.h
CHANGED
@@ -166,6 +166,15 @@ struct ev_loop;
|
|
166
166
|
* private: you can look at them, but not change them, and they might not mean anything to you.
|
167
167
|
* ro: can be read anytime, but only changed when the watcher isn't active
|
168
168
|
* rw: can be read and modified anytime, even when the watcher is active
|
169
|
+
*
|
170
|
+
* some internal details that might be helpful for debugging:
|
171
|
+
*
|
172
|
+
* active is either 0, which means the watcher is not active,
|
173
|
+
* or the array index of the watcher (periodics, timers)
|
174
|
+
* or the array index + 1 (most other watchers)
|
175
|
+
* or simply 1 for watchers that aren't in some array.
|
176
|
+
* pending is either 0, in which case the watcher isn't,
|
177
|
+
* or the array index + 1 in the pendings array.
|
169
178
|
*/
|
170
179
|
|
171
180
|
/* shared by all watchers */
|
@@ -410,7 +419,7 @@ void ev_set_allocator (void *(*cb)(void *ptr, long size));
|
|
410
419
|
*/
|
411
420
|
void ev_set_syserr_cb (void (*cb)(const char *msg));
|
412
421
|
|
413
|
-
#
|
422
|
+
#if EV_MULTIPLICITY
|
414
423
|
EV_INLINE struct ev_loop *
|
415
424
|
ev_default_loop_uc (void)
|
416
425
|
{
|
@@ -440,10 +449,11 @@ ev_default_loop (unsigned int flags)
|
|
440
449
|
struct ev_loop *ev_loop_new (unsigned int flags);
|
441
450
|
void ev_loop_destroy (EV_P);
|
442
451
|
void ev_loop_fork (EV_P);
|
452
|
+
void ev_loop_verify (EV_P);
|
443
453
|
|
444
454
|
ev_tstamp ev_now (EV_P); /* time w.r.t. timers and the eventloop, updated after each poll */
|
445
455
|
|
446
|
-
#
|
456
|
+
#else
|
447
457
|
|
448
458
|
int ev_default_loop (unsigned int flags); /* returns true when successful */
|
449
459
|
|
@@ -454,7 +464,7 @@ ev_now (void)
|
|
454
464
|
|
455
465
|
return ev_rt_now;
|
456
466
|
}
|
457
|
-
#
|
467
|
+
#endif /* multiplicity */
|
458
468
|
|
459
469
|
EV_INLINE int
|
460
470
|
ev_is_default_loop (EV_P)
|
@@ -477,7 +487,7 @@ void ev_default_fork (void);
|
|
477
487
|
|
478
488
|
unsigned int ev_backend (EV_P); /* backend in use by loop */
|
479
489
|
unsigned int ev_loop_count (EV_P); /* number of loop iterations */
|
480
|
-
#endif
|
490
|
+
#endif /* prototypes */
|
481
491
|
|
482
492
|
#define EVLOOP_NONBLOCK 1 /* do not block/wait */
|
483
493
|
#define EVLOOP_ONESHOT 2 /* block *once* only */
|
@@ -515,7 +525,7 @@ void ev_once (EV_P_ int fd, int events, ev_tstamp timeout, void (*cb)(int revent
|
|
515
525
|
} while (0)
|
516
526
|
|
517
527
|
#define ev_io_set(ev,fd_,events_) do { (ev)->fd = (fd_); (ev)->events = (events_) | EV_IOFDSET; } while (0)
|
518
|
-
#define ev_timer_set(ev,after_,repeat_) do { (ev)->at = (after_); (ev)->repeat = (repeat_); } while (0)
|
528
|
+
#define ev_timer_set(ev,after_,repeat_) do { ((ev_watcher_time *)(ev))->at = (after_); (ev)->repeat = (repeat_); } while (0)
|
519
529
|
#define ev_periodic_set(ev,ofs_,ival_,res_) do { (ev)->offset = (ofs_); (ev)->interval = (ival_); (ev)->reschedule_cb= (res_); } while (0)
|
520
530
|
#define ev_signal_set(ev,signum_) do { (ev)->signum = (signum_); } while (0)
|
521
531
|
#define ev_child_set(ev,pid_,trace_) do { (ev)->pid = (pid_); (ev)->flags = !!(trace_); } while (0)
|
@@ -547,6 +557,8 @@ void ev_once (EV_P_ int fd, int events, ev_tstamp timeout, void (*cb)(int revent
|
|
547
557
|
#define ev_cb(ev) (ev)->cb /* rw */
|
548
558
|
#define ev_set_priority(ev,pri) ((ev_watcher *)(void *)(ev))->priority = (pri)
|
549
559
|
|
560
|
+
#define ev_periodic_at(ev) (((ev_watcher_time *)(ev))->at + 0.)
|
561
|
+
|
550
562
|
#ifndef ev_set_cb
|
551
563
|
# define ev_set_cb(ev,cb_) ev_cb (ev) = (cb_)
|
552
564
|
#endif
|
data/ext/libev/ev_epoll.c
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
/*
|
2
2
|
* libev epoll fd activity backend
|
3
3
|
*
|
4
|
-
* Copyright (c) 2007 Marc Alexander Lehmann <libev@schmorp.de>
|
4
|
+
* Copyright (c) 2007,2008 Marc Alexander Lehmann <libev@schmorp.de>
|
5
5
|
* All rights reserved.
|
6
6
|
*
|
7
7
|
* Redistribution and use in source and binary forms, with or without modifica-
|
data/ext/libev/ev_kqueue.c
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
/*
|
2
2
|
* libev kqueue backend
|
3
3
|
*
|
4
|
-
* Copyright (c) 2007 Marc Alexander Lehmann <libev@schmorp.de>
|
4
|
+
* Copyright (c) 2007,2008 Marc Alexander Lehmann <libev@schmorp.de>
|
5
5
|
* All rights reserved.
|
6
6
|
*
|
7
7
|
* Redistribution and use in source and binary forms, with or without modifica-
|
data/ext/libev/ev_poll.c
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
/*
|
2
2
|
* libev poll fd activity backend
|
3
3
|
*
|
4
|
-
* Copyright (c) 2007 Marc Alexander Lehmann <libev@schmorp.de>
|
4
|
+
* Copyright (c) 2007,2008 Marc Alexander Lehmann <libev@schmorp.de>
|
5
5
|
* All rights reserved.
|
6
6
|
*
|
7
7
|
* Redistribution and use in source and binary forms, with or without modifica-
|
data/ext/libev/ev_port.c
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
/*
|
2
2
|
* libev solaris event port backend
|
3
3
|
*
|
4
|
-
* Copyright (c) 2007 Marc Alexander Lehmann <libev@schmorp.de>
|
4
|
+
* Copyright (c) 2007,2008 Marc Alexander Lehmann <libev@schmorp.de>
|
5
5
|
* All rights reserved.
|
6
6
|
*
|
7
7
|
* Redistribution and use in source and binary forms, with or without modifica-
|
data/ext/libev/ev_select.c
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
/*
|
2
2
|
* libev select fd activity backend
|
3
3
|
*
|
4
|
-
* Copyright (c) 2007 Marc Alexander Lehmann <libev@schmorp.de>
|
4
|
+
* Copyright (c) 2007,2008 Marc Alexander Lehmann <libev@schmorp.de>
|
5
5
|
* All rights reserved.
|
6
6
|
*
|
7
7
|
* Redistribution and use in source and binary forms, with or without modifica-
|
@@ -54,12 +54,6 @@
|
|
54
54
|
#if EV_SELECT_IS_WINSOCKET
|
55
55
|
# undef EV_SELECT_USE_FD_SET
|
56
56
|
# define EV_SELECT_USE_FD_SET 1
|
57
|
-
# undef EINTR
|
58
|
-
# define EINTR WSAEINTR
|
59
|
-
# undef EBADF
|
60
|
-
# define EBADF WSAENOTSOCK
|
61
|
-
# undef ENOMEM
|
62
|
-
# define ENOMEM (errno + 1)
|
63
57
|
#endif
|
64
58
|
|
65
59
|
#if !EV_SELECT_USE_FD_SET
|
@@ -98,7 +92,7 @@ select_modify (EV_P_ int fd, int oev, int nev)
|
|
98
92
|
int word = fd / NFDBITS;
|
99
93
|
fd_mask mask = 1UL << (fd % NFDBITS);
|
100
94
|
|
101
|
-
if (expect_false (vec_max
|
95
|
+
if (expect_false (vec_max <= word))
|
102
96
|
{
|
103
97
|
int new_max = word + 1;
|
104
98
|
|
@@ -147,6 +141,29 @@ select_poll (EV_P_ ev_tstamp timeout)
|
|
147
141
|
#if EV_SELECT_IS_WINSOCKET
|
148
142
|
errno = WSAGetLastError ();
|
149
143
|
#endif
|
144
|
+
#ifdef WSABASEERR
|
145
|
+
/* on windows, select returns incompatible error codes, fix this */
|
146
|
+
if (errno >= WSABASEERR && errno < WSABASEERR + 1000)
|
147
|
+
if (errno == WSAENOTSOCK)
|
148
|
+
errno = EBADF;
|
149
|
+
else
|
150
|
+
errno -= WSABASEERR;
|
151
|
+
#endif
|
152
|
+
|
153
|
+
#ifdef _WIN32
|
154
|
+
/* select on windows errornously returns EINVAL when no fd sets have been
|
155
|
+
* provided (this is documented). what microsoft doesn't tell you that this bug
|
156
|
+
* exists even when the fd sets are provided, so we have to check for this bug
|
157
|
+
* here and emulate by sleeping manually.
|
158
|
+
* we also get EINVAL when the timeout is invalid, but we ignore this case here
|
159
|
+
* and assume that EINVAL always means: you have to wait manually.
|
160
|
+
*/
|
161
|
+
if (errno == EINVAL)
|
162
|
+
{
|
163
|
+
ev_sleep (timeout);
|
164
|
+
return;
|
165
|
+
}
|
166
|
+
#endif
|
150
167
|
|
151
168
|
if (errno == EBADF)
|
152
169
|
fd_ebadf (EV_A);
|
data/ext/libev/ev_vars.h
CHANGED
@@ -112,12 +112,12 @@ VARx(int *, fdchanges)
|
|
112
112
|
VARx(int, fdchangemax)
|
113
113
|
VARx(int, fdchangecnt)
|
114
114
|
|
115
|
-
VARx(
|
115
|
+
VARx(ANHE *, timers)
|
116
116
|
VARx(int, timermax)
|
117
117
|
VARx(int, timercnt)
|
118
118
|
|
119
119
|
#if EV_PERIODIC_ENABLE || EV_GENWRAP
|
120
|
-
VARx(
|
120
|
+
VARx(ANHE *, periodics)
|
121
121
|
VARx(int, periodicmax)
|
122
122
|
VARx(int, periodiccnt)
|
123
123
|
#endif
|
data/ext/libev/ev_win32.c
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
/*
|
2
2
|
* libev win32 compatibility cruft (_not_ a backend)
|
3
3
|
*
|
4
|
-
* Copyright (c) 2007 Marc Alexander Lehmann <libev@schmorp.de>
|
4
|
+
* Copyright (c) 2007,2008 Marc Alexander Lehmann <libev@schmorp.de>
|
5
5
|
* All rights reserved.
|
6
6
|
*
|
7
7
|
* Redistribution and use in source and binary forms, with or without modifica-
|
data/ext/rev/rev_buffer.c
CHANGED
@@ -20,12 +20,12 @@
|
|
20
20
|
#include <errno.h>
|
21
21
|
|
22
22
|
/* Default number of bytes in each node's buffer */
|
23
|
-
#define DEFAULT_NODE_SIZE
|
23
|
+
#define DEFAULT_NODE_SIZE 16384
|
24
24
|
|
25
25
|
/* Maximum age of a buffer node in a memory pool, in seconds */
|
26
26
|
#define MAX_AGE 60
|
27
27
|
|
28
|
-
/* How often to scan the pool for
|
28
|
+
/* How often to scan the pool for old nodes */
|
29
29
|
#define PURGE_INTERVAL 10
|
30
30
|
|
31
31
|
struct buffer {
|
@@ -494,9 +494,11 @@ static void buffer_append(struct buffer *buf, char *str, unsigned len)
|
|
494
494
|
while(len > 0) {
|
495
495
|
nbytes = buf->node_size - buf->tail->end;
|
496
496
|
if(len < nbytes) nbytes = len;
|
497
|
-
|
497
|
+
|
498
498
|
memcpy(buf->tail->data + buf->tail->end, str, nbytes);
|
499
|
+
str += nbytes;
|
499
500
|
len -= nbytes;
|
501
|
+
|
500
502
|
buf->tail->end += nbytes;
|
501
503
|
|
502
504
|
if(len > 0) {
|
@@ -625,4 +627,4 @@ static int buffer_read_from(struct buffer *buf, int fd)
|
|
625
627
|
} while(bytes_read == nbytes);
|
626
628
|
|
627
629
|
return total_bytes_read;
|
628
|
-
}
|
630
|
+
}
|
data/lib/rev.rb
CHANGED
@@ -24,6 +24,6 @@ require File.dirname(__FILE__) + '/rev/server'
|
|
24
24
|
require File.dirname(__FILE__) + '/rev/http_client'
|
25
25
|
|
26
26
|
module Rev
|
27
|
-
Rev::VERSION = '0.2.
|
27
|
+
Rev::VERSION = '0.2.2' unless defined? Rev::VERSION
|
28
28
|
def self.version() VERSION end
|
29
29
|
end
|
data/lib/rev/io.rb
CHANGED
data/lib/rev/socket.rb
CHANGED
data/rev.gemspec
CHANGED