apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Philippe M. Chiasson" <go...@cpan.org>
Subject Re: [PATCH] apr-util/buckets/apr_buckets_socket.c UDP friendly
Date Thu, 30 Jan 2003 16:28:51 GMT
Oy!, sloppy fingers ...

Index: apr-util/buckets/apr_buckets_socket.c
===================================================================
RCS file: /home/cvspublic/apr-util/buckets/apr_buckets_socket.c,v
retrieving revision 1.45
diff -u -b -B -r1.45 apr_buckets_socket.c
--- apr-util/buckets/apr_buckets_socket.c	1 Jan 2003 00:02:17 -0000	1.45
+++ apr-util/buckets/apr_buckets_socket.c	30 Jan 2003 15:03:55 -0000
@@ -61,6 +61,8 @@
     char *buf;
     apr_status_t rv;
     apr_interval_time_t timeout;
+    apr_sockaddr_t *sa;
+    int protocol;
 
     if (block == APR_NONBLOCK_READ) {
         apr_socket_timeout_get(p, &timeout);
@@ -71,7 +73,15 @@
     *len = APR_BUCKET_BUFF_SIZE;
     buf = apr_bucket_alloc(*len, a->list); /* XXX: check for failure? */
 
-    rv = apr_socket_recv(p, buf, len);
+    apr_socket_protocol_get(p, &protocol);
+
+    if (protocol != APR_PROTO_UDP) {
+	rv = apr_recv(p, buf, len);
+    } 
+    else {
+        apr_socket_addr_get(&sa, APR_REMOTE, p);
+        rv = apr_recvfrom(sa, p, 0,buf, len);
+    }
 
     if (block == APR_NONBLOCK_READ) {
         apr_socket_timeout_set(p, timeout);
Index: apr-util/buckets/apr_buckets_socket.c
===================================================================
RCS file: /home/cvspublic/apr-util/buckets/apr_buckets_socket.c,v
retrieving revision 1.45
diff -u -b -B -r1.45 apr_buckets_socket.c
--- apr-util/buckets/apr_buckets_socket.c	1 Jan 2003 00:02:17 -0000	1.45
+++ apr-util/buckets/apr_buckets_socket.c	30 Jan 2003 15:04:40 -0000
@@ -61,6 +61,7 @@
     char *buf;
     apr_status_t rv;
     apr_interval_time_t timeout;
+    apr_sockaddr_t *sa;
 
     if (block == APR_NONBLOCK_READ) {
         apr_socket_timeout_get(p, &timeout);
@@ -71,7 +72,7 @@
     *len = APR_BUCKET_BUFF_SIZE;
     buf = apr_bucket_alloc(*len, a->list); /* XXX: check for failure? */
 
-    rv = apr_socket_recv(p, buf, len);
+    rv = apr_recvfrom(sa, p, 0,buf, len);
 
     if (block == APR_NONBLOCK_READ) {
         apr_socket_timeout_set(p, timeout);

On Thu, 2003-01-30 at 23:36, David Reid wrote:
> Phillipe, your patches missed the email. Maybe you'd like to rebook on a
> later email?
> 
> david
> 
> ----- Original Message -----
> From: "Philippe M. Chiasson" <gozer@cpan.org>
> To: <dev@apr.apache.org>
> Sent: Thursday, January 30, 2003 3:10 PM
> Subject: [PATCH] apr-util/buckets/apr_buckets_socket.c UDP friendly
> 
> 
> > I noticed that socket buckets don't use recvfrom when the underlying
> > socket is UDP. Without that, I have no way to send data back to the
> > client who initiated the request.
> >
> > Either of the following 2 patches fixes this.
> >
> > Thanks a lot.
> >
> > --------------------------------------------------------------------------
> ------
> > Philippe M. Chiasson /gozer\@(cpan|ectoplasm)\.org/ 88C3A5A5
> > (122FF51B/C634E37B)
> > http://gozer.ectoplasm.org/    F9BF E0C2 480E 7680 1AE5 3631 CB32 A107
> > 88C3 A5A5
> > Q: It is impossible to make anything foolproof because fools are so
> > ingenious.
> > perl
> > -e'$$=\${gozer};{$_=unpack(P7,pack(L,$$));/^JAm_pH\n$/&&print||$$++&&redo}
> '
> >
> >
> 
> 
-- 


--------------------------------------------------------------------------------
Philippe M. Chiasson /gozer\@(cpan|ectoplasm)\.org/ 88C3A5A5
(122FF51B/C634E37B)
http://gozer.ectoplasm.org/    F9BF E0C2 480E 7680 1AE5 3631 CB32 A107
88C3 A5A5
Q: It is impossible to make anything foolproof because fools are so
ingenious.
perl
-e'$$=\${gozer};{$_=unpack(P7,pack(L,$$));/^JAm_pH\n$/&&print||$$++&&redo}'


Mime
View raw message