您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ taia_now函数代码示例

51自学网 2021-06-03 08:39:35
  C++
这篇教程C++ taia_now函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中taia_now函数的典型用法代码示例。如果您正苦于以下问题:C++ taia_now函数的具体用法?C++ taia_now怎么用?C++ taia_now使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了taia_now函数的30个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: timeoutconn6

int timeoutconn6(int s,const char ip[16],uint16 port,unsigned int scope_id,unsigned int timeout){  struct taia now;  struct taia deadline;  iopause_fd x;  if (socket_connect6(s,ip,port,scope_id) == -1) {    if ((errno != EWOULDBLOCK) && (errno != EINPROGRESS)) return -1;    x.fd = s;    x.events = IOPAUSE_WRITE;    taia_now(&now);    taia_uint(&deadline,timeout);    taia_add(&deadline,&now,&deadline);    for (;;) {      taia_now(&now);      iopause(&x,1,&deadline,&now);      if (x.revents) break;      if (taia_less(&deadline,&now)) {	errno = ETIMEDOUT; /* note that connect attempt is continuing */	return -1;      }    }    if (!socket_connected(s)) return -1;  }  if (ndelay_off(s) == -1) return -1;  return 0;}
开发者ID:mgpld,项目名称:Easy-Server-Framework--C-,代码行数:28,


示例2: timeoutconn

int timeoutconn(int s,char ip[4],uint16 port,unsigned int timeout){  struct taia now;  struct taia deadline;  iopause_fd x;  if (socket_connect4(s,ip,port) == -1) {    if ((errno != error_wouldblock) && (errno != error_inprogress)) return -1;    x.fd = s;    x.events = IOPAUSE_WRITE;    taia_now(&now);    taia_uint(&deadline,timeout);    taia_add(&deadline,&now,&deadline);    for (;;) {      taia_now(&now);      iopause(&x,1,&deadline,&now);      if (x.revents) break;      if (taia_less(&deadline,&now)) {	    errno = error_timeout; /* note that connect attempt is continuing */	    return -1;      }    }    if (!socket_connected(s)) return -1;  }  if (ndelay_off(s) == -1) return -1;  return 0;}
开发者ID:gvsurenderreddy,项目名称:tsi-ucspi-udp,代码行数:28,


示例3: curve25519_encode

ssize_t curve25519_encode(struct curve25519_struct *curve, struct curve25519_proto *proto,			  unsigned char *plaintext, size_t size, unsigned char **chipertext){	int ret, i;	ssize_t done = size;	struct taia packet_taia;	spinlock_lock(&curve->enc_lock);	if (unlikely(size > curve->enc_buf_size)) {		done = -ENOMEM;		goto out;	}	taia_now(&packet_taia);	taia_pack(proto->enonce + NONCE_OFFSET, &packet_taia);	memset(curve->enc_buf, 0, curve->enc_buf_size);	ret = crypto_box_afternm(curve->enc_buf, plaintext, size, proto->enonce, proto->key);	if (unlikely(ret)) {		done = -EIO;		goto out;	}	fmemcpy(curve->enc_buf + crypto_box_boxzerobytes - NONCE_LENGTH,	       proto->enonce + NONCE_OFFSET, NONCE_LENGTH);	for (i = 0; i < crypto_box_boxzerobytes - NONCE_LENGTH; ++i)		curve->enc_buf[i] = (uint8_t) secrand();	(*chipertext) = curve->enc_buf;out:	spinlock_unlock(&curve->enc_lock);	return done;}
开发者ID:hhatto,项目名称:netsniff-ng,代码行数:35,


示例4: main

int main(){  if (leapsecs_init() == -1) {    fprintf(stderr,"utcnow: fatal: unable to init leapsecs/n");    exit(111);  }      taia_now(&now);  x[taia_fmtfrac(x,&now)] = 0;  taia_tai(&now,&sec);  caltime_utc(&ct,&sec,(int *) 0,(int *) 0);  printf("%ld-%02d-%02d %02d:%02d:%02d.%s/n"    ,ct.date.year    ,ct.date.month    ,ct.date.day    ,ct.hour    ,ct.minute    ,ct.second    ,x    );  exit(0);}
开发者ID:KatsOide,项目名称:SAD,代码行数:25,


示例5: ud_init

intud_init (struct udoc *ud){  bin_zero (ud, sizeof (*ud));  if (!ud_oht_init (&ud->ud_parts, sizeof (struct ud_part))) goto FAIL;  if (!ud_oht_init (&ud->ud_link_exts, sizeof (struct ud_ref))) goto FAIL;  if (!ud_oht_init (&ud->ud_refs, sizeof (struct ud_ref))) goto FAIL;  if (!ud_oht_init (&ud->ud_ref_names, sizeof (struct ud_ref))) goto FAIL;  if (!ud_oht_init (&ud->ud_footnotes, sizeof (struct ud_ref))) goto FAIL;  if (!ud_oht_init (&ud->ud_styles, sizeof (struct ud_ref))) goto FAIL;  if (!dstack_init (&ud->ud_errors, 16, sizeof (struct ud_err))) goto FAIL;  if (!token_init (&ud->ud_tok)) goto FAIL;  ud->ud_dirfd_pwd = open_ro (".");  if (ud->ud_dirfd_pwd == -1) goto FAIL;  ud->ud_dirfd_src = -1;  ud->ud_dirfd_out = -1;  ud->ud_main_doc = ud;  ud->ud_cur_doc = ud;  if (!ht_init (&ud->ud_loopchecks)) goto FAIL;  if (!ht_init (&ud->ud_documents)) goto FAIL;  taia_now (&ud->ud_time_start);  return 1;  FAIL:  ud_free (ud);  return 0;}
开发者ID:io7m,项目名称:coreland-udoc,代码行数:30,


示例6: main

int main(void){  struct taia taia;  char stamp[TAIA_TAI64N + 1];  char ch;  stamp[0] = '@';  for (;;) {    if (buffer_get(buffer0, &ch, 1) != 1) { done(); goto FINISH; }    taia_now(&taia);    taia_tai64n(stamp + 1, &taia);    stamp[sizeof(stamp) - 1] = ' ';    buffer_put(buffer1, stamp, sizeof(stamp));    for (;;) {      buffer_put(buffer1, &ch, 1);      if (ch == '/n') break;      if (buffer_get(buffer0, &ch, 1) != 1) { done(); goto FINISH; }    }  }  FINISH:  return 0;}
开发者ID:io7m,项目名称:coreland-chrono,代码行数:25,


示例7: proto_encode

static int proto_encode(sigma_proto *instance, uint8_t* input, uint8_t* output, size_t len){    sigma_proto_nacl* inst = (sigma_proto_nacl*) instance;    uint8_t tempbufferinput[len + crypto_box_ZEROBYTES];    bzero(tempbufferinput, crypto_box_ZEROBYTES);    memcpy(tempbufferinput + crypto_box_ZEROBYTES, input, len);    len += crypto_box_ZEROBYTES;    taia_now(&inst->cdtaie);    taia_pack(inst->encnonce + nonceoffset, &(inst->cdtaie));    int result = crypto_box_afternm(        output,        tempbufferinput,        len,        inst->encnonce,        ((sigma_proto_nacl*) instance)->precomp    );    if (result)    {        fprintf(stderr, "Encryption failed (length %u, given result %i)/n", (unsigned) len, result);        errno = EINVAL;        return -1;    }    memcpy(output, inst->encnonce + nonceoffset, noncelength);    return len;}
开发者ID:26597925,项目名称:sigmavpn,代码行数:33,


示例8: socket_timeoutconn

int socket_timeoutconn (int s, char const *ip, uint16 port, unsigned int timeout){  struct taia stamp, deadline ;  taia_now(&stamp) ;  taia_addsec(&deadline, &stamp, timeout) ;  return socket_deadlineconnstamp4(s, ip, port, &deadline, &stamp) ;}
开发者ID:Jubei-Mitsuyoshi,项目名称:aaa-skalibs,代码行数:7,


示例9: setup_log

int setup_log(){    if ((rploglen =str_len(rplog)) < 7)    {        warn3x("log must have at least seven characters.", 0, 0);        return(0);    }    if (pipe(logpipe) == -1)    {        warn3x("unable to create pipe for log.", 0, 0);        return(-1);    }    coe(logpipe[1]);    coe(logpipe[0]);    ndelay_on(logpipe[0]);    ndelay_on(logpipe[1]);    if (fd_copy(2, logpipe[1]) == -1)    {        warn3x("unable to set filedescriptor for log.", 0, 0);        return(-1);    }    io[0].fd =logpipe[0];    io[0].events =IOPAUSE_READ;    taia_now(&stamplog);    return(1);}
开发者ID:Sunshine-OS,项目名称:runit,代码行数:26,


示例10: dns_resolve

intdns_resolve (const char *q, const char qtype[2]){    int r = 0;    char servers[64];    iopause_fd x[1];    struct taia stamp;    struct taia deadline;    if (dns_resolvconfip (servers) == -1)        return -1;    memset (&dns_resolve_tx, 0, sizeof (dns_resolve_tx));    r = dns_transmit_start (&dns_resolve_tx, servers, 1, q, qtype, "/0/0/0/0");    if (r == -1)        return -1;    for (;;)    {        taia_now (&stamp);        taia_uint (&deadline, 120);        taia_add (&deadline, &deadline, &stamp);        dns_transmit_io (&dns_resolve_tx, x, &deadline);        iopause (x, 1, &deadline, &stamp);        r = dns_transmit_get (&dns_resolve_tx, x, &stamp);        if (r == -1)            return -1;        if (r == 1)            return 0;    }}
开发者ID:LordSpacehog,项目名称:ndjbdns,代码行数:34,


示例11: dns_transmit_io

voiddns_transmit_io (struct dns_transmit *d, iopause_fd *x, struct taia *deadline){    x->fd = d->s1 - 1;    switch (d->tcpstate)    {    case 0:        if (d->master)            return;        if (d->packet)        {            taia_now (deadline);            return;        }        /* otherwise, fall through */    case 3:    case 4:    case 5:        x->events = IOPAUSE_READ;        break;    case 1:    case 2:        x->events = IOPAUSE_WRITE;    }    if (taia_less (&d->deadline, deadline))        *deadline = d->deadline;}
开发者ID:pjps,项目名称:ndjbdns,代码行数:30,


示例12: t_timeout

void t_timeout(int j){  struct taia now;  if (!t[j].active) return;  taia_now(&now);  taia_uint(&t[j].timeout,10);  taia_add(&t[j].timeout,&t[j].timeout,&now);}
开发者ID:qrmn,项目名称:tinydnssec,代码行数:8,


示例13: PyObject_New

PyObject *TaiaNow(PyObject *self, PyObject *args) {  TaiaObject *taia;    taia = PyObject_New(TaiaObject, &TaiaType);  taia_now(&taia->t);    return (PyObject *)taia;}
开发者ID:dpejesh,项目名称:libsv-time,代码行数:8,


示例14: blog_modified

static void blog_modified(struct cdbb *a){	char pk[TAIA_PACK];	struct taia t;	taia_now(&t);	taia_pack(pk, &t);	cdbb_rep(a, DB_LAST_MODIFIED, 13, pk, TAIA_PACK);}
开发者ID:oripka,项目名称:bagunceiro,代码行数:9,


示例15: ssl_timeoutaccept

int ssl_timeoutaccept(SSL *ssl,unsigned int timeout){  struct taia now;  struct taia deadline;  iopause_fd x;  int r;  int rfd;  int wfd;  taia_now(&now);  taia_uint(&deadline,timeout);  taia_add(&deadline,&now,&deadline);  rfd = SSL_get_fd(ssl); /* XXX */  wfd = SSL_get_fd(ssl); /* XXX */  SSL_set_accept_state(ssl);  for (;;) {    r = SSL_accept(ssl);    if (r == 1) return 0;    ssl_errno = SSL_get_error(ssl,r);    errno = error_proto;    if ((ssl_errno != SSL_ERROR_WANT_READ) && (ssl_errno != SSL_ERROR_WANT_WRITE))      return -1;    if (ssl_errno == SSL_ERROR_WANT_READ) {      x.events = IOPAUSE_READ;      x.fd = rfd;      if (x.fd == -1) return -1;    }    else {      x.events = IOPAUSE_WRITE;      x.fd = wfd;      if (x.fd == -1) return -1;    }    for (;;) {      taia_now(&now);      iopause(&x,1,&deadline,&now);      if (x.revents) break;      if (taia_less(&deadline,&now))	return -1;    }  }}
开发者ID:SuperScript,项目名称:ucspi-ssl,代码行数:44,


示例16: timestr_parse

inttimestr_parse(const char * input, struct taia * res, struct taia * b){    struct taia base, * pbase;    const char * p;    uint32_t w, d, h, m, s;    unsigned int n;    if (!input || !res) return -1;    if (b) pbase = b;    else {        taia_now(&base);        pbase = &base;    }    p = input;    w = d = h = m = s = 0;next:    n = 0;    while (*p && (*p >= '0' && *p <= '9')) {        n *= 10;        n += (*p-'0');        p++;    }    if (!*p) return -1;    switch (*p) {    case 'w':        if (d*h*m*s) return -1;        w = n*604800;        break;    case 'd':        if (h*m*s) return -1;        d = n*86400;        break;    case 'h':        if (m*s) return -1;        h = n*3600;        break;    case 'm':        if (s) return -1;        m = n*60;        break;    case 's':        s = n;        break;    default:        return -1;    }    if (*++p) goto next;    res->sec.x = pbase->sec.x - (w+d+h+m+s);    res->nano = pbase->nano;    return 0;}
开发者ID:gvberg,项目名称:brutedet,代码行数:56,


示例17: u_new

voidu_new (void){    int i = 0, j = 0, len = 0;    struct udpclient *x = NULL;    static char *q = 0;    char qtype[2], qclass[2];    for (j = 0; j < MAXUDP; j++)        if (!u[j].active)            break;    if (j >= MAXUDP)    {        j = 0;        for (i = 1; i < MAXUDP; i++)            if (taia_less (&u[i].start, &u[j].start))                j = i;        errno = error_timeout;        u_drop (j);    }    x = u + j;    taia_now (&x->start);    len = socket_recv4 (udp53, buf, sizeof (buf), x->ip, &x->port, &odst);    if (len == -1)        return;    if ((unsigned)len >= sizeof buf)        return;    if (x->port < 1024 && x->port != 53)        return;    if (!okclient (x->ip))        return;    if (!packetquery (buf, len, &q, qtype, qclass, x->id))        return;    x->active = ++numqueries;    ++uactive;    if (debug_level)        log_query (x->active, x->ip, x->port, x->id, q, qtype);    switch (query_start (&x->q, q, qtype, qclass, myipoutgoing))    {    case -1:        u_drop (j);        return;    case 1:        u_respond (j);    }}
开发者ID:rahulsundaram,项目名称:ndjbdns,代码行数:54,


示例18: t_new

voidt_new (void){    int i = 0, j = 0;    struct tcpclient *x = NULL;    for (j = 0; j < MAXTCP; ++j)        if (!t[j].active)          break;    if (j >= MAXTCP)    {        j = 0;        for (i = 1; i < MAXTCP; ++i)            if (taia_less (&t[i].start, &t[j].start))                j = i;        errno = error_timeout;        if (t[j].state == 0)          t_drop (j);        else          t_close (j);    }    x = t + j;    taia_now (&x->start);    x->tcp = socket_accept4 (tcp53, x->ip, &x->port);    if (x->tcp == -1)        return;    if (x->port < 1024 && x->port != 53)    {        close (x->tcp);        return;    }    if (!okclient (x->ip))    {        close (x->tcp);        return;    }    if (ndelay_on (x->tcp) == -1)    {        close(x->tcp);        return;    } /* Linux bug */    x->active = 1;    ++tactive;    x->state = 1;    t_timeout (j);    if (debug_level > 2)        log_tcpopen (x->ip, x->port);}
开发者ID:rahulsundaram,项目名称:ndjbdns,代码行数:53,


示例19: http_sendiovecdata

ssize_t http_sendiovecdata( const int64 sock, struct ot_workstruct *ws, int iovec_entries, struct iovec *iovector ) {  struct http_data *cookie = io_getcookie( sock );  char *header;  int i;  size_t header_size, size = iovec_length( &iovec_entries, &iovector );  tai6464 t;  /* No cookie? Bad socket. Leave. */  if( !cookie ) {    iovec_free( &iovec_entries, &iovector );    HTTPERROR_500;  }  /* If this socket collected request in a buffer, free it now */  array_reset( &cookie->request );  /* If we came here, wait for the answer is over */  cookie->flag &= ~STRUCT_HTTP_FLAG_WAITINGFORTASK;  /* Our answers never are 0 vectors. Return an error. */  if( !iovec_entries ) {    HTTPERROR_500;  }  /* Prepare space for http header */  header = malloc( SUCCESS_HTTP_HEADER_LENGTH + SUCCESS_HTTP_HEADER_LENGTH_CONTENT_ENCODING );  if( !header ) {    iovec_free( &iovec_entries, &iovector );    HTTPERROR_500;  }  if( cookie->flag & STRUCT_HTTP_FLAG_GZIP )    header_size = sprintf( header, "HTTP/1.0 200 OK/r/nContent-Type: text/plain/r/nContent-Encoding: gzip/r/nContent-Length: %zd/r/n/r/n", size );  else if( cookie->flag & STRUCT_HTTP_FLAG_BZIP2 )    header_size = sprintf( header, "HTTP/1.0 200 OK/r/nContent-Type: text/plain/r/nContent-Encoding: bzip2/r/nContent-Length: %zd/r/n/r/n", size );  else    header_size = sprintf( header, "HTTP/1.0 200 OK/r/nContent-Type: text/plain/r/nContent-Length: %zd/r/n/r/n", size );  iob_reset( &cookie->batch );  iob_addbuf_free( &cookie->batch, header, header_size );  /* Will move to ot_iovec.c */  for( i=0; i<iovec_entries; ++i )    iob_addbuf_munmap( &cookie->batch, iovector[i].iov_base, iovector[i].iov_len );  free( iovector );  /* writeable sockets timeout after 10 minutes */  taia_now( &t ); taia_addsec( &t, &t, OT_CLIENT_TIMEOUT_SEND );  io_timeout( sock, t );  io_dontwantread( sock );  io_wantwrite( sock );  return 0;}
开发者ID:Moscarda,项目名称:opentracker,代码行数:53,


示例20: profile

voidprofile(const char *s){#ifdef ENABLE_PROFILE	char buf[TAIA_PACK];	struct taia t;	taia_now(&t);	taia_pack(buf,&t);	logit(LOG_PROFILE, "PROFILE: %s @%s/n", s, buf); #endif}
开发者ID:ajtulloch,项目名称:qmail,代码行数:12,


示例21: fmt_accustamp

int fmt_accustamp(char s[TIMESTAMP]){  struct taia now;  int len;  taia_now(&now);  len = fmt_ulong(s,(unsigned long)tai_tounix(&now.sec));  s[len++] = '.';  len += fmt_uint0(s+len,now.nano / 1000,6);  return len;}
开发者ID:B-Rich,项目名称:daemontools-encore,代码行数:12,


示例22: px_fmt_timestamp

unsigned intpx_fmt_timestamp(char *ptr){  struct taia tai;  if (ptr) {    taia_now(&tai);    taia_tai64n(ptr + 1, &tai);    ptr[0] = '@';  }  return TAIA_TAI64N;}
开发者ID:io7m,项目名称:coreland-plexlog,代码行数:12,


示例23: curve25519_decode

ssize_t curve25519_decode(struct curve25519_struct *c, struct curve25519_proto *p,			  unsigned char *chipertext, size_t size,			  unsigned char **plaintext, struct taia *arrival_taia){	int ret;	ssize_t done = size;	struct taia packet_taia, __arrival_taia;	spinlock_lock(&c->dec_lock);	if (unlikely(size > c->dec_buf_size)) {		spinlock_unlock(&c->dec_lock);		return -ENOMEM;	}	if (unlikely(size < crypto_box_boxzerobytes + NONCE_LENGTH)) {		spinlock_unlock(&c->dec_lock);		return 0;	}	if (arrival_taia == NULL) {		taia_now(&__arrival_taia);		arrival_taia = &__arrival_taia;	}	taia_unpack(chipertext + crypto_box_boxzerobytes - NONCE_LENGTH,		    &packet_taia);        if (is_good_taia(arrival_taia, &packet_taia) == 0) {		/* Ignoring packet */		spinlock_unlock(&c->dec_lock);		syslog(LOG_ERR, "Bad packet time! Dropping connection!/n");		return 0;	}	memcpy(p->dnonce + NONCE_OFFSET,	       chipertext + crypto_box_boxzerobytes - NONCE_LENGTH,	       NONCE_LENGTH);	memset(c->dec_buf, 0, c->dec_buf_size);	ret = crypto_box_open_afternm(c->dec_buf, chipertext, size,				      p->dnonce, p->key);	if (unlikely(ret)) {		spinlock_unlock(&c->dec_lock);		return -EIO;	}	(*plaintext) = c->dec_buf;	spinlock_unlock(&c->dec_lock);	return done;}
开发者ID:markusa,项目名称:netsniff-ng_filter,代码行数:52,


示例24: io_trywritetimeout

int64 io_trywritetimeout(int64 d,const char* buf,int64 len) {    int64 r=io_trywrite(d,buf,len);    if (r==-1) {        tai6464 x;        io_entry* e=array_get(&io_fds,sizeof(io_entry),d);        taia_now(&x);        if (!taia_less(&x,&e->timeout)) {            errno=ETIMEDOUT;            r=-2;        }    }    return r;}
开发者ID:hfeeki,项目名称:opentracker,代码行数:13,


示例25: timeoutwrite

int timeoutwrite(int t,int fd,const char *buf,int len){  struct taia now;  struct taia deadline;  iopause_fd x;  taia_now(&now);  taia_uint(&deadline,t);  taia_add(&deadline,&now,&deadline);  x.fd = fd;  x.events = IOPAUSE_WRITE;  for (;;) {    taia_now(&now);    iopause(&x,1,&deadline,&now);    if (x.revents) break;    if (taia_less(&deadline,&now)) {      errno = error_timeout;      return -1;    }  }  return write(fd,buf,len);}
开发者ID:djbtao,项目名称:libdjb,代码行数:23,


示例26: pidchange

static void pidchange(){	struct taia now;	unsigned long u;	taia_now(&now);	taia_pack(status, &now);	u = (unsigned long) pid;	status[16] = u; u >>= 8;	status[17] = u; u >>= 8;	status[18] = u; u >>= 8;	status[19] = u;}
开发者ID:lipeng-wei,项目名称:supervise,代码行数:14,


示例27: PyMem_Malloc

PyObject *pytaia_now_pack(PyObject *self){  PyObject *ret;  unsigned char *tpad;  tpad = PyMem_Malloc(16);  if (!tpad)    return PyErr_NoMemory();  taia_now(tpad);  taia_pack(tpad,tpad);  ret = PyBytes_FromStringAndSize((char *)tpad,16);  PyMem_Free(tpad);  return ret;}
开发者ID:JosephSWilliams,项目名称:nacltaia-otr,代码行数:14,


示例28: pidchange

void pidchange(void){  struct taia now;  unsigned long u;  taia_now(&now);  taia_pack(status,&now);  u = (unsigned long) pid;  status[12] = u; u >>= 8;  status[13] = u; u >>= 8;  status[14] = u; u >>= 8;  status[15] = u;}
开发者ID:ajtulloch,项目名称:daemontools,代码行数:14,


示例29: timeoutread

int timeoutread(int t,int fd,char *buf,int len){  struct taia now;  struct taia deadline;  iopause_fd x;  taia_now(&now);  taia_uint(&deadline,t);  taia_add(&deadline,&now,&deadline);  x.fd = fd;  x.events = IOPAUSE_READ;  for (;;) {    taia_now(&now);    iopause(&x,1,&deadline,&now);    if (x.revents) break;    if (taia_less(&deadline,&now)) {      errno = ETIMEDOUT;      return -1;    }  }  return read(fd,buf,len);}
开发者ID:mgpld,项目名称:Easy-Server-Framework--C-,代码行数:23,


示例30: thistcp

static intthistcp (struct dns_transmit *d){    struct taia now;    const char *ip = NULL;    socketfree (d);    packetfree (d);    for (; d->curserver < 16; ++d->curserver)    {        ip = d->servers + 4 * d->curserver;        if (byte_diff (ip, 4, "/0/0/0/0"))        {            d->query[2] = dns_random (256);            d->query[3] = dns_random (256);            d->s1 = 1 + socket_tcp ();            if (!d->s1)            {                dns_transmit_free (d);                return -1;            }            if (randombind (d) == -1)            {                dns_transmit_free (d);                return -1;            }            taia_now (&now);            taia_uint (&d->deadline, 10);            taia_add (&d->deadline, &d->deadline, &now);            if (socket_connect4 (d->s1 - 1, ip, 53) == 0)            {                d->pos = 0;                d->tcpstate = 2;                return 0;            }            if (errno == error_inprogress || errno == error_wouldblock)            {                d->tcpstate = 1;                return 0;            }            socketfree(d);        }    }    dns_transmit_free(d);    return -1;}
开发者ID:pjps,项目名称:ndjbdns,代码行数:50,



注:本文中的taia_now函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ tail函数代码示例
C++ tag_size函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。