summaryrefslogtreecommitdiff
path: root/src/libstddjb/socket_deadlineconnstamp4.c
blob: da6aa224658841c698bd026aaeb22d9cf3b6f177 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
/* ISC license. */

#include <errno.h>
#include <skalibs/error.h>
#include <skalibs/socket.h>

int socket_deadlineconnstamp (int s, char const *ip, uint16_t port, tain const *deadline, tain *stamp)
{
  int e = errno ;
  if (socket_connect4(s, ip, port) >= 0) return 1 ;
  if (!error_isagain(errno) && !error_isalready(errno)) return 0 ;
  errno = e ;
  return socket_waitconn(s, deadline, stamp) ;
}