You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by mt...@apache.org on 2006/02/08 13:35:11 UTC
svn commit: r375945 - /tomcat/connectors/trunk/jni/native/src/network.c
Author: mturk
Date: Wed Feb 8 04:35:08 2006
New Revision: 375945
URL: http://svn.apache.org/viewcvs?rev=375945&view=rev
Log:
Use send loop for all send(b) calls.
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=375945&r1=375944&r2=375945&view=diff
==============================================================================
--- tomcat/connectors/trunk/jni/native/src/network.c (original)
+++ tomcat/connectors/trunk/jni/native/src/network.c Wed Feb 8 04:35:08 2006
@@ -562,6 +562,7 @@
{
tcn_socket_t *s = J2P(sock, tcn_socket_t *);
apr_size_t nbytes = (apr_size_t)len;
+ apr_size_t sent = 0;
char *bytes;
apr_status_t ss;
@@ -577,10 +578,17 @@
#endif
bytes = (char *)(*e)->GetDirectBufferAddress(e, buf);
- ss = (*s->net->send)(s->opaque, bytes + offset, &nbytes);
+
+ while (sent < nbytes) {
+ apr_size_t wr = nbytes - sent;
+ ss = (*s->net->send)(s->opaque, bytes + 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;
@@ -607,11 +615,11 @@
#endif
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;
+ 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)sent;
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org