Skip to content

Commit

Permalink
#153 revert cancellation changes introduced in #147 (#155)
Browse files Browse the repository at this point in the history
* Revert "#147 retry up to 25 cancellations, proper resolution in progress (#154)"

This reverts commit 1702b43.

* Revert "#147 retry after cancellations up to 3 times (#149)"

This reverts commit 648f1c4.
  • Loading branch information
alex-courtis committed Jan 20, 2024
1 parent 5dba3e2 commit 319673d
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 49 deletions.
4 changes: 0 additions & 4 deletions inc/displ.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@

#include <stdint.h>

#define MAX_SEQUENTIAL_CANCELLATIONS 25

enum ConfigState {
IDLE = 0,
SUCCEEDED,
Expand All @@ -26,8 +24,6 @@ struct Displ {
uint32_t output_manager_version;

enum ConfigState config_state;

uint32_t sequential_cancellations;
};

void displ_init(void);
Expand Down
13 changes: 2 additions & 11 deletions src/layout.c
Original file line number Diff line number Diff line change
Expand Up @@ -386,15 +386,6 @@ void handle_failure(void) {
}
}

void handle_cancelled(void) {
if (displ->sequential_cancellations >= MAX_SEQUENTIAL_CANCELLATIONS) {
log_error("\nChanges cancelled %d times, exiting", MAX_SEQUENTIAL_CANCELLATIONS);
wd_exit_message(EXIT_FAILURE);
} else {
log_warn("\nChanges cancelled, retrying");
}
}

void layout(void) {

print_heads(INFO, ARRIVED, heads_arrived);
Expand All @@ -419,9 +410,9 @@ void layout(void) {
break;

case CANCELLED:
handle_cancelled();
log_warn("\nChanges cancelled, retrying");
displ->config_state = IDLE;
break;
return;

case IDLE:
default:
Expand Down
8 changes: 1 addition & 7 deletions src/listener_output_configuration.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,12 @@ void cleanup(struct Displ *displ,

zwlr_output_configuration_v1_destroy(zwlr_output_configuration_v1);

if (config_state == CANCELLED) {
displ->sequential_cancellations++;
} else {
displ->sequential_cancellations = 0;
}

displ->config_state = config_state;
}

static void succeeded(void *data,
struct zwlr_output_configuration_v1 *zwlr_output_configuration_v1) {
cleanup(data, zwlr_output_configuration_v1, CANCELLED);
cleanup(data, zwlr_output_configuration_v1, SUCCEEDED);
}

static void failed(void *data,
Expand Down
27 changes: 0 additions & 27 deletions tst/tst-layout.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
#include <wayland-util.h>

#include "cfg.h"
#include "displ.h"
#include "global.h"
#include "head.h"
#include "info.h"
Expand All @@ -27,7 +26,6 @@ void desire_transform(struct Head *head);
void desire_adaptive_sync(struct Head *head);
void handle_success(void);
void handle_failure(void);
void handle_cancelled(void);

bool __wrap_lid_is_closed(char *name) {
check_expected(name);
Expand Down Expand Up @@ -60,8 +58,6 @@ int after_all(void **state) {
}

int before_each(void **state) {
displ = calloc(1, sizeof(struct Displ));

cfg = cfg_default();

struct State *s = calloc(1, sizeof(struct State));
Expand All @@ -86,8 +82,6 @@ int after_each(void **state) {
head_changing_mode = NULL;
head_changing_adaptive_sync = NULL;

free(displ);

cfg_destroy();

struct State *s = *state;
Expand Down Expand Up @@ -709,24 +703,6 @@ void handle_failure__unspecified(void **state) {
assert_log(ERROR, "\nChanges failed\n");
}

void handle_cancelled__under(void **state) {
displ->sequential_cancellations = 1;

handle_cancelled();

assert_log(WARNING, "\nChanges cancelled, retrying\n");
}

void handle_cancelled__over(void **state) {
displ->sequential_cancellations = MAX_SEQUENTIAL_CANCELLATIONS;

expect_value(__wrap_wd_exit_message, __status, EXIT_FAILURE);

handle_cancelled();

assert_log(ERROR, "\nChanges cancelled 25 times, exiting\n");
}

int main(void) {
const struct CMUnitTest tests[] = {
TEST(order_heads__exact_partial_regex),
Expand Down Expand Up @@ -772,9 +748,6 @@ int main(void) {
TEST(handle_failure__mode),
TEST(handle_failure__adaptive_sync),
TEST(handle_failure__unspecified),

TEST(handle_cancelled__under),
TEST(handle_cancelled__over),
};

return RUN(tests);
Expand Down

0 comments on commit 319673d

Please sign in to comment.