pier 01/09/16 20:09:56
Modified: webapp/lib pr_warp.c
Log:
Fix for Bug 2997:
When Tomcat is restarted, now the WebApp module automatically
reconnects thru WARP.
Previously the first request sent to Apache will come up with
an error saying "Communitcation interrupted", but depending on
the number of active processes, that might have taken quite a
while (every process had to reconnect).
Now if the first packet doesn't go thru, we try once to re-
establish connection with Tomcat, so the "Communication
interrupted" message doesn't pop up anymore.
Revision Changes Path
1.14 +22 -2 jakarta-tomcat-connectors/webapp/lib/pr_warp.c
Index: pr_warp.c
===================================================================
RCS file: /home/cvs/jakarta-tomcat-connectors/webapp/lib/pr_warp.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- pr_warp.c 2001/08/09 20:03:43 1.13
+++ pr_warp.c 2001/09/17 03:09:56 1.14
@@ -54,7 +54,7 @@
* *
* ========================================================================= */
-/* @version $Id: pr_warp.c,v 1.13 2001/08/09 20:03:43 pier Exp $ */
+/* @version $Id: pr_warp.c,v 1.14 2001/09/17 03:09:56 pier Exp $ */
#include "pr_warp.h"
/* Initialize this provider. */
@@ -250,7 +250,27 @@
p_write_string(pack,r->prot);
if (n_send(conf->sock,pack)!=wa_true) {
n_disconnect(conn);
- return(wa_rerror(WA_MARK,r,500,"Communitcation interrupted"));
+ if (n_connect(conn)==wa_true) {
+ wa_debug(WA_MARK,"Connection \"%s\" reopened",conn->name);
+ if (c_configure(conn)==wa_true) {
+ wa_debug(WA_MARK,"Connection \"%s\" reconfigured",conn->name);
+ } else {
+ wa_log(WA_MARK,"Cannot reconfigure connection %s",conn->name);
+ return(wa_rerror(WA_MARK,r,500,
+ "Cannot reconfigure connection \"%s\"",
+ conn->name));
+ }
+ if (n_send(conf->sock,pack)!=wa_true) {
+ return(wa_rerror(WA_MARK,r,500,
+ "Communitcation broken while reconnecting"));
+ } else {
+ wa_debug(WA_MARK,"Re-Req. %s %s %s",r->meth,r->ruri,r->prot);
+ }
+ } else {
+ wa_log(WA_MARK,"Cannot open connection %s",conn->name);
+ return(wa_rerror(WA_MARK,r,500,"Cannot open connection %s",
+ conn->name));
+ }
} else {
wa_debug(WA_MARK,"Req. %s %s %s",r->meth,r->ruri,r->prot);
}