feat: small changes
							parent
							
								
									4d436aa8aa
								
							
						
					
					
						commit
						90ff55d977
					
				|  | @ -68,29 +68,15 @@ void event_loop_conn_io_req(event_loop *el, event_loop_conn *conn) { | |||
|       return; | ||||
|     } | ||||
| 
 | ||||
|     // Any other negative error message means the read errored out
 | ||||
|     if (res < 0) { | ||||
|     // Any other negative error message means the read errored out. If res is 0,
 | ||||
|     // we've reached the end of the input which (usually) means the remote peer
 | ||||
|     // has closed the connection. Either way, we close the connection.
 | ||||
|     if (res <= 0) { | ||||
|       conn->state = event_loop_conn_state_end; | ||||
| 
 | ||||
|       return; | ||||
|     } | ||||
| 
 | ||||
|     // Output of 0 and no error means we've reached the end of the input. We run
 | ||||
|     // try_one_request one more time and close the connection if this doesn't
 | ||||
|     // change the result.
 | ||||
|     if (res == 0) { | ||||
|       conn->state = event_loop_conn_state_end; | ||||
| 
 | ||||
|       return; | ||||
|     } | ||||
| 
 | ||||
|     // We switch to processing mode if we've reached the end of the data stream,
 | ||||
|     // or if the read buffer is filled
 | ||||
|     /* if (res == 0 || c->rbuf_size == MAX_MSG_SIZE) { */ | ||||
|     /*     c->state = STATE_PROCESS; */ | ||||
|     /*     return false; */ | ||||
|     /* } */ | ||||
| 
 | ||||
|     conn->rbuf_size += (size_t)res; | ||||
| 
 | ||||
|     // This loop allows processing multiple requests from a single read buffer
 | ||||
|  |  | |||
|  | @ -37,6 +37,8 @@ bool http_loop_handle_request(event_loop_conn *conn) { | |||
|       return false; | ||||
|     } | ||||
| 
 | ||||
|     conn->rbuf_read += res; | ||||
| 
 | ||||
|     // If the routing fails, we exit the handler
 | ||||
|     if (!http_loop_route_request(conn)) { | ||||
|       return false; | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue