#include <gnutls/gnutls.h>
#include <gnutls/dtls.h>
#include <signal.h>
-#include <virt-time.h>
#include "utils.h"
fprintf(stderr, "client|<%d>| %s", level, str);
}
-/* A very basic TLS client, with anonymous authentication.
- */
-
static void client(int fd, int wait)
{
int ret;
gnutls_anon_client_credentials_t anoncred;
gnutls_session_t session;
- /* Need to enable anonymous KX specifically. */
global_init();
gnutls_transport_set_int(session, fd);
if (wait) {
- virt_sec_sleep(25);
+ sec_sleep(25);
} else {
do {
ret = gnutls_handshake(session);
gnutls_global_deinit();
}
-static void start(int wait)
+static void start(int wait_flag)
{
int fd[2];
int ret;
pid_t child;
- if (debug && wait)
+ if (debug && wait_flag)
fprintf(stderr, "\nWill test timeout\n");
ret = socketpair(AF_UNIX, SOCK_STREAM, 0, fd);
}
if (child) {
+ int status = 0;
/* parent */
close(fd[1]);
- server(fd[0], wait);
+ server(fd[0], wait_flag);
close(fd[0]);
+
+ wait(&status);
+ check_wait_status(status);
} else {
close(fd[0]);
- client(fd[1], wait);
+ client(fd[1], wait_flag);
close(fd[1]);
exit(0);
}
static void ch_handler(int sig)
{
- int status = 0;
- wait(&status);
- check_wait_status(status);
return;
}
void doit(void)
{
- virt_time_init();
-
signal(SIGCHLD, ch_handler);
signal(SIGPIPE, SIG_IGN);