> +int connect_tcp(struct interface *interface, const struct in6_addr *dest)
> +{
> + struct sockaddr_in6 dest_addr;
> + int sock;
> +
> + memset(&dest_addr, 0, sizeof(dest_addr));
> + dest_addr.sin6_family = AF_INET6;
> + dest_addr.sin6_port = htons(ALFRED_PORT);
> + dest_addr.sin6_scope_id = interface->scope_id;
> + memcpy(&dest_addr.sin6_addr, dest, sizeof(*dest));
> +
> + sock = socket(PF_INET6, SOCK_STREAM, IPPROTO_TCP);
> + if (sock < 0)
> + return -1;
> +
> + if (connect(sock, (struct sockaddr *)&dest_addr,
> + sizeof(struct sockaddr_in6)) < 0) {
> + close(sock);
> + return -1;
> + }
> +
> + return sock;
> +}
> +
Wouldn't this hang for a while and make the alfred server "unresponsive"
when the remote is not reachable at this moment?.
Kind regards,
Sven
signature.asc
Description: This is a digitally signed message part.
