From 53ddebff6d63f2fbe7f1f05dab002fb69b6f6cc9 Mon Sep 17 00:00:00 2001 From: hyung-hwan Date: Sun, 8 Aug 2021 07:22:50 +0000 Subject: [PATCH] added description about choice of acepted client socket methods --- hio/bin/t01.c | 12 ++++++++---- hio/lib/sck.c | 13 +++++++++---- 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/hio/bin/t01.c b/hio/bin/t01.c index 253896c..ad901f9 100644 --- a/hio/bin/t01.c +++ b/hio/bin/t01.c @@ -710,7 +710,7 @@ static void on_dnc_resolve(hio_svc_dnc_t* dnc, hio_dns_msg_t* reqmsg, hio_errnum printf (">>>>>>>> RRDLEN = %d\n", (int)pi->_rrdlen); - printf (">>>>>>>> RCODE %s(%d) EDNS exist %d uplen %d version %d dnssecok %d\n", hio_dns_rcode_to_bcstr(pi->hdr.rcode), pi->hdr.rcode, pi->edns.exist, pi->edns.uplen, pi->edns.version, pi->edns.dnssecok); + printf (">>>>>>>> RCODE %s(%d) EDNS exist %d uplen %d version %d dnssecok %d qdcount %d ancount %d nscount %d arcount %d\n", hio_dns_rcode_to_bcstr(pi->hdr.rcode), pi->hdr.rcode, pi->edns.exist, pi->edns.uplen, pi->edns.version, pi->edns.dnssecok, pi->qdcount, pi->ancount, pi->nscount, pi->arcount); if (pi->hdr.rcode == HIO_DNS_RCODE_BADCOOKIE) { /* TODO: must retry?? there shoudl be no RRs in the payload */ @@ -727,8 +727,12 @@ static void on_dnc_resolve(hio_svc_dnc_t* dnc, hio_dns_msg_t* reqmsg, hio_errnum printf ("CLIENT COOKIE IS OK>>>>>>>>>>>>>>>>>>>%d\n", hio_svc_dnc_checkclientcookie(dnc, reqmsg, pi)); } + //if (pi->hdr.rcode != HIO_DNS_RCODE_NOERROR) goto no_data; - if (pi->ancount < 0) goto no_data; + if (pi->ancount < 0) + { + goto no_data; + } for (i = 0; i < pi->ancount; i++) { @@ -1216,8 +1220,8 @@ for (i = 0; i < 5; i++) reply_tmout.sec = 1; reply_tmout.nsec = 0; - //hio_bcstrtoskad (hio, "8.8.8.8:53", &servaddr); - hio_bcstrtoskad (hio, "198.41.0.4:53", &servaddr); // a.root-servers.net + hio_bcstrtoskad (hio, "8.8.8.8:53", &servaddr); + //hio_bcstrtoskad (hio, "198.41.0.4:53", &servaddr); // a.root-servers.net //hio_bcstrtoskad (hio, "130.59.31.29:53", &servaddr); // ns2.switch.ch //hio_bcstrtoskad (hio, "134.119.216.86:53", &servaddr); // ns.manyhost.net //hio_bcstrtoskad (hio, "[fe80::c7e2:bd6e:1209:ac1b]:1153", &servaddr); diff --git a/hio/lib/sck.c b/hio/lib/sck.c index 3eedd45..56416b1 100644 --- a/hio/lib/sck.c +++ b/hio/lib/sck.c @@ -1711,10 +1711,15 @@ static int make_accepted_client_connection (hio_dev_sck_t* rdev, hio_syshnd_t cl return 0; } - /* use rdev->dev_size when instantiating a client sck device - * instead of HIO_SIZEOF(hio_dev_sck_t). therefore, the - * extension area as big as that of the master sck device - * is created in the client sck device */ + /* rdev->dev_size: + * use rdev->dev_size when instantiating a client sck device + * instead of HIO_SIZEOF(hio_dev_sck_t). therefore, the + * extension area as big as that of the master socket device + * is created in the client sck device + * dev_mth: + * choose the client socket method base on the master socket + * device capability. currently, stream or non-stream is supported. + */ dev_mth = (sck_type_map[clisck_type].extra_dev_cap & HIO_DEV_CAP_STREAM)? &dev_mth_clisck_stream: &dev_mth_clisck_stateless; clidev = (hio_dev_sck_t*)hio_dev_make(hio, rdev->dev_size, dev_mth, rdev->dev_evcb, &clisck); if (HIO_UNLIKELY(!clidev))