当前位置: 首页>>代码示例>>C++>>正文


C++ dns_error函数代码示例

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


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

示例1: Resolver

	Resolver(QObject *parent = 0) :
		QObject(parent),
		dnsA(parent),
		dnsB(parent)
	{
		connect(&dnsA, SIGNAL(resultsReady(const QList<XMPP::NameRecord> &)), SLOT(dns_resultsReady(const QList<XMPP::NameRecord> &)));
		connect(&dnsA, SIGNAL(error(XMPP::NameResolver::Error)), SLOT(dns_error(XMPP::NameResolver::Error)));

		connect(&dnsB, SIGNAL(resultsReady(const QList<XMPP::NameRecord> &)), SLOT(dns_resultsReady(const QList<XMPP::NameRecord> &)));
		connect(&dnsB, SIGNAL(error(XMPP::NameResolver::Error)), SLOT(dns_error(XMPP::NameResolver::Error)));
	}
开发者ID:evgeny,项目名称:psi,代码行数:11,代码来源:jinglertp.cpp

示例2: create_fetcher

static int
create_fetcher(struct server *s, int n)
{
    int i;
    struct fetcher *ws, *tmp;
    cpu_set_t cpuinfo;
    pthread_t fpt[FETCHER_NUM];
    if (n < 1)
        return -1;
    ws = malloc(sizeof(struct fetcher) * n);    //associated a worker with main thread
    if (ws == NULL)
        return -1;
    memset(ws, 0, sizeof(struct fetcher) * n);
    s->fetchers = ws;
    for (i = 0; i < n; i++) {
        tmp = ws + i;
        tmp->s = s;
        tmp->idx = i;
        tmp->pkg = 0;
        tmp->send = 0;
        tmp->miss = 0;
        tmp->el = &s->eventlist;
        tmp->qidx = i % QUIZZER_NUM;
        tmp->mc = init_msgcache(100);
        if (tmp->mc == NULL)
            dns_error(0, "get msgcache");
        tmp->loginfo = malloc(sizeof(struct log_info));
        memset(tmp->loginfo, 0, sizeof(struct log_info));
        tmp->loginfo->lastlog = global_now;
        tmp->loginfo->log_type = TYPE_FETCHER;
        tmp->loginfo->logfd = create_new_log(s->logpath, i, TYPE_FETCHER);
        if (tmp->loginfo->logfd < 0)
            dns_error(0, "log file error");
        if (pthread_create(fpt + i, NULL, (void *) run_fetcher, tmp) != 0)
            dns_error(0, "init worker");
    }
    global_out_info->thread_num += i;
    
    for(i = 0;i < FETCHER_NUM ;i ++)
    {
        CPU_ZERO(&cpuinfo);
        CPU_SET_S(i + 1, sizeof(cpuinfo), &cpuinfo);
        if(0 != pthread_setaffinity_np(fpt[i], sizeof(cpu_set_t), &cpuinfo))
        {
            printf("set affinity fetcher failed,  may be the cpu cores num less than (FETCHER_NUM + QUIZZER_NUM + 1)\n");
//             exit(0);
        }
    }
    
    return 0;
}
开发者ID:BearGrass,项目名称:dnspod-sr,代码行数:51,代码来源:init.c

示例3: dns_error

/* $begin gethostbyname */
struct hostent *Gethostbyname(const char *name) {
	struct hostent *p;

	if ((p = gethostbyname(name)) == NULL)
		dns_error("Gethostbyname error");
	return p;
}
开发者ID:ZxMYS,项目名称:Xiaos-IPv4-IPv6-Transmit-Toolkit,代码行数:8,代码来源:csapp.c

示例4: init_mempool

void init_mempool()
{
    int ret;
    ret = mempool_create(MEMPOOL_SIZE);
    if (ret < 0)
        dns_error(0, "create mempool failed");
}
开发者ID:BearGrass,项目名称:dnspod-sr,代码行数:7,代码来源:init.c

示例5: init_globe

int init_globe()
{
    int shmid;
    shmid = shmget(SHM_KEY, sizeof(struct global_query_info), IPC_CREAT|0600|IPC_PRIVATE);
    if (shmid < 0) {
        printf("%lu\n", SHM_KEY + sizeof(struct global_query_info));
        perror("shmget");
        dns_error(0, "shmget error");
    }
    global_out_info = (struct global_query_info *)shmat(shmid, NULL, 0);
    memset(global_out_info, 0, sizeof(struct global_query_info));
    global_out_info->thread_num = 0;
    int i;
    for (i = 0; i < sizeof(query_type_map) / sizeof(int); ++i)
    {
        query_type_map[i] = -1;
    }
    query_type_map[A] 		=  0;
    query_type_map[NS] 		=  1;
    query_type_map[CNAME] 	=  2;
    query_type_map[SOA] 	=  3;
    query_type_map[MX] 		=  4;
    query_type_map[TXT] 	=  5;
    query_type_map[AAAA] 	=  6;
    query_type_map[SRV] 	=  7;
    query_type_map[ANY] 	=  8;
    return 0;
}
开发者ID:BearGrass,项目名称:dnspod-sr,代码行数:28,代码来源:init.c

示例6: connect

//!
//! Constructs an NDns object with parent \a parent.
NDns::NDns(QObject *parent)
:QObject(parent),dns(this)
{
    busy = false;

    connect(&dns, SIGNAL(resultsReady(QList<XMPP::NameRecord>)), SLOT(dns_resultsReady(QList<XMPP::NameRecord>)));
    connect(&dns, SIGNAL(error(XMPP::NameResolver::Error)), SLOT(dns_error(XMPP::NameResolver::Error)));
}
开发者ID:psi-im,项目名称:iris,代码行数:10,代码来源:ndns.cpp

示例7: rbtree_test

//---------------rbtree debug------------------------------------//
int
rbtree_test(void)
{
    int i, j, len, slice, ret;
    struct timeval tv;
    struct rbnode node, *pn = NULL;
    struct ttlnode *tn = NULL;
    struct rbtree *rbt = NULL;
    rbt = create_rbtree(rbt_comp_ttl_gt, NULL);
    if (rbt == NULL)
        dns_error(0, "create rbtree");
    node = rbt->nil;            //nil
    slice = 8000000;
    //for(i = 0;i < n;i ++)
    //{
    for (j = 0; j < slice; j++) {
        len = random() % 30;
        tn = malloc(sizeof(struct ttlnode) + len);
        if (tn == NULL)
            printf("oom\n");
        tn->exp = j;
        for (i = 0; i < len; i++)
            tn->data[i] = 'a' + i;
        node.key = tn;
        ret = insert_node(rbt, &node);
        if (ret != 0)
            printf("insert error\n");
    }
    printf("insert all\n");
    sleep(2);
    for (j = 0; j < slice; j++) {
        pn = min_node(rbt);
        if (pn != NULL) {
            tn = delete_node(rbt, pn);
            free(tn);
        } else
            printf("error\n");
    }
    printf("delete all\n");
    sleep(5);
    //}
    if (free_rbtree(rbt) != 0)
        dns_error(0, "free");
    //get_time_usage(&tv,0);
    return 0;
}
开发者ID:ChowZenki,项目名称:dnspod-sr,代码行数:47,代码来源:datas.c

示例8: Gethostbyname_r

/* $begin gethostbyname_r */
int Gethostbyname_r(const char *name, struct hostent *ret, char *buf, size_t buflen, struct hostent **result, int *h_errnop)
{
	int p;

    p = gethostbyname_r(name, ret, buf, buflen, result, h_errnop);
	if (p)
		dns_error("Gethostbyname error");
    return p;
}
开发者ID:Firkraag,项目名称:http-proxy,代码行数:10,代码来源:csapp.c

示例9: gethostbyaddr

struct hostent *Gethostbyaddr(const char *addr, int len, int type)
{
	struct hostent *hp;
	hp = gethostbyaddr(addr, len, type);
	if (hp == NULL)
	{
		dns_error("Gethostbyaddr error");
	}
	return hp;
}
开发者ID:jack-lijing,项目名称:unix,代码行数:10,代码来源:csapp.c

示例10: gethostbyname

/****************************************************
	*DNS interface wrappers*
*****************************************************/
struct hostent *Gethostbyname(const char *hostname)
{
	struct hostent *hp;
	hp = gethostbyname(hostname);
	if (hp == NULL)
	{
		dns_error("Gethostbyname error");
	}
	return hp;
}
开发者ID:jack-lijing,项目名称:unix,代码行数:13,代码来源:csapp.c

示例11: create_listen_ports

static int
create_listen_ports(int port, int proto, uchar * addr)
{
    int fd = -1;
    fd = create_socket(port, proto, addr);
    if (fd < 0 || set_non_block(fd) < 0) {
        printf("port:%d,proto:%d\n", port, proto);
        dns_error(0, "fd < 0");
    }
    return fd;
}
开发者ID:BearGrass,项目名称:dnspod-sr,代码行数:11,代码来源:init.c

示例12: daemonrize

static int
daemonrize(int dm)
{
    if (dm == 1) {
        if (daemon(1, 0) == -1)
            dns_error(0, "daemonrize");
        else
            printf("daemon!!!\n");      //we will never see this
    }
    return 0;
}
开发者ID:BearGrass,项目名称:dnspod-sr,代码行数:11,代码来源:init.c

示例13: Open_clientfd

/******************************************
 * Wrappers for the client/server helper routines 
 ******************************************/
int Open_clientfd(char *hostname, int port) {
	int rc;

	if ((rc = open_clientfd(hostname, port)) < 0) {
		if (rc == -1)
			unix_error("Open_clientfd Unix error");
		else
			dns_error("Open_clientfd DNS error");
	}
	return rc;
}
开发者ID:ZxMYS,项目名称:Xiaos-IPv4-IPv6-Transmit-Toolkit,代码行数:14,代码来源:csapp.c

示例14: Gethostbyaddr_r

int Gethostbyaddr_r(const char *addr, int len, int type, 
 struct hostent *ret, char *buf, size_t buflen,
                struct hostent **result, int *h_errnop)

{
     int p;

    p = gethostbyaddr_r(addr, len, type, ret, buf, buflen, result, h_errnop);
	if (p)
		dns_error("Gethostbyaddr error");
    return p;
}
开发者ID:Firkraag,项目名称:http-proxy,代码行数:12,代码来源:csapp.c

示例15: storage_test

int
storage_test(void)
{
    struct htable *ht = NULL;
    pthread_t pt[THREADX];
    int i;
    struct st_hlp sh[THREADX];
    //ht = htable_create(NULL,dict_comp_str_equ,HASH_TABLE_SIZE,MULTI_HASH);
    if (ht == NULL)
        dns_error(0, "create htable error");
    for (i = 0; i < THREADX; i++) {
        sh[i].ht = ht;
        sh[i].idx = i;
        if (pthread_create(pt + i, NULL, st_th, sh + i))
            dns_error(0, "create pthread");
    }
    for (i = 0; i < THREADX; i++)
        pthread_join(pt[i], NULL);
    sleep(2);
    return 0;
}
开发者ID:Houfeng,项目名称:dnspod-sr,代码行数:21,代码来源:storage.c


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