Author: mturk
Date: Tue Feb 7 07:24:06 2006
New Revision: 375626
URL: http://svn.apache.org/viewcvs?rev=375626&view=rev
Log:
Make sure that all the bytes are send when
calling sendbb. Since APR might return partial
writes, add a loop that will resolve that.
Modified:
tomcat/connectors/trunk/jni/native/src/network.c
Modified: tomcat/connectors/trunk/jni/native/src/network.c
URL:
http://svn.apache.org/viewcvs/tomcat/connectors/trunk/jni/native/src/network.c?rev=375626&r1=375625&r2=375626&view=diff
==============================================================================
--- tomcat/connectors/trunk/jni/native/src/network.c (original)
+++ tomcat/connectors/trunk/jni/native/src/network.c Tue Feb 7 07:24:06 2006
@@ -280,7 +280,7 @@
GET_S_FAMILY(f, family);
GET_S_TYPE(t, type);
- if (family >= 0) {
+ if (family >= 0) {
TCN_THROW_IF_ERR(apr_socket_create(&s,
f, t, protocol, p), a);
}
@@ -592,6 +592,7 @@
{
tcn_socket_t *s = J2P(sock, tcn_socket_t *);
apr_size_t nbytes = (apr_size_t)len;
+ apr_size_t sent = 0;
apr_status_t ss;
UNREFERENCED_STDARGS;
@@ -605,10 +606,15 @@
sp_num_send++;
#endif
- ss = (*s->net->send)(s->opaque, s->jsbbuff + offset, &nbytes);
-
+ while (sent < nbytes) {
+ apr_size_t wr = nbytes - sent;
+ ss = (*s->net->send)(s->opaque, s->jsbbuff + offset + sent, &wr);
+ if (ss != APR_SUCCESS)
+ break;
+ sent += wr;
+ }
if (ss == APR_SUCCESS)
- return (jint)nbytes;
+ return (jint)sent;
else {
TCN_ERROR_WRAP(ss);
return -(jint)ss;
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]