]> granicus.if.org Git - php/commitdiff
Merge branch 'PHP-5.6'
authorDaniel Lowrey <rdlowrey@php.net>
Wed, 6 Aug 2014 02:58:45 +0000 (22:58 -0400)
committerDaniel Lowrey <rdlowrey@php.net>
Wed, 6 Aug 2014 02:58:45 +0000 (22:58 -0400)
1  2 
main/streams/xp_socket.c

index a6dc1159624cc8a39550d4fce8d03b2e6ab46032,c7b5a7098d31e1a72a42b87df2f784c7dadee29f..b4eda4b4723742b15eb89fa089e8c63ec9f74840
@@@ -599,8 -601,28 +601,28 @@@ static inline int php_tcp_sockop_bind(p
                return -1;
        }
  
 -              && zend_is_true(*tmpzval)
+ #ifdef SO_REUSEPORT
+       if (stream->context
+               && php_stream_context_get_option(stream->context, "socket", "so_reuseport", &tmpzval) == SUCCESS
 -              && zend_is_true(*tmpzval)
++              && zend_is_true(*tmpzval TSRMLS_CC)
+       ) {
+               sockopts |= STREAM_SOCKOP_SO_REUSEPORT;
+       }
+ #endif
+ #ifdef SO_BROADCAST
+       if (&php_stream_udp_socket_ops /* SO_BROADCAST is only applicable for UDP */
+               && stream->context
+               && php_stream_context_get_option(stream->context, "socket", "so_broadcast", &tmpzval) == SUCCESS
++              && zend_is_true(*tmpzval TSRMLS_CC)
+       ) {
+               sockopts |= STREAM_SOCKOP_SO_BROADCAST;
+       }
+ #endif
        sock->socket = php_network_bind_socket_to_local_addr(host, portno,
                        stream->ops == &php_stream_udp_socket_ops ? SOCK_DGRAM : SOCK_STREAM,
+                       sockopts,
                        xparam->want_errortext ? &xparam->outputs.error_text : NULL,
                        &err
                        TSRMLS_CC);
@@@ -665,6 -688,16 +688,16 @@@ static inline int php_tcp_sockop_connec
                bindto = parse_ip_address_ex(Z_STRVAL_PP(tmpzval), Z_STRLEN_PP(tmpzval), &bindport, xparam->want_errortext, &xparam->outputs.error_text TSRMLS_CC);
        }
  
 -              && zend_is_true(*tmpzval)
+ #ifdef SO_BROADCAST
+       if (&php_stream_udp_socket_ops /* SO_BROADCAST is only applicable for UDP */
+               && stream->context
+               && php_stream_context_get_option(stream->context, "socket", "so_broadcast", &tmpzval) == SUCCESS
++              && zend_is_true(*tmpzval TSRMLS_CC)
+       ) {
+               sockopts |= STREAM_SOCKOP_SO_BROADCAST;
+       }
+ #endif
        /* Note: the test here for php_stream_udp_socket_ops is important, because we
         * want the default to be TCP sockets so that the openssl extension can
         * re-use this code. */