src/server/daemon/sessionhandler.c

changeset 78
3578977d29a3
parent 67
50505dc3f8a6
child 79
f48cea237ec3
equal deleted inserted replaced
77:f1cff81e425a 78:3578977d29a3
108 // TODO: free, see evt_request_finish 108 // TODO: free, see evt_request_finish
109 109
110 return NULL; 110 return NULL;
111 } 111 }
112 112
113 void basic_keep_alive(SessionHandler *handler, Connection *conn) {
114
115 }
116
117
113 /* ----- event session handler ----- */ 118 /* ----- event session handler ----- */
114 119
115 SessionHandler* create_event_session_handler() { 120 SessionHandler* create_event_session_handler() {
116 EventSessionHandler *handler = malloc(sizeof(EventSessionHandler)); 121 EventSessionHandler *handler = malloc(sizeof(EventSessionHandler));
117 handler->eventhandler = get_default_event_handler(); 122 handler->eventhandler = get_default_event_handler();
118 handler->sh.enqueue_connection = evt_enq_conn; 123 handler->sh.enqueue_connection = evt_enq_conn;
124 handler->sh.keep_alive = evt_keep_alive;
119 return (SessionHandler*)handler; 125 return (SessionHandler*)handler;
120 } 126 }
121 127
122 void evt_enq_conn(SessionHandler *handler, Connection *conn) { 128 void evt_enq_conn(SessionHandler *handler, Connection *conn) {
123 HTTPRequest *request = malloc(sizeof(HTTPRequest)); 129 HTTPRequest *request = malloc(sizeof(HTTPRequest));
278 free(io); 284 free(io);
279 free(event); 285 free(event);
280 286
281 return 0; 287 return 0;
282 } 288 }
289
290 void evt_keep_alive(SessionHandler *handler, Connection *conn) {
291 // TODO: set timeout
292
293 /* TODO:
294 * Don't just re-enqueue the connection
295 * create a evt_req_init function which does most of the evt_enq_conn stuff
296 * but don't poll.
297 * evt_keep_alive should poll and if an event occurs:
298 * evt_req_init
299 * evt_request_input
300 * evt_enq_conn should do:
301 * evt_req_init
302 * ev_pollin
303 */
304 evt_enq_conn(handler, conn);
305 }

mercurial