You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by co...@apache.org on 2002/02/06 20:13:10 UTC
cvs commit: jakarta-tomcat-connectors/jk/native2/common jk_ajp14_worker.c
costin 02/02/06 11:13:10
Modified: jk/native2/common jk_ajp14_worker.c
Log:
Added the same secret option.
Revision Changes Path
1.15 +16 -52 jakarta-tomcat-connectors/jk/native2/common/jk_ajp14_worker.c
Index: jk_ajp14_worker.c
===================================================================
RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/common/jk_ajp14_worker.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- jk_ajp14_worker.c 26 Jan 2002 07:03:42 -0000 1.14
+++ jk_ajp14_worker.c 6 Feb 2002 19:13:10 -0000 1.15
@@ -101,35 +101,18 @@
jk_worker_t *p = _this;
jk_worker_t *aw;
char * secret_key;
- int proto=AJP14_PROTO;
char *channelType;
aw = _this;
- secret_key = jk_map_getStrProp( env, props,
- "worker", aw->name, "secretkey", NULL );
-
+ _this->secret = jk_map_getStrProp( env, props,
+ "worker", aw->name, "secretkey", NULL );
+ _this->secret= _this->pool->pstrdup(env, _this->pool, _this->secret);
+
channelType = jk_map_getStrProp( env, props,
"worker", aw->name, "channel", "socket" );
- if ((!secret_key) || (!strlen(secret_key))) {
- proto=AJP13_PROTO;
- aw->proto= AJP13_PROTO;
- }
-
- if (proto == AJP13_PROTO) {
- port = AJP13_DEF_PORT;
- host = AJP13_DEF_HOST;
- } else if (proto == AJP14_PROTO) {
- port = AJP14_DEF_PORT;
- host = AJP14_DEF_HOST;
- } else {
- env->l->jkLog(env, env->l, JK_LOG_ERROR,
- "ajp14.validate() unknown protocol %d\n",proto);
- return JK_FALSE;
- }
if( _this->channel == NULL ) {
/* Create a default channel */
-
_this->channel=env->getInstance(env, _this->pool,"channel",
channelType );
@@ -141,7 +124,6 @@
}
err=_this->channel->init( env, _this->channel, props, p->name, _this);
-
if( err != JK_TRUE ) {
env->l->jkLog(env, env->l, JK_LOG_ERROR,
"ajp14.validate(): channel init failed\n");
@@ -149,8 +131,8 @@
}
env->l->jkLog(env, env->l, JK_LOG_INFO,
- "ajp14.validate() %s protocol=%s\n", _this->name,
- ((_this->secret==NULL) ? "ajp13" : "ajp14"));
+ "ajp14.validate() %s %s\n", _this->name,
+ _this->channel->name);
return JK_TRUE;
}
@@ -213,6 +195,11 @@
return err;
}
+/** There is no point of trying multiple times - each channel may
+ have built-in recovery mechanisms
+*/
+#define JK_RETRIES 2
+
/** First message in a stream-based connection. If the first send
fails, try to reconnect.
*/
@@ -231,7 +218,7 @@
* XXX JK_RETRIES could be replaced by the number of workers in
* a load-balancing configuration
*/
- for(attempt = 0 ; attempt < worker->connect_retry_attempts ;attempt++) {
+ for(attempt = 0 ; attempt < JK_RETRIES ;attempt++) {
jk_channel_t *channel= worker->channel;
/* e->request->dump(env, e->request, "Before sending "); */
@@ -387,7 +374,7 @@
/*
* We get here initial request (in reqmsg)
*/
- err=jk_serialize_request13(env, e->request, s);
+ err=jk_serialize_request13(env, e->request, s, e);
if (err!=JK_TRUE) {
s->is_recoverable_error = JK_FALSE;
env->l->jkLog(env, env->l, JK_LOG_ERROR,
@@ -497,7 +484,6 @@
e->cPool=endpointPool->create(env, endpointPool, HUGE_POOL_SIZE );
e->worker = _this;
- e->proto = _this->proto;
e->channelData = NULL;
*eP = e;
@@ -531,23 +517,8 @@
{
jk_endpoint_t *e;
int rc;
- char *secret_key;
- int proto=AJP14_PROTO;
int cache_sz;
- secret_key = jk_map_getStrProp( env, props,
- "worker", _this->name, "secretkey", NULL );
-
- if( secret_key==NULL ) {
- proto=AJP13_PROTO;
- _this->proto= AJP13_PROTO;
- _this->secret=NULL;
- } else {
- /* Set Secret Key (used at logon time) */
- _this->secret = _this->pool->pstrdup(env, _this->pool, secret_key);
- }
-
-
/* start the connection cache */
cache_sz=jk_map_getIntProp(env, props,
"worker", _this->name, "cachesize",
@@ -567,10 +538,6 @@
_this->endpointCache=NULL;
}
- /* Set WebServerName (used at logon time) */
- if( we->server_name == NULL )
- we->server_name = _this->pool->pstrdup(env, we->pool,we->server_name);
-
if (_this->secret == NULL) {
/* No extra initialization for AJP13 */
env->l->jkLog(env, env->l, JK_LOG_INFO,
@@ -617,9 +584,9 @@
"ajp14.destroy()\n");
if( _this->endpointCache != NULL ) {
-
- for( i=0; i< _this->endpointCache->ep_cache_sz; i++ ) {
- jk_endpoint_t *e;
+ jk_endpoint_t *e;
+
+ while( _this->endpointCache->count > 0 ) {
e= _this->endpointCache->get( env, _this->endpointCache );
@@ -656,10 +623,7 @@
w->pool = pool;
w->name = NULL;
- w->proto= AJP14_PROTO;
-
w->endpointCache= NULL;
- w->connect_retry_attempts= AJP_DEF_RETRY_ATTEMPTS;
w->channel= NULL;
w->secret= NULL;
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>