<commit_before>#include "memcached/memcached_client.hxx"
#include "http_response.hxx"
#include "async.hxx"
#include "system/fd-util.h"
#include "system/fd_util.h"
#include "growing_buffer.hxx"
#include "header_writer.hxx"
#include "lease.hxx"
#include "direct.hxx"
#include "istream/istream_internal.hxx"
#include "fb_pool.hxx"
#include "pool.hxx"
#include "util/Cast.hxx"

#include <glib.h>

#include <sys/types.h>
#include <sys/socket.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <signal.h>
#include <event.h>

static inline GQuark
test_quark(void)
{
    return g_quark_from_static_string("test");
}

static int
connect_fake_server(void)
{
    int ret, sv[2];
    pid_t pid;

    ret = socketpair_cloexec(AF_UNIX, SOCK_STREAM, 0, sv);
    if (ret < 0) {
        perror("socketpair() failed");
        exit(EXIT_FAILURE);
    }

    pid = fork();
    if (pid < 0) {
        perror("fork() failed");
        exit(EXIT_FAILURE);
    }

    if (pid == 0) {
        dup2(sv[1], 0);
        dup2(sv[1], 1);
        close(sv[0]);
        close(sv[1]);
        execl("./test/fake_memcached_server", "fake_memcached_server",
              nullptr);
        perror("exec() failed");
        exit(EXIT_FAILURE);
    }

    close(sv[1]);

    fd_set_nonblock(sv[0], true);

    return sv[0];
}

struct context final : Lease {
    struct pool *pool;

    unsigned data_blocking = 0;
    bool close_value_early = false;
    bool close_value_late = false;
    bool close_value_data = false;
    struct async_operation_ref async_ref;
    int fd = -1;
    bool released = false, reuse = false, got_response = false;
    enum memcached_response_status status;

    struct istream *delayed = nullptr;

    struct istream *value = nullptr;
    off_t value_data = 0, consumed_value_data = 0;
    bool value_eof = false, value_abort = false, value_closed = false;

    struct istream request_value;

    /* virtual methods from class Lease */
    void ReleaseLease(bool _reuse) override {
        close(fd);
        fd = -1;
        released = true;
        reuse = _reuse;
    }
};

/*
 * request value istream
 *
 */

static char request_value[8192];

struct RequestValueIstream {
    struct istream base;

    struct async_operation_ref async_ref;
<commit_msg>test/t_memcached_client: remove unused attribute<commit_after>#include "memcached/memcached_client.hxx"
#include "http_response.hxx"
#include "async.hxx"
#include "system/fd-util.h"
#include "system/fd_util.h"
#include "growing_buffer.hxx"
#include "header_writer.hxx"
#include "lease.hxx"
#include "direct.hxx"
#include "istream/istream_internal.hxx"
#include "fb_pool.hxx"
#include "pool.hxx"
#include "util/Cast.hxx"

#include <glib.h>

#include <sys/types.h>
#include <sys/socket.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <signal.h>
#include <event.h>

static inline GQuark
test_quark(void)
{
    return g_quark_from_static_string("test");
}

static int
connect_fake_server(void)
{
    int ret, sv[2];
    pid_t pid;

    ret = socketpair_cloexec(AF_UNIX, SOCK_STREAM, 0, sv);
    if (ret < 0) {
        perror("socketpair() failed");
        exit(EXIT_FAILURE);
    }

    pid = fork();
    if (pid < 0) {
        perror("fork() failed");
        exit(EXIT_FAILURE);
    }

    if (pid == 0) {
        dup2(sv[1], 0);
        dup2(sv[1], 1);
        close(sv[0]);
        close(sv[1]);
        execl("./test/fake_memcached_server", "fake_memcached_server",
              nullptr);
        perror("exec() failed");
        exit(EXIT_FAILURE);
    }

    close(sv[1]);

    fd_set_nonblock(sv[0], true);

    return sv[0];
}

struct context final : Lease {
    struct pool *pool;

    unsigned data_blocking = 0;
    bool close_value_early = false;
    bool close_value_late = false;
    bool close_value_data = false;
    struct async_operation_ref async_ref;
    int fd = -1;
    bool released = false, reuse = false, got_response = false;
    enum memcached_response_status status;

    struct istream *delayed = nullptr;

    struct istream *value = nullptr;
    off_t value_data = 0, consumed_value_data = 0;
    bool value_eof = false, value_abort = false, value_closed = false;

    /* virtual methods from class Lease */
    void ReleaseLease(bool _reuse) override {
        close(fd);
        fd = -1;
        released = true;
        reuse = _reuse;
    }
};

/*
 * request value istream
 *
 */

static char request_value[8192];

struct RequestValueIstream {
    struct istream base;

    struct async_operation_ref async_ref;

{'fraction_non_alphanumeric': 0.12865880297072957, 'fraction_numerical': 0.010921799912625601, 'mean_word_length': 3.114106019766397, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3683870', 'n_tokens_mistral': 1666, 'n_tokens_neox': 1614, 'n_words': 370}