ext/revdispatch/libdispatch-0.1/test/key_test.cc in evdispatch-0.1.3 vs ext/revdispatch/libdispatch-0.1/test/key_test.cc in evdispatch-0.1.4

- old
+ new

@@ -1,6 +1,7 @@ #include "ev_dispatch.h" +#include "ev_http.h" using namespace EVD; // catch SIGINT to kill process @@ -23,25 +24,24 @@ return 1; } printf( "dispatcher thread running...\n" ); - request_t yahoo_id = dispatcher.request(Request::HTTP, "http://www.yahoo.com/"); - request_t google_id = dispatcher.request(Request::HTTP, "http://www.google.com/"); + request_t yahoo_id = dispatcher.request( new HttpRequest( dispatcher, "http://www.yahoo.com/" ) ); + request_t google_id = dispatcher.request(new HttpRequest( dispatcher, "http://www.google.com/" ) ); printf("yahoo: %d\n", yahoo_id); printf("google: %d\n", google_id); Response *res = NULL; - Timer timeout(0,5); - while( dispatcher.wait_for_response_by_id( yahoo_id, timeout ) ){ + while( dispatcher.wait_for_response_by_id( yahoo_id, Timer(1,5) ) ){ printf("waiting for yahoo...\n"); } res = dispatcher.response_for( yahoo_id ); printf("Recieved response from yahoo: %s, Content-Length: %d\n", res->name.c_str(), res->body.length() ); delete res; - while( dispatcher.wait_for_response_by_id( google_id, timeout ) ){ + while( dispatcher.wait_for_response_by_id( google_id, Timer(1,5) ) ){ printf("waiting for google...\n"); } res = dispatcher.response_for( google_id ); printf("Recieved response from google: %s, Content-Length: %d\n", res->name.c_str(), res->body.length() );