ext/revdispatch/libdispatch-0.1/src/ev_dispatch.h in evdispatch-0.1.3 vs ext/revdispatch/libdispatch-0.1/src/ev_dispatch.h in evdispatch-0.1.4
- old
+ new
@@ -23,15 +23,19 @@
MEMCACHED
};
Request( request_t k, const std::string &u ) : key(k), url(u){ time( &start_time); }
virtual ~Request (){ }
+ // by default this does nothing, each real request object can do as it pleases with this feature
+ virtual void set_opt( const std::string &key, const std::string &value ){}
+
+ virtual void set_key( request_t key ){ this->key = key; }
+
// attach to the event loop
virtual bool enable() = 0;
- // TODO: add a method to access the response
-
+ // key will be set by the dispatch object when you invoke this request
request_t key;
std::string url;
time_t start_time;
};
@@ -222,11 +226,11 @@
// start up the background event listener
bool start();
// tell the background event listener to terminate
void stop();
- request_t request( Request::Type type, const std::string &url );
+ request_t request( Request *req );
// from the main thread, get the next available response
// just keep pop'ing off the response queue until we get something
// if you get a non NULL response from this method it's your responsiblity to delete it
//
@@ -250,9 +254,11 @@
}
inline struct ev_loop *get_loop(){ return m_loop; }
inline pthread_t get_thread_id()const{ return m_tid; }
+
+ inline struct HttpClient *getHttpClient()const{ return m_http_client; }
protected:
// all event loop activity happens on this thread
static void* event_loop_start( void *ptr );