Commit 14df53e0 authored by Alberto Miranda's avatar Alberto Miranda ♨️
Browse files

Rename NORNSCTL_CMD_PAUSE_ACCEPT to NORNSCTL_CMD_PAUSE_LISTEN

parent f15c5f5e
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -41,7 +41,7 @@ typedef uint32_t nornsctl_backend_flags_t;
/* Administrative command IDs valid for nornsctl_send_command() */
typedef enum {
    NORNSCTL_CMD_PING = 1000,
    NORNSCTL_CMD_PAUSE_ACCEPT,
    NORNSCTL_CMD_PAUSE_LISTEN,
    NORNSCTL_CMD_RESUME_ACCEPT,
    NORNSCTL_CMD_SHUTDOWN,
} nornsctl_command_t;
+4 −4
Original line number Diff line number Diff line
@@ -81,8 +81,8 @@ norns::command_type decode_command(::google::protobuf::uint32 type) {
    switch(type) {
        case NORNSCTL_CMD_PING:
            return command_type::ping;
        case NORNSCTL_CMD_PAUSE_ACCEPT:
            return command_type::pause_accept;
        case NORNSCTL_CMD_PAUSE_LISTEN:
            return command_type::pause_listen;
        case NORNSCTL_CMD_RESUME_ACCEPT:
            return command_type::resume_accept;
        case NORNSCTL_CMD_SHUTDOWN:
@@ -429,8 +429,8 @@ std::string command_request::to_string() const {
    switch(this->get<0>()) {
        case command_type::ping:
            return "PING";
        case command_type::pause_accept:
            return "PAUSE_ACCEPT";
        case command_type::pause_listen:
            return "PAUSE_LISTEN";
        case command_type::resume_accept:
            return "RESUME_ACCEPT";
        case command_type::shutdown:
+1 −1
Original line number Diff line number Diff line
@@ -64,7 +64,7 @@ enum class backend_type {

enum class command_type {
    ping,
    pause_accept,
    pause_listen,
    resume_accept,
    shutdown,
    unknown
+4 −4
Original line number Diff line number Diff line
@@ -585,8 +585,8 @@ urd::command_handler(const request_ptr base_request) {
    switch(request->get<0>()) {
        case command_type::ping:
            break; // nothing special to do here
        case command_type::pause_accept:
            pause_accept();
        case command_type::pause_listen:
            pause_listening();
            break;
        case command_type::resume_accept:
            resume_accept();
@@ -594,7 +594,7 @@ urd::command_handler(const request_ptr base_request) {
        case command_type::shutdown:
        {
            LOGGER_WARN("Shutdown requested!");
            pause_accept();
            pause_listening();

            const auto rv = check_shutdown();
            resp->set_error_code(rv);
@@ -1032,7 +1032,7 @@ void urd::print_farewell() {
    LOGGER_INFO("{}", fsep);
}

void urd::pause_accept() {
void urd::pause_listening() {
    bool expected = false;
    while(!m_is_paused.compare_exchange_weak(expected, true) && !expected);

+1 −1
Original line number Diff line number Diff line
@@ -123,7 +123,7 @@ private:
                               bool track, const bfs::path& mount, 
                               uint32_t quota);

    void pause_accept();
    void pause_listening();
    void resume_accept();
    urd_error check_shutdown();

Loading