-/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
- *
- * Libmemcached library
- *
- * Copyright (C) 2011 Data Differential, http://datadifferential.com/
- * Copyright (C) 2006-2009 Brian Aker All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- *
- * * The names of its contributors may not be used to endorse or
- * promote products derived from this software without specific prior
- * written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- */
-
-#include <libmemcached/common.h>
-
-static inline void _server_init(memcached_instance_st* self, Memcached *root,
- const memcached_string_t& hostname,
- in_port_t port,
- uint32_t weight, memcached_connection_t type)
-{
- self->options.is_shutting_down= false;
- self->options.is_dead= false;
- self->options.ready= false;
- self->_events= 0;
- self->_revents= 0;
- self->cursor_active_= 0;
- self->port_= port;
- self->fd= INVALID_SOCKET;
- self->io_bytes_sent= 0;
- self->request_id= 0;
- self->server_failure_counter= 0;
- self->server_failure_counter_query_id= 0;
- self->server_timeout_counter= 0;
- self->server_timeout_counter_query_id= 0;
- self->weight= weight ? weight : 1; // 1 is the default weight value
- self->io_wait_count.read= 0;
- self->io_wait_count.write= 0;
- self->io_wait_count.timeouts= 0;
- self->io_wait_count._bytes_read= 0;
- self->major_version= UINT8_MAX;
- self->micro_version= UINT8_MAX;
- self->minor_version= UINT8_MAX;
- self->type= type;
- self->error_messages= NULL;
- self->read_ptr= self->read_buffer;
- self->read_buffer_length= 0;
- self->write_buffer_offset= 0;
- self->address_info= NULL;
- self->address_info_next= NULL;
-
- self->state= MEMCACHED_SERVER_STATE_NEW;
- self->next_retry= 0;
-
- self->root= root;
- if (root)
- {
- self->version= ++root->server_info.version;
- }
- else
- {
- self->version= UINT_MAX;
+/*
+ +--------------------------------------------------------------------+
+ | libmemcached - C/C++ Client Library for memcached |
+ +--------------------------------------------------------------------+
+ | Redistribution and use in source and binary forms, with or without |
+ | modification, are permitted under the terms of the BSD license. |
+ | You should have received a copy of the license in a bundled file |
+ | named LICENSE; in case you did not receive a copy you can review |
+ | the terms online at: https://opensource.org/licenses/BSD-3-Clause |
+ +--------------------------------------------------------------------+
+ | Copyright (c) 2006-2014 Brian Aker https://datadifferential.com/ |
+ | Copyright (c) 2020 Michael Wallner <mike@php.net> |
+ +--------------------------------------------------------------------+
+*/
+
+#include "libmemcached/common.h"
+
+static inline void _server_init(memcached_instance_st *self, Memcached *root,
+ const memcached_string_t &hostname, in_port_t port, uint32_t weight,
+ memcached_connection_t type) {
+ self->options.is_shutting_down = false;
+ self->options.is_dead = false;
+ self->options.ready = false;
+ self->_events = 0;
+ self->_revents = 0;
+ self->cursor_active_ = 0;
+ self->port_ = port;
+ self->fd = INVALID_SOCKET;
+ self->io_bytes_sent = 0;
+ self->request_id = 0;
+ self->server_failure_counter = 0;
+ self->server_failure_counter_query_id = 0;
+ self->server_timeout_counter = 0;
+ self->server_timeout_counter_query_id = 0;
+ self->weight = weight ? weight : 1; // 1 is the default weight value
+ self->io_wait_count.read = 0;
+ self->io_wait_count.write = 0;
+ self->io_wait_count.timeouts = 0;
+ self->io_wait_count._bytes_read = 0;
+ self->major_version = UINT8_MAX;
+ self->micro_version = UINT8_MAX;
+ self->minor_version = UINT8_MAX;
+ self->type = type;
+ self->error_messages = NULL;
+ self->read_ptr = self->read_buffer;
+ self->read_buffer_length = 0;
+ self->write_buffer_offset = 0;
+ self->address_info = NULL;
+ self->address_info_next = NULL;
+
+ self->state = MEMCACHED_SERVER_STATE_NEW;
+ self->next_retry = 0;
+
+ self->root = root;
+ if (root) {
+ self->version = ++root->server_info.version;
+ } else {
+ self->version = UINT_MAX;