cvs: php-src /main/streams transports.c xp_socket.c

From: Date: Sat, 31 Jul 2004 10:56:55 +0000
Subject: cvs: php-src /main/streams transports.c xp_socket.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-28116@lists.php.net to get a copy of this message
wez Sat Jul 31 06:56:55 2004 EDT Modified files: /php-src/main/streams transports.c xp_socket.c Log: Misc sendto/recvfrom tweaks that have been pending here for a while... http://cvs.php.net/diff.php/php-src/main/streams/transports.c?r1=1.12&r2=1.13&ty=u Index: php-src/main/streams/transports.c diff -u php-src/main/streams/transports.c:1.12 php-src/main/streams/transports.c:1.13 --- php-src/main/streams/transports.c:1.12 Wed Feb 4 17:46:44 2004 +++ php-src/main/streams/transports.c Sat Jul 31 06:56:55 2004 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: transports.c,v 1.12 2004/02/04 22:46:44 wez Exp $ */ +/* $Id: transports.c,v 1.13 2004/07/31 10:56:55 wez Exp $ */ #include "php.h" #include "php_streams_int.h" @@ -385,6 +385,7 @@ php_stream_xport_param param; int ret = 0; int recvd_len = 0; +#if 0 int oob; if (flags == 0 && addr == NULL) { @@ -416,6 +417,7 @@ return recvd_len; } } +#endif /* otherwise, we are going to bypass the buffer */ @@ -453,9 +455,11 @@ int ret = 0; int oob; +#if 0 if (flags == 0 && addr == NULL) { return php_stream_write(stream, buf, buflen); } +#endif oob = (flags & STREAM_OOB) == STREAM_OOB; http://cvs.php.net/diff.php/php-src/main/streams/xp_socket.c?r1=1.24&r2=1.25&ty=u Index: php-src/main/streams/xp_socket.c diff -u php-src/main/streams/xp_socket.c:1.24 php-src/main/streams/xp_socket.c:1.25 --- php-src/main/streams/xp_socket.c:1.24 Sat Jul 31 06:49:09 2004 +++ php-src/main/streams/xp_socket.c Sat Jul 31 06:56:55 2004 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: xp_socket.c,v 1.24 2004/07/31 10:49:09 wez Exp $ */ +/* $Id: xp_socket.c,v 1.25 2004/07/31 10:56:55 wez Exp $ */ #include "php.h" #include "ext/standard/file.h" @@ -185,8 +185,11 @@ static int php_sockop_flush(php_stream *stream TSRMLS_DC) { +#if 0 php_netstream_data_t *sock = (php_netstream_data_t*)stream->abstract; return fsync(sock->socket); +#endif + return 0; } static int php_sockop_stat(php_stream *stream, php_stream_statbuf *ssb TSRMLS_DC) @@ -195,6 +198,16 @@ return fstat(sock->socket, &ssb->sb); } +static inline int sock_sendto(php_netstream_data_t *sock, char *buf, size_t buflen, int flags, + struct sockaddr *addr, socklen_t addrlen + TSRMLS_DC) +{ + if (addr) { + return sendto(sock->socket, buf, buflen, flags, addr, addrlen); + } + return send(sock->socket, buf, buflen, flags); +} + static inline int sock_recvfrom(php_netstream_data_t *sock, char *buf, size_t buflen, int flags, char **textaddr, long *textaddrlen, struct sockaddr **addr, socklen_t *addrlen @@ -314,7 +327,7 @@ if ((xparam->inputs.flags & STREAM_OOB) == STREAM_OOB) { flags |= MSG_OOB; } - xparam->outputs.returncode = sendto(sock->socket, + xparam->outputs.returncode = sock_sendto(sock, xparam->inputs.buf, xparam->inputs.buflen, flags, xparam->inputs.addr,

« previous php.cvs (#28116) next »