skalibs

Mirror/fork of https://skarnet.org/software/skalibs/
git clone https://ccx.te2000.cz/git/skalibs
Log | Files | Refs | README | LICENSE

socket_deadlineconnstamp4.c (400B)


      1 /* ISC license. */
      2 
      3 #include <errno.h>
      4 #include <skalibs/error.h>
      5 #include <skalibs/socket.h>
      6 
      7 int socket_deadlineconnstamp (int s, char const *ip, uint16_t port, tain const *deadline, tain *stamp)
      8 {
      9   int e = errno ;
     10   if (socket_connect4(s, ip, port) >= 0) return 1 ;
     11   if (!error_isagain(errno) && !error_isalready(errno)) return 0 ;
     12   errno = e ;
     13   return socket_waitconn(s, deadline, stamp) ;
     14 }