mturk 2005/06/13 03:48:55
Modified: jni/java/org/apache/tomcat/jni SSLSocket.java
jni/native/src sslnetwork.c
Log:
Added SSLSocket.destroy method so we can add the SSLSocket as
client data to the poller and destroy all the ssl objects in a single call.
Revision Changes Path
1.8 +11 -1
jakarta-tomcat-connectors/jni/java/org/apache/tomcat/jni/SSLSocket.java
Index: SSLSocket.java
===================================================================
RCS file:
/home/cvs/jakarta-tomcat-connectors/jni/java/org/apache/tomcat/jni/SSLSocket.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- SSLSocket.java 13 Jun 2005 07:31:11 -0000 1.7
+++ SSLSocket.java 13 Jun 2005 10:48:55 -0000 1.8
@@ -69,6 +69,16 @@
public static native int close(long thesocket);
/**
+ * Destroy the socket.
+ * <br />
+ * This function destroys the pool used for <code>attach</code> call.
+ * The main usage for this function is to allow the SSLSocket to be
+ * passed as client data to the Poll.
+ * @param thesocket The socket to destroy
+ */
+ public static native int destroy(long thesocket);
+
+ /**
* Send data over a network.
* <PRE>
* This functions acts like a blocking write by default. To change
1.11 +25 -3 jakarta-tomcat-connectors/jni/native/src/sslnetwork.c
Index: sslnetwork.c
===================================================================
RCS file: /home/cvs/jakarta-tomcat-connectors/jni/native/src/sslnetwork.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- sslnetwork.c 13 Jun 2005 07:31:11 -0000 1.10
+++ sslnetwork.c 13 Jun 2005 10:48:55 -0000 1.11
@@ -172,12 +172,27 @@
{
apr_interval_time_t timeout;
apr_pollfd_t pfd;
- int type = for_what == SSL_ERROR_WANT_WRITE ? APR_POLLOUT : APR_POLLIN;
+ int type;
apr_status_t status;
+ /* Figure out the the poll direction */
+ switch (for_what) {
+ case SSL_ERROR_WANT_WRITE:
+ case SSL_ERROR_WANT_CONNECT:
+ case SSL_ERROR_WANT_ACCEPT:
+ type = APR_POLLOUT;
+ break;
+ case SSL_ERROR_WANT_READ:
+ type = APR_POLLIN;
+ break;
+ default:
+ return APR_EINVAL;
+ break;
+ }
+
apr_socket_timeout_get(con->sock, &timeout);
pfd.desc_type = APR_POLL_SOCKET;
- pfd.desc.s = con->sock;
+ pfd.desc.s = con->sock;
pfd.reqevents = type;
/* Remove the object if it was in the pollset, then add in the new
@@ -249,6 +264,13 @@
return (jint)rv;
}
+TCN_IMPLEMENT_CALL(void, SSLSocket, destroy)(TCN_STDARGS, jlong sock)
+{
+ tcn_ssl_conn_t *con = J2P(sock, tcn_ssl_conn_t *);
+ UNREFERENCED_STDARGS;
+ apr_pool_destroy(con->pool);
+}
+
#define JFC_TEST 0
#if JFC_TEST
/*
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]