evdispatch 0.3.1 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (70) hide show
  1. data/Manifest.txt +21 -65
  2. data/ext/revdispatch/dispatch.cc +3 -0
  3. data/ext/revdispatch/extconf.rb +50 -32
  4. data/ext/revdispatch/{libdispatch-0.1 → libdispatch}/libev-3.31/ev++.h +0 -0
  5. data/ext/revdispatch/{libdispatch-0.1 → libdispatch}/libev-3.31/ev.c +0 -0
  6. data/ext/revdispatch/{libdispatch-0.1 → libdispatch}/libev-3.31/ev.h +0 -0
  7. data/ext/revdispatch/{libdispatch-0.1 → libdispatch}/libev-3.31/ev_epoll.c +0 -0
  8. data/ext/revdispatch/{libdispatch-0.1 → libdispatch}/libev-3.31/ev_kqueue.c +0 -0
  9. data/ext/revdispatch/{libdispatch-0.1 → libdispatch}/libev-3.31/ev_poll.c +0 -0
  10. data/ext/revdispatch/{libdispatch-0.1 → libdispatch}/libev-3.31/ev_port.c +0 -0
  11. data/ext/revdispatch/{libdispatch-0.1 → libdispatch}/libev-3.31/ev_select.c +0 -0
  12. data/ext/revdispatch/{libdispatch-0.1 → libdispatch}/libev-3.31/ev_vars.h +0 -0
  13. data/ext/revdispatch/{libdispatch-0.1 → libdispatch}/libev-3.31/ev_win32.c +0 -0
  14. data/ext/revdispatch/{libdispatch-0.1 → libdispatch}/libev-3.31/ev_wrap.h +0 -0
  15. data/ext/revdispatch/{libdispatch-0.1 → libdispatch}/libev-3.31/event.c +0 -0
  16. data/ext/revdispatch/{libdispatch-0.1 → libdispatch}/libev-3.31/event.h +0 -0
  17. data/ext/revdispatch/{libdispatch-0.1 → libdispatch}/src/ev_dispatch.cc +6 -17
  18. data/ext/revdispatch/{libdispatch-0.1 → libdispatch}/src/ev_dispatch.h +0 -0
  19. data/ext/revdispatch/libdispatch/src/ev_embed.c +6 -0
  20. data/ext/revdispatch/{libdispatch-0.1 → libdispatch}/src/ev_http.cc +11 -8
  21. data/ext/revdispatch/{libdispatch-0.1 → libdispatch}/src/ev_http.h +0 -0
  22. data/lib/evdispatch/version.rb +2 -2
  23. data/website/index.html +7 -1
  24. data/website/index.txt +6 -0
  25. metadata +23 -67
  26. data/ext/revdispatch/libdispatch-0.1/Changelog +0 -12
  27. data/ext/revdispatch/libdispatch-0.1/LICENSE +0 -0
  28. data/ext/revdispatch/libdispatch-0.1/Makefile.am +0 -10
  29. data/ext/revdispatch/libdispatch-0.1/Makefile.in +0 -636
  30. data/ext/revdispatch/libdispatch-0.1/README +0 -3
  31. data/ext/revdispatch/libdispatch-0.1/aclocal.m4 +0 -7268
  32. data/ext/revdispatch/libdispatch-0.1/autogen.sh +0 -11
  33. data/ext/revdispatch/libdispatch-0.1/config.guess +0 -1516
  34. data/ext/revdispatch/libdispatch-0.1/config.h.in +0 -112
  35. data/ext/revdispatch/libdispatch-0.1/config.sub +0 -1626
  36. data/ext/revdispatch/libdispatch-0.1/configure +0 -21779
  37. data/ext/revdispatch/libdispatch-0.1/configure.ac +0 -42
  38. data/ext/revdispatch/libdispatch-0.1/depcomp +0 -584
  39. data/ext/revdispatch/libdispatch-0.1/install-sh +0 -507
  40. data/ext/revdispatch/libdispatch-0.1/libev-3.31/Changes +0 -78
  41. data/ext/revdispatch/libdispatch-0.1/libev-3.31/LICENSE +0 -25
  42. data/ext/revdispatch/libdispatch-0.1/libev-3.31/Makefile.am +0 -18
  43. data/ext/revdispatch/libdispatch-0.1/libev-3.31/Makefile.in +0 -677
  44. data/ext/revdispatch/libdispatch-0.1/libev-3.31/README +0 -130
  45. data/ext/revdispatch/libdispatch-0.1/libev-3.31/aclocal.m4 +0 -7268
  46. data/ext/revdispatch/libdispatch-0.1/libev-3.31/autogen.sh +0 -6
  47. data/ext/revdispatch/libdispatch-0.1/libev-3.31/config.guess +0 -1516
  48. data/ext/revdispatch/libdispatch-0.1/libev-3.31/config.h.in +0 -112
  49. data/ext/revdispatch/libdispatch-0.1/libev-3.31/config.sub +0 -1626
  50. data/ext/revdispatch/libdispatch-0.1/libev-3.31/configure +0 -21500
  51. data/ext/revdispatch/libdispatch-0.1/libev-3.31/configure.ac +0 -18
  52. data/ext/revdispatch/libdispatch-0.1/libev-3.31/ev.3 +0 -3344
  53. data/ext/revdispatch/libdispatch-0.1/libev-3.31/ev.pod +0 -3268
  54. data/ext/revdispatch/libdispatch-0.1/libev-3.31/install-sh +0 -294
  55. data/ext/revdispatch/libdispatch-0.1/libev-3.31/libev.m4 +0 -28
  56. data/ext/revdispatch/libdispatch-0.1/libev-3.31/ltmain.sh +0 -6871
  57. data/ext/revdispatch/libdispatch-0.1/libev-3.31/missing +0 -336
  58. data/ext/revdispatch/libdispatch-0.1/libev-3.31/mkinstalldirs +0 -111
  59. data/ext/revdispatch/libdispatch-0.1/ltmain.sh +0 -6930
  60. data/ext/revdispatch/libdispatch-0.1/missing +0 -367
  61. data/ext/revdispatch/libdispatch-0.1/src/Makefile.am +0 -11
  62. data/ext/revdispatch/libdispatch-0.1/src/Makefile.in +0 -485
  63. data/ext/revdispatch/libdispatch-0.1/test/Makefile.am +0 -30
  64. data/ext/revdispatch/libdispatch-0.1/test/Makefile.in +0 -623
  65. data/ext/revdispatch/libdispatch-0.1/test/key_test.cc +0 -52
  66. data/ext/revdispatch/libdispatch-0.1/test/next_test.cc +0 -84
  67. data/ext/revdispatch/libdispatch-0.1/test/opt_test.cc +0 -70
  68. data/ext/revdispatch/libdispatch-0.1/test/pipe_test.cc +0 -241
  69. data/ext/revdispatch/libdispatch-0.1/test/post_test.cc +0 -66
  70. data/ext/revdispatch/libdispatch-0.1/test/stress_test.cc +0 -62
@@ -1,66 +0,0 @@
1
- #include "ev_dispatch.h"
2
- #include "ev_http.h"
3
- #include <sys/select.h>
4
- #include <errno.h>
5
-
6
- using namespace EVD;
7
-
8
-
9
- // catch SIGINT to kill process
10
- static void SIGINT_handler(int sig)
11
- {
12
- exit(sig);
13
- }
14
-
15
- static void run_tests( Dispatch &dispatcher, int count )
16
- {
17
- time_t start_time = time(NULL);
18
-
19
- // tell the request to stream the response over this file descriptor
20
- HttpRequest *req = new HttpRequest( dispatcher, "http://127.0.0.1:4044/test_post_length" );
21
- req->set_opt("post", "hello there world");
22
-
23
- request_t id = dispatcher.request( req );
24
-
25
- struct timeval start;
26
- Timer::current_time(&start);
27
-
28
- while( dispatcher.wait_for_response_by_id( id, Timer(0,500*1000*1000) ) ) {
29
- if( Timer::elapsed_time( &start ) > 2.0 ){
30
- printf("exceeded max elasped time...\n");
31
- break;
32
- }
33
- }
34
-
35
- HttpResponse *res = (HttpResponse *)dispatcher.response_for( id );
36
- printf("response: %s, in %.5lf seconds of Content-Length: %d bytes\n%s%s\n", res->name.c_str(), res->response_time, res->body.length(), res->m_header.c_str(), res->body.c_str() );
37
- delete res;
38
- }
39
-
40
- int main(int argc, char **argv)
41
- {
42
- Dispatch dispatcher;
43
-
44
- if (signal(SIGINT, SIGINT_handler) == SIG_ERR) {
45
- printf("SIGINT install error\n");
46
- exit(1);
47
- }
48
-
49
- if( !dispatcher.start() ){
50
- fprintf( stderr, "Failed to start up dispatcher\n" );
51
- return 1;
52
- }
53
-
54
- //printf( "dispatcher thread running...\n" );
55
-
56
- struct timeval start_time;
57
- Timer::current_time(&start_time);
58
-
59
- run_tests( dispatcher, 10 );
60
-
61
- //printf( "total time: %.5f seconds\n", Timer::elapsed_time( &start_time ) );
62
-
63
- dispatcher.stop();
64
-
65
- return 0;
66
- }
@@ -1,62 +0,0 @@
1
- #include "ev_dispatch.h"
2
- #include "ev_http.h"
3
-
4
- using namespace EVD;
5
-
6
-
7
- // catch SIGINT to kill process
8
- static void SIGINT_handler(int sig)
9
- {
10
- exit(sig);
11
- }
12
-
13
- static int run_test(Dispatch& dispatcher)
14
- {
15
- if( !dispatcher.start() ){
16
- fprintf( stderr, "Failed to start up dispatcher\n" );
17
- return 1;
18
- }
19
-
20
- printf( "dispatcher thread running...\n" );
21
- std::vector<request_t> ids;
22
- int TRIALS = 100;
23
-
24
- for( int i = 0; i < TRIALS; ++i ) {
25
- request_t id;
26
- if( i % 2 ) {
27
- id = dispatcher.request( new HttpRequest( dispatcher, "http://127.0.0.1:4044/bytes/1000" ) );
28
- }
29
- else {
30
- id = dispatcher.request( new HttpRequest( dispatcher, "http://127.0.0.1:4044/bytes/10" ) );
31
- }
32
- ids.push_back( id );
33
- }
34
- Response *res;
35
- for( int i = 0; i < ids.size(); ++i ) {
36
- request_t id = ids[i];
37
- while( dispatcher.wait_for_response_by_id( id, Timer(1,5) ) ){
38
- printf("waiting for %d...\n", i);
39
- }
40
- res = dispatcher.response_for( id );
41
- if( res ) {
42
- printf("Recieved response from 2: %s, Content-Length: %d\n", res->name.c_str(), res->body.length() );
43
- delete res;
44
- }
45
- }
46
- dispatcher.stop();
47
- return 0;
48
- }
49
-
50
- int main(int argc, char **argv)
51
- {
52
- Dispatch dispatcher;
53
- if (signal(SIGINT, SIGINT_handler) == SIG_ERR) {
54
- printf("SIGINT install error\n");
55
- return 1;
56
- }
57
- for( int i = 0; i < 10; ++i ) {
58
- run_test(dispatcher);
59
- }
60
-
61
- return 0;
62
- }