Project

General

Profile

fix.diff

How to fix - stepancheg, 2008-12-24 17:44

View differences:

src/mod_uploadprogress.c Fri Dec 19 01:26:54 2008 +0300 → src/mod_uploadprogress.c Wed Dec 24 18:06:29 2008 +0300
614 614
	return HANDLER_GO_ON;
615 615
}
616 616

  
617
static connection_map_entry *connection_map_get_connection_entry_by_con(connection_map *cm, connection *con) {
618
	size_t i;
619
	for (i = 0; i < cm->used; i++) {
620
		connection_map_entry *cme = cm->ptr[i];
621
		if (cme->con == con)
622
			return cme;
623
	}
624
	return NULL;
625
}
626

  
627
static void remove_connection_pointer(server *srv, connection *con, void *p_d) {
628
	plugin_data *p = p_d;
629
	connection_map_entry *post_con_entry = connection_map_get_connection_entry_by_con(p->con_map, con);
630

  
631
	if (NULL != post_con_entry) {
632
		post_con_entry->timeout = time(NULL) + p->conf.remove_timeout;
633
		post_con_entry->con = NULL;
634
	}
635
}
636

  
637
static handler_t mod_upload_progress_connection_reset(server *srv, connection *con, void *p_d) {
638
	plugin_data *p = p_d;
639
	if (p->conf.debug)
640
		TRACE("mod_upload_progress_connection_reset: %d", con);
641
	remove_connection_pointer(srv, con, p_d);
642
	return HANDLER_GO_ON;
643
}
644

  
645
static handler_t mod_upload_progress_handle_connection_close(server *srv, connection *con, void *p_d) {
646
	plugin_data *p = p_d;
647
	if (p->conf.debug)
648
		TRACE("mod_upload_progress_handle_connection_close: %d", con);
649
	remove_connection_pointer(srv, con, p_d);
650
	return HANDLER_GO_ON;
651
}
617 652

  
618 653
/* this function is called at dlopen() time and inits the callbacks */
619 654

  
......
629 664
	p->handle_trigger = mod_uploadprogress_trigger;
630 665
	p->handle_response_header = mod_uploadprogress_response_header;
631 666

  
667
	p->connection_reset = mod_upload_progress_connection_reset;
668
	p->handle_connection_close = mod_upload_progress_handle_connection_close;
669

  
632 670
	p->data        = NULL;
633 671

  
634 672
	return 0;