mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2025-05-05 17:28:00 +00:00
MINOR: cli: emit a warning when _getsocks was used more than once
The _getsocks CLI command can be used only once, after that the sockets are not available anymore. Emit a warning when the command was already used once.
This commit is contained in:
parent
b983145837
commit
519cd2021b
@ -1981,6 +1981,7 @@ static int bind_parse_severity_output(char **args, int cur_arg, struct proxy *px
|
|||||||
/* Send all the bound sockets, always returns 1 */
|
/* Send all the bound sockets, always returns 1 */
|
||||||
static int _getsocks(char **args, char *payload, struct appctx *appctx, void *private)
|
static int _getsocks(char **args, char *payload, struct appctx *appctx, void *private)
|
||||||
{
|
{
|
||||||
|
static int already_sent = 0;
|
||||||
char *cmsgbuf = NULL;
|
char *cmsgbuf = NULL;
|
||||||
unsigned char *tmpbuf = NULL;
|
unsigned char *tmpbuf = NULL;
|
||||||
struct cmsghdr *cmsg;
|
struct cmsghdr *cmsg;
|
||||||
@ -2008,6 +2009,11 @@ static int _getsocks(char **args, char *payload, struct appctx *appctx, void *pr
|
|||||||
|
|
||||||
fd = remote->handle.fd;
|
fd = remote->handle.fd;
|
||||||
|
|
||||||
|
if (already_sent) {
|
||||||
|
ha_warning("_getsocks: attempt to get sockets but they were already sent!\n");
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
/* Temporary set the FD in blocking mode, that will make our life easier */
|
/* Temporary set the FD in blocking mode, that will make our life easier */
|
||||||
old_fcntl = fcntl(fd, F_GETFL);
|
old_fcntl = fcntl(fd, F_GETFL);
|
||||||
if (old_fcntl < 0) {
|
if (old_fcntl < 0) {
|
||||||
@ -2144,6 +2150,8 @@ static int _getsocks(char **args, char *payload, struct appctx *appctx, void *pr
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
already_sent = 1;
|
||||||
|
|
||||||
/* flush pending stuff */
|
/* flush pending stuff */
|
||||||
if (nb_queued) {
|
if (nb_queued) {
|
||||||
iov.iov_len = curoff;
|
iov.iov_len = curoff;
|
||||||
|
Loading…
Reference in New Issue
Block a user