Return-Path: Delivered-To: apmail-apr-dev-archive@apr.apache.org Received: (qmail 10119 invoked by uid 500); 30 Jan 2003 16:29:05 -0000 Mailing-List: contact dev-help@apr.apache.org; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Delivered-To: mailing list dev@apr.apache.org Received: (qmail 10061 invoked from network); 30 Jan 2003 16:29:03 -0000 Subject: Re: [PATCH] apr-util/buckets/apr_buckets_socket.c UDP friendly From: "Philippe M. Chiasson" To: David Reid Cc: dev@apr.apache.org In-Reply-To: <00a401c2c875$6899e480$7500a8c0@goliath> References: <1043939442.11531.4.camel@shou.sg.ectoplasm.org> <00a401c2c875$6899e480$7500a8c0@goliath> Content-Type: text/plain Content-Transfer-Encoding: 7bit X-Mailer: Ximian Evolution 1.0.8 (1.0.8-10) Date: 31 Jan 2003 00:28:51 +0800 Message-Id: <1043944131.11531.6.camel@shou.sg.ectoplasm.org> Mime-Version: 1.0 X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N 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" > To: > 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}'