tests: add the mqtt test server mqttd

This commit is contained in:
Daniel Stenberg 2020-04-14 11:19:12 +02:00
parent 675f5fb66f
commit 5e855bbd18
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
4 changed files with 1001 additions and 7 deletions

View file

@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2019, Daniel Stenberg, <daniel@haxx.se>, et al.
* Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@ -284,6 +284,20 @@ int write_pidfile(const char *filename)
return 1; /* success */
}
/* store the used port number in a file */
int write_portfile(const char *filename, int port)
{
FILE *portfile = fopen(filename, "wb");
if(!portfile) {
logmsg("Couldn't write port file: %s %s", filename, strerror(errno));
return 0; /* fail */
}
fprintf(portfile, "%d\n", port);
fclose(portfile);
logmsg("Wrote port %d to %s", port, filename);
return 1; /* success */
}
void set_advisor_read_lock(const char *filename)
{
FILE *lockfile;