mturk 2005/04/23 08:51:03
Modified: jni/java/org/apache/tomcat/jni Socket.java
jni/native/src network.c poll.c
Log:
Remove 'senfilet' function, because it's useless. Also return
the error from Poll.poll
Revision Changes Path
1.13 +1 -24
jakarta-tomcat-connectors/jni/java/org/apache/tomcat/jni/Socket.java
Index: Socket.java
===================================================================
RCS file:
/home/cvs/jakarta-tomcat-connectors/jni/java/org/apache/tomcat/jni/Socket.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- Socket.java 18 Apr 2005 16:25:20 -0000 1.12
+++ Socket.java 23 Apr 2005 15:51:03 -0000 1.13
@@ -445,27 +445,4 @@
byte[][] trailers, long offset,
int len, int flags);
- /**
- * Send a file from an open file descriptor to a socket, along with
- * optional headers and trailers, with a timeout.
- * The number of bytes actually sent is stored in the len parameter.
- * The offset parameter is passed by reference for no reason; its
- * value will never be modified by the apr_socket_sendfile() function.
- * @param sock The socket to which we're writing
- * @param file The open file from which to read
- * @param headers Array containing the headers to send
- * @param trailers Array containing the trailers to send
- * @param offset Offset into the file where we should begin writing
- * @param len Number of bytes to send from the file
- * @param flags APR flags that are mapped to OS specific flags
- * @param timeout Socket timeout to use with the call. The original
- * socket timeout will be preserved.
- * @return Number of bytes actually sent, including headers,
- * file, and trailers
- *
- */
- public static native int sendfilet(long sock, long file, byte [][]
headers,
- byte[][] trailers, long offset,
- int len, int flags, long timeout);
-
}
1.14 +0 -73 jakarta-tomcat-connectors/jni/native/src/network.c
Index: network.c
===================================================================
RCS file: /home/cvs/jakarta-tomcat-connectors/jni/native/src/network.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- network.c 18 Apr 2005 16:22:23 -0000 1.13
+++ network.c 23 Apr 2005 15:51:03 -0000 1.14
@@ -577,76 +577,3 @@
else
return -(jint)ss;
}
-
-TCN_IMPLEMENT_CALL(jint, Socket, sendfilet)(TCN_STDARGS, jlong sock,
- jlong file,
- jobjectArray headers,
- jobjectArray trailers,
- jlong offset, jint len,
- jint flags, jlong timeout)
-{
- apr_socket_t *s = J2P(sock, apr_socket_t *);
- apr_file_t *f = J2P(file, apr_file_t *);
- jsize nh = 0;
- jsize nt = 0;
- jsize i;
- struct iovec hvec[APR_MAX_IOVEC_SIZE];
- struct iovec tvec[APR_MAX_IOVEC_SIZE];
- jobject hba[APR_MAX_IOVEC_SIZE];
- jobject tba[APR_MAX_IOVEC_SIZE];
- apr_off_t off = (apr_off_t)offset;
- apr_size_t written = (apr_size_t)len;
- apr_hdtr_t hdrs;
- apr_status_t ss;
- apr_interval_time_t t;
-
- UNREFERENCED(o);
- TCN_ASSERT(sock != 0);
- TCN_ASSERT(file != 0);
-
- if (headers)
- nh = (*e)->GetArrayLength(e, headers);
- if (trailers)
- nt = (*e)->GetArrayLength(e, trailers);
- /* Check for overflow */
- if (nh >= APR_MAX_IOVEC_SIZE || nt >= APR_MAX_IOVEC_SIZE)
- return (jint)(-APR_ENOMEM);
- if ((ss = apr_socket_timeout_get(s, &t)) != APR_SUCCESS)
- return -(jint)ss;
- if ((ss = apr_socket_timeout_set(s, J2T(timeout))) != APR_SUCCESS)
- return -(jint)ss;
-
- for (i = 0; i < nh; i++) {
- hba[i] = (*e)->GetObjectArrayElement(e, headers, i);
- hvec[i].iov_len = (*e)->GetArrayLength(e, hba[i]);
- hvec[i].iov_base = (*e)->GetByteArrayElements(e, hba[i], NULL);
- }
- for (i = 0; i < nt; i++) {
- tba[i] = (*e)->GetObjectArrayElement(e, trailers, i);
- tvec[i].iov_len = (*e)->GetArrayLength(e, tba[i]);
- tvec[i].iov_base = (*e)->GetByteArrayElements(e, tba[i], NULL);
- }
- hdrs.headers = &hvec[0];
- hdrs.numheaders = nh;
- hdrs.trailers = &tvec[0];
- hdrs.numtrailers = nt;
-
- ss = apr_socket_sendfile(s, f, &hdrs, &off, &written,
(apr_int32_t)flags);
- /* Resore the original timeout */
- apr_socket_timeout_set(s, t);
-
- for (i = 0; i < nh; i++) {
- (*e)->ReleaseByteArrayElements(e, hba[i], hvec[i].iov_base,
JNI_ABORT);
- }
-
- for (i = 0; i < nt; i++) {
- (*e)->ReleaseByteArrayElements(e, tba[i], tvec[i].iov_base,
JNI_ABORT);
- }
- /* Return Number of bytes actually sent,
- * including headers, file, and trailers
- */
- if (ss == APR_SUCCESS)
- return (jint)written;
- else
- return -(jint)ss;
-}
1.12 +3 -3 jakarta-tomcat-connectors/jni/native/src/poll.c
Index: poll.c
===================================================================
RCS file: /home/cvs/jakarta-tomcat-connectors/jni/native/src/poll.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- poll.c 19 Apr 2005 19:13:16 -0000 1.11
+++ poll.c 23 Apr 2005 15:51:03 -0000 1.12
@@ -157,9 +157,9 @@
if (rv != APR_SUCCESS)
return (jint)(-rv);
- if (apr_pollset_poll(p->pollset, J2T(timeout), &num, &fd) != APR_SUCCESS)
- num = 0;
-
+ if ((rv = apr_pollset_poll(p->pollset, J2T(timeout), &num, &fd) !=
APR_SUCCESS)) {
+ num = (apr_int32_t)(-rv);
+ }
if (num > 0) {
for (i = 0; i < num; i++) {
pset[i*4+0] = (jlong)(fd->rtnevents);
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]