sas Wed Dec 4 04:53:20 2002 EDT Modified files: /php4/ext/ircg ircg.c php_ircg_private.h Log: Delay put_irconn call for set_current until we actually finish using the conn structure. This just passed a test with 25M messages delivered and 45K logins handled in an Apache 1.3 context. Index: php4/ext/ircg/ircg.c diff -u php4/ext/ircg/ircg.c:1.153 php4/ext/ircg/ircg.c:1.154 --- php4/ext/ircg/ircg.c:1.153 Tue Dec 3 19:19:51 2002 +++ php4/ext/ircg/ircg.c Wed Dec 4 04:53:20 2002 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: ircg.c,v 1.153 2002/12/04 00:19:51 sas Exp $ */ +/* $Id: ircg.c,v 1.154 2002/12/04 09:53:20 sas Exp $ */ /* {{{ includes */ @@ -1060,6 +1060,7 @@ { zval **p1; php_irconn_t *conn; + int do_put = 1; if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &p1) == FAILURE) WRONG_PARAM_COUNT; @@ -1099,13 +1100,18 @@ if (irc_write_buf_add(&conn->wb, conn->fd) == 0) { php_ircg->irc_set_currents++; IRCGG(flush_data) = conn; + /* We maintain a reference to conn until rshutdown */ + do_put = 0; RETVAL_TRUE; } else { + php_ircg->failed_set_currents++; + conn->fd = -1; RETVAL_FALSE; } } } - put_irconn(conn); + if (do_put) + put_irconn(conn); } /* }}} */ @@ -2076,6 +2082,7 @@ msg_replay_buffer(conn); irc_write_buf_flush(&conn->wb); + put_irconn(conn); } return SUCCESS; @@ -2213,6 +2220,8 @@ php_info_print_table_row(2, "Terminated IRC connections", buf); sprintf(buf, "%lu", php_ircg->irc_set_currents); php_info_print_table_row(2, "Persistent HTTP connections", buf); + sprintf(buf, "%lu", php_ircg->failed_set_currents); + php_info_print_table_row(2, "Failed persistent HTTP connections", buf); sprintf(buf, "%lu", php_ircg->irc_wbuf_destructs); php_info_print_table_row(2, "Write buffer destructs", buf); php_info_print_table_end(); Index: php4/ext/ircg/php_ircg_private.h diff -u php4/ext/ircg/php_ircg_private.h:1.3 php4/ext/ircg/php_ircg_private.h:1.4 --- php4/ext/ircg/php_ircg_private.h:1.3 Tue Dec 3 16:50:12 2002 +++ php4/ext/ircg/php_ircg_private.h Wed Dec 4 04:53:20 2002 @@ -30,7 +30,7 @@ /* these just serve statistical/entertainment purposes */ unsigned long irc_connects, irc_set_currents, irc_quit_handlers, exec_fmt_msgs, exec_token_compiler, - irc_wbuf_destructs; + irc_wbuf_destructs, failed_set_currents; unsigned long cache_hits, cache_misses;
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php