-static memcached_return udp_connect(memcached_server_st *ptr)
-{
- if (ptr->fd == -1)
- {
- /* Old connection junk still is in the structure */
- WATCHPOINT_ASSERT(ptr->cursor_active == 0);
-
- /*
- If we have not allocated the hosts object.
- Or if the cache has not been set.
- */
- if (ptr->sockaddr_inited == MEMCACHED_NOT_ALLOCATED ||
- (!(ptr->root->flags & MEM_USE_CACHE_LOOKUPS)))
- {
- memcached_return rc;
-
- rc= set_hostinfo(ptr);
- if (rc != MEMCACHED_SUCCESS)
- return rc;
-
- ptr->sockaddr_inited= MEMCACHED_ALLOCATED;
- }
-
- /* Create the socket */
- if ((ptr->fd= socket(AF_INET, SOCK_DGRAM, 0)) < 0)
- {
- ptr->cached_errno= errno;
- return MEMCACHED_CONNECTION_SOCKET_CREATE_FAILURE;
- }
- }
-
- return MEMCACHED_SUCCESS;
-}
-
-static memcached_return tcp_connect(memcached_server_st *ptr)