summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWilly Tarreau <w@1wt.eu>2020-09-24 18:07:48 +0200
committerWilly Tarreau <w@1wt.eu>2020-10-07 18:45:03 +0200
commit6d5b33741230244f4e698072b8b482e55ba210ec (patch)
tree5ad6dfbf453659c02fd90485451c092a12ecd512
parent349102ae75f44377f23595d0afd27841e87f5b46 (diff)
downloadhaproxy-6d5b33741230244f4e698072b8b482e55ba210ec.tar.gz
MINOR: listeners: correctly report pause() errors
By using the same "ret" variable in the "if" block to test the return value of pause(), the second one shadows the first one and when forcing the result to zero in case of an error, it doesn't do anything. In practice this is not really used so we don't mind but it's dirty. The test on ==0 is wrong too since technically speaking a total stop validates the need for a pause, but stops the listener so it's just the resume that won't work anymore. We could switch to stopped but it's an involuntary switch and the user will not know. Better then mark it as paused and let the resume continue to fail so that only the resume will eventually report an error (e.g. abns@).
-rw-r--r--src/listener.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/listener.c b/src/listener.c
index 5e9dcde57..15e363585 100644
--- a/src/listener.c
+++ b/src/listener.c
@@ -351,14 +351,13 @@ int pause_listener(struct listener *l)
/* Returns < 0 in case of failure, 0 if the listener
* was totally stopped, or > 0 if correctly paused.
*/
- int ret = l->rx.proto->pause(l);
+ ret = l->rx.proto->pause(l);
if (ret < 0) {
ret = 0;
goto end;
}
- else if (ret == 0)
- goto end;
+ ret = 1;
}
MT_LIST_DEL(&l->wait_queue);