<commit_before>// vim: sw=4 ts=4 et :
#include "server.h"

connection_t *first_connection;
connection_t *last_connection;

void server() {
    int s, rc, cs, one = 1;
    struct sockaddr_in addr;
    struct sockaddr_in client;
    socklen_t client_len = sizeof(client);

    if (server_started != 0) {
        panic("Server is already running!");
    }

    s_levels_init();

    server_started = 1;

    s_levels_init();

    addr.sin_family      = AF_INET;
    addr.sin_port        = htons(SERVER_PORT);
    addr.sin_addr.s_addr = INADDR_ANY;

    if ((s = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)) < 0) {
        panic("Unable to create server socket!");
    }

    if ((rc = setsockopt(s, SOL_SOCKET, SO_REUSEADDR, (const void *)&one,
                    sizeof(int))) < 0) {
        panic("Unable to set server socket SO_REUSEADDR!");
    }

    if ((rc = bind(s, (const struct sockaddr *)&addr, sizeof(addr))) < 0) {
        panic("Unable to bind server socket!");
    }

    if ((rc = listen(s, SERVER_BACKLOG)) < 0) {
        panic("Unable to set server socket backlog!");
    }

    /*
     * Here we define some stuff for common client-size submodules like chat.
     */

    if ((schat = malloc(2)) == NULL) {
        panic("Unable to allocate server chat buffer!");
    }<commit_msg>Fix s_level_init() merging<commit_after>// vim: sw=4 ts=4 et :
#include "server.h"

connection_t *first_connection;
connection_t *last_connection;

void server() {
    int s, rc, cs, one = 1;
    struct sockaddr_in addr;
    struct sockaddr_in client;
    socklen_t client_len = sizeof(client);

    if (server_started != 0) {
        panic("Server is already running!");
    }

    s_levels_init();

    server_started = 1;

    addr.sin_family      = AF_INET;
    addr.sin_port        = htons(SERVER_PORT);
    addr.sin_addr.s_addr = INADDR_ANY;

    if ((s = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)) < 0) {
        panic("Unable to create server socket!");
    }

    if ((rc = setsockopt(s, SOL_SOCKET, SO_REUSEADDR, (const void *)&one,
                    sizeof(int))) < 0) {
        panic("Unable to set server socket SO_REUSEADDR!");
    }

    if ((rc = bind(s, (const struct sockaddr *)&addr, sizeof(addr))) < 0) {
        panic("Unable to bind server socket!");
    }

    if ((rc = listen(s, SERVER_BACKLOG)) < 0) {
        panic("Unable to set server socket backlog!");
    }

    /*
     * Here we define some stuff for common client-size submodules like chat.
     */

    if ((schat = malloc(2)) == NULL) {
        panic("Unable to allocate server chat buffer!");
    }
{'fraction_non_alphanumeric': 0.13279132791327913, 'fraction_numerical': 0.007742934572202865, 'mean_word_length': 2.6343178621659633, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 3, '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': '4957858', 'n_tokens_mistral': 881, 'n_tokens_neox': 838, 'n_words': 237}