Changeset 1789
- Timestamp:
- 08/13/08 11:14:13 (3 months ago)
- Files:
-
- cherokee/trunk/ChangeLog (modified) (1 diff)
- cherokee/trunk/cherokee/handler_mirror.c (modified) (4 diffs)
- cherokee/trunk/cherokee/handler_mirror.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
cherokee/trunk/ChangeLog
r1788 r1789 1 2008-08-13 Alvaro Lopez Ortega <alvaro@alobbs.com> 2 3 * cherokee/handler_mirror.c, cherokee/handler_mirror.h: Fixes the 4 TCP mirroring handler. It fixes it to use the new async client 5 connections. 6 1 7 2008-08-12 Alvaro Lopez Ortega <alvaro@alobbs.com> 2 8 cherokee/trunk/cherokee/handler_mirror.c
r1439 r1789 28 28 #include "connection-protected.h" 29 29 #include "thread.h" 30 30 #include "source.h" 31 31 32 32 #define ENTRIES "handler,mirror" … … 113 113 n->post_sent = 0; 114 114 n->post_len = 0; 115 n->src_ref = NULL; 115 116 n->phase = hmirror_phase_connect; 116 117 … … 138 139 { 139 140 ret_t ret; 140 cherokee_source_t *src = NULL; 141 cherokee_connection_t *conn = HANDLER_CONN(hdl); 142 cherokee_handler_mirror_props_t *props = HDL_MIRROR_PROPS(hdl); 143 144 ret = cherokee_balancer_dispatch (props->balancer, conn, &src); 145 if (ret != ret_ok) 146 return ret; 147 148 ret = cherokee_source_connect (src, &hdl->socket); 141 cherokee_connection_t *conn = HANDLER_CONN(hdl); 142 cherokee_handler_mirror_props_t *props = HDL_MIRROR_PROPS(hdl); 143 144 if (hdl->src_ref == NULL) { 145 ret = cherokee_balancer_dispatch (props->balancer, conn, &hdl->src_ref); 146 if (ret != ret_ok) 147 return ret; 148 } 149 150 /* Try to connect 151 */ 152 ret = cherokee_source_connect (hdl->src_ref, &hdl->socket); 149 153 switch (ret) { 150 154 case ret_ok: 155 TRACE (ENTRIES, "Connected successfully fd=%d\n", 156 hdl->socket.socket); 157 return ret_ok; 158 case ret_deny: 151 159 break; 152 case ret_deny: 153 conn->error_code = http_bad_gateway; 160 case ret_eagain: 161 ret = cherokee_thread_deactive_to_polling (HANDLER_THREAD(hdl), 162 conn, 163 SOCKET_FD(&hdl->socket), 164 FDPOLL_MODE_WRITE, 165 false); 166 if (ret != ret_ok) { 167 return ret_deny; 168 } 169 170 return ret_eagain; 171 case ret_error: 154 172 return ret_error; 155 173 default: 156 return ret_error;157 } 158 159 TRACE (ENTRIES, "connected fd=%d\n", hdl->socket.socket);160 return ret_ ok;174 break; 175 } 176 177 TRACE (ENTRIES, "Couldn't connect%s", "\n"); 178 return ret_error; 161 179 } 162 180 … … 288 306 289 307 case ret_eagain: 290 cherokee_thread_deactive_to_polling (HANDLER_THREAD(hdl), HANDLER_CONN(hdl), 291 hdl->socket.socket, 0, false); 308 cherokee_thread_deactive_to_polling (HANDLER_THREAD(hdl), 309 HANDLER_CONN(hdl), 310 hdl->socket.socket, 311 FDPOLL_MODE_READ, 312 false); 292 313 return ret_eagain; 293 314 294 315 case ret_eof: 295 316 case ret_error: 296 return ret _ok;317 return ret; 297 318 298 319 default: cherokee/trunk/cherokee/handler_mirror.h
r1131 r1789 47 47 cherokee_handler_t base; 48 48 cherokee_socket_t socket; 49 cherokee_source_t *src_ref; 49 50 50 51 cherokee_handler_mirror_phase_t phase;