costin 02/03/01 22:07:48
Modified: jk/native2/common jk_channel_apr_socket.c jk_channel_jni.c
jk_channel_socket.c
Log:
setProperty() style for configuration
Revision Changes Path
1.3 +14 -33
jakarta-tomcat-connectors/jk/native2/common/jk_channel_apr_socket.c
Index: jk_channel_apr_socket.c
===================================================================
RCS file:
/home/cvs/jakarta-tomcat-connectors/jk/native2/common/jk_channel_apr_socket.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- jk_channel_apr_socket.c 21 Feb 2002 11:09:31 -0000 1.2
+++ jk_channel_apr_socket.c 2 Mar 2002 06:07:48 -0000 1.3
@@ -144,10 +144,10 @@
jk_channel_socket_private_t *socketInfo=
(jk_channel_socket_private_t *)(_this->_privatePtr);
- if( strcmp( "host", name ) != 0 ) {
+ if( strcmp( "host", name ) == 0 ) {
socketInfo->host=value;
- } else if( strcmp( "defaultPort", name ) != 0 ) {
- } else if( strcmp( "port", name ) != 0 ) {
+ } else if( strcmp( "port", name ) == 0 ) {
+ socketInfo->port=atoi( value );
} else {
return JK_FALSE;
}
@@ -157,42 +157,30 @@
/** resolve the host IP ( jk_resolve ) and initialize the channel.
*/
static int JK_METHOD jk2_channel_socket_init(jk_env_t *env,
- jk_channel_t *_this,
- jk_map_t *props,
- char *worker_name,
- jk_worker_t *worker )
+ jk_channel_t *_this)
{
- int err;
jk_channel_socket_private_t *socketInfo=
(jk_channel_socket_private_t *)(_this->_privatePtr);
+ int rc;
char *host=socketInfo->host;
short port=socketInfo->port;
- jk_workerEnv_t *workerEnv=worker->workerEnv;
- char *tmp;
- host = jk2_map_getStrProp( env, props,
- "worker", worker_name, "host", host);
- tmp = jk2_map_getStrProp( env, props,
- "worker", worker_name, "port", NULL );
- if( tmp != NULL )
- port=jk2_map_str2int( env, tmp);
-
- _this->worker=worker;
- _this->properties=props;
+ if( port<=0 )
+ port=8007;
if( host==NULL )
host=DEFAULT_HOST;
-
- err=jk2_channel_socket_resolve( env, host, port, socketInfo );
- if( err!= JK_TRUE ) {
+
+ rc=jk2_channel_socket_resolve( env, host, port, socketInfo );
+ if( rc!= JK_TRUE ) {
env->l->jkLog(env, env->l, JK_LOG_ERROR, "jk2_channel_socket_init: "
"can't resolve %s:%d errno=%d\n", host, port, errno );
}
env->l->jkLog(env, env->l, JK_LOG_INFO,
"channel_socket.init(): %s:%d for %s\n", host,
- port, worker->name );
+ port, _this->worker->name );
- return err;
+ return rc;
}
/** private: resolve the address on init
@@ -557,17 +545,10 @@
_this->init= jk2_channel_socket_init;
_this->open= jk2_channel_socket_open;
_this->close= jk2_channel_socket_close;
- _this->getProperty= jk2_channel_socket_getProperty;
+ /* _this->getProperty= jk2_channel_socket_getProperty; */
_this->setProperty= jk2_channel_socket_setProperty;
- _this->supportedProperties=( char ** )pool->alloc( env, pool,
- 4 * sizeof( char * ));
- _this->supportedProperties[0]="host";
- _this->supportedProperties[1]="port";
- _this->supportedProperties[2]="defaultPort";
- _this->supportedProperties[3]="\0";
-
- _this->name="file";
+ _this->name="aprSocket";
*result= _this;
_this->is_stream=JK_TRUE;
1.4 +13 -17 jakarta-tomcat-connectors/jk/native2/common/jk_channel_jni.c
Index: jk_channel_jni.c
===================================================================
RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/common/jk_channel_jni.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- jk_channel_jni.c 21 Feb 2002 11:09:31 -0000 1.3
+++ jk_channel_jni.c 2 Mar 2002 06:07:48 -0000 1.4
@@ -101,30 +101,25 @@
int JK_METHOD jk2_channel_jni_factory(jk_env_t *env, jk_pool_t *pool,
void **result,
- const char *type, const char
*name);
+ const char *type, const char *name);
-static int JK_METHOD jk2_channel_jni_init(jk_env_t *env,
- jk_channel_t *_this,
- jk_map_t *props,
- char *worker_name,
- jk_worker_t *worker )
+static int JK_METHOD jk2_channel_jni_setProperty(jk_env_t *env,
+ jk_channel_t *_this,
+ char *name, char *value)
{
- int err;
- char *tmp;
+ return JK_TRUE;
+}
+static int JK_METHOD jk2_channel_jni_init(jk_env_t *env,
+ jk_channel_t *_this)
+{
/* the channel is init-ed during a worker validation. If a jni worker
is not already defined... well, not good. But on open we should
have it.
*/
-
-
- _this->worker=worker;
- _this->properties=props;
-
- env->l->jkLog(env, env->l, JK_LOG_INFO,
- "channel_jni.init(): %s\n",
- worker->name );
+ env->l->jkLog(env, env->l, JK_LOG_INFO,"channel_jni.init(): %s\n",
+ _this->worker->name );
return JK_TRUE;
}
@@ -611,7 +606,8 @@
}
_this=(jk_channel_t *)pool->calloc(env, pool, sizeof( jk_channel_t));
- _this->recv= jk2_channel_jni_recv;
+ _this->recv= jk2_channel_jni_recv;
+ _this->setProperty= jk2_channel_jni_setProperty;
_this->send= jk2_channel_jni_send;
_this->init= jk2_channel_jni_init;
_this->open= jk2_channel_jni_open;
1.14 +14 -34 jakarta-tomcat-connectors/jk/native2/common/jk_channel_socket.c
Index: jk_channel_socket.c
===================================================================
RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/common/jk_channel_socket.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- jk_channel_socket.c 21 Feb 2002 11:09:31 -0000 1.13
+++ jk_channel_socket.c 2 Mar 2002 06:07:48 -0000 1.14
@@ -135,10 +135,10 @@
jk_channel_socket_private_t *socketInfo=
(jk_channel_socket_private_t *)(_this->_privatePtr);
- if( strcmp( "host", name ) != 0 ) {
+ if( strcmp( "host", name ) == 0 ) {
socketInfo->host=value;
- } else if( strcmp( "defaultPort", name ) != 0 ) {
- } else if( strcmp( "port", name ) != 0 ) {
+ } else if( strcmp( "port", name ) == 0 ) {
+ socketInfo->port=atoi( value );
} else {
return JK_FALSE;
}
@@ -148,43 +148,30 @@
/** resolve the host IP ( jk_resolve ) and initialize the channel.
*/
static int JK_METHOD jk2_channel_socket_init(jk_env_t *env,
- jk_channel_t *_this,
- jk_map_t *props,
- char *worker_name,
- jk_worker_t *worker )
+ jk_channel_t *_this )
{
- int err;
jk_channel_socket_private_t *socketInfo=
(jk_channel_socket_private_t *)(_this->_privatePtr);
+ int rc;
char *host=socketInfo->host;
short port=socketInfo->port;
- struct sockaddr_in *rc=&socketInfo->addr;
- jk_workerEnv_t *workerEnv=worker->workerEnv;
- char *tmp;
- host = jk2_map_getStrProp( env, props,
- "worker", worker_name, "host", host);
- tmp = jk2_map_getStrProp( env, props,
- "worker", worker_name, "port", "8007" );
- if( tmp != NULL )
- port=jk2_map_str2int( env, tmp);
-
- _this->worker=worker;
- _this->properties=props;
+ if( port<=0 )
+ port=8007;
if( host==NULL )
host=DEFAULT_HOST;
- err=jk2_channel_socket_resolve( env, host, port, rc );
- if( err!= JK_TRUE ) {
+ rc=jk2_channel_socket_resolve( env, host, port, &socketInfo->addr );
+ if( rc!= JK_TRUE ) {
env->l->jkLog(env, env->l, JK_LOG_ERROR, "jk2_channel_socket_init: "
- "can't resolve %s:%d errno=%d\n", host, port, errno );
+ "can't resolve %s:%d errno=%d\n", host, port, errno );
}
env->l->jkLog(env, env->l, JK_LOG_INFO,
"channel_socket.init(): %s:%d for %s\n", host,
- port, worker->name );
-
- return err;
+ port, _this->worker->name );
+
+ return rc;
}
/** private: resolve the address on init
@@ -490,15 +477,8 @@
_this->init= jk2_channel_socket_init;
_this->open= jk2_channel_socket_open;
_this->close= jk2_channel_socket_close;
- _this->getProperty= jk2_channel_socket_getProperty;
+/* _this->getProperty= jk2_channel_socket_getProperty; */
_this->setProperty= jk2_channel_socket_setProperty;
-
- _this->supportedProperties=( char ** )pool->alloc( env, pool,
- 4 * sizeof( char * ));
- _this->supportedProperties[0]="host";
- _this->supportedProperties[1]="port";
- _this->supportedProperties[2]="defaultPort";
- _this->supportedProperties[3]="\0";
_this->name="file";
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>