From d2725688e00cb6ad725d35355ce41b03e3552b6a Mon Sep 17 00:00:00 2001 From: hyung-hwan Date: Fri, 17 Nov 2023 16:57:12 +0900 Subject: [PATCH] implemented the option added in the previous commit --- bin/t01.c | 2 +- bin/t06.c | 2 +- bin/webs.c | 20 +++++++++++--- lib/dns-cli.c | 4 +-- lib/fcgi-cli.c | 14 +++++----- lib/fmt.c | 8 +++--- lib/hio-fcgi.h | 2 +- lib/hio-http.h | 27 ++++++++++--------- lib/hio.c | 6 ++--- lib/http-cgi.c | 8 ++++++ lib/http-file.c | 1 - lib/http-prv.h | 13 +++++++-- lib/http-svr.c | 70 ++++++++++++++++++++++++++++++++++++++++--------- lib/http-thr.c | 5 ++-- lib/sck.c | 8 +++--- lib/tmr.c | 2 +- t/s-001.sh | 1 + 17 files changed, 135 insertions(+), 58 deletions(-) diff --git a/bin/t01.c b/bin/t01.c index 326d49c..b871171 100644 --- a/bin/t01.c +++ b/bin/t01.c @@ -1245,7 +1245,7 @@ for (i = 0; i < 5; i++) HIO_INFO1 (hio, "UNABLE TO START DNC - %js\n", hio_geterrmsg(hio)); } - htts = hio_svc_htts_start(hio, 0, &htts_bind_info, 1, process_http_request, HIO_NULL); + htts = hio_svc_htts_start(hio, 0, &htts_bind_info, 1, process_http_request); if (htts) hio_svc_htts_setservernamewithbcstr (htts, "HIO-HTTP"); else HIO_INFO1 (hio, "UNABLE TO START HTTS - %js\n", hio_geterrmsg(hio)); diff --git a/bin/t06.c b/bin/t06.c index bcc54d0..c343dc8 100644 --- a/bin/t06.c +++ b/bin/t06.c @@ -263,7 +263,7 @@ void* thr_func (void* arg) htts_bind_info[1].ssl_keyfile = "localhost.key"; #endif - htts = hio_svc_htts_start(hio, 0, htts_bind_info, HIO_COUNTOF(htts_bind_info), process_http_request, HIO_NULL); + htts = hio_svc_htts_start(hio, 0, htts_bind_info, HIO_COUNTOF(htts_bind_info), process_http_request); if (!htts) { printf ("Unable to start htts\n"); diff --git a/bin/webs.c b/bin/webs.c index e09f911..56715cd 100644 --- a/bin/webs.c +++ b/bin/webs.c @@ -417,12 +417,26 @@ int webs_start (hio_t* hio, const arg_info_t* ai) } HIO_MEMSET (&fcgic_tmout, 0, HIO_SIZEOF(fcgic_tmout)); - fcgic_tmout.c.sec = 5; - fcgic_tmout.r.sec = 60; + HIO_INIT_NTIME(&fcgic_tmout.c, 5, 0); + HIO_INIT_NTIME(&fcgic_tmout.r, 60, 0); + HIO_INIT_NTIME(&fcgic_tmout.w, -1, 0); - webs = hio_svc_htts_start(hio, HIO_SIZEOF(htts_ext_t), bi, bic, process_http_request, &fcgic_tmout); + webs = hio_svc_htts_start(hio, HIO_SIZEOF(htts_ext_t), bi, bic, process_http_request); if (!webs) return -1; /* TODO: logging */ + { + hio_oow_t ov; + ov = 1000; + hio_svc_htts_setoption (webs, HIO_SVC_HTTS_TASK_CGI_MAX, &ov); + } + + if (hio_svc_htts_enablefcgic(webs, &fcgic_tmout) <= -1) + { + /* TODO: logging */ + hio_svc_htts_stop (webs); + return -1; + } + ext = hio_svc_htts_getxtn(webs); ext->ai = ai; diff --git a/lib/dns-cli.c b/lib/dns-cli.c index 3254306..ddad5f6 100644 --- a/lib/dns-cli.c +++ b/lib/dns-cli.c @@ -619,7 +619,7 @@ HIO_DEBUG1 (hio, "DNC - unable to receive dns response in time over udp - msgid: { hio_ntime_t* tmout; - tmout = HIO_IS_POS_NTIME(&msgxtn->wtmout)? &msgxtn->wtmout: HIO_NULL; + tmout = HIO_IS_NEG_NTIME(&msgxtn->wtmout)? HIO_NULL: &msgxtn->wtmout; HIO_DEBUG1 (hio, "DNC - sending dns question again over udp - msgid:%d\n", (int)hio_ntoh16(hio_dns_msg_to_pkt(reqmsg)->id)); if (hio_dev_sck_timedwrite(dev, hio_dns_msg_to_pkt(reqmsg), reqmsg->pktlen, tmout, reqmsg, &msgxtn->servaddr) >= 0) return; /* resent */ @@ -810,7 +810,7 @@ static HIO_INLINE int send_dns_msg (hio_svc_dnc_t* dnc, hio_dns_msg_t* msg, int HIO_DEBUG1 (dnc->hio, "DNC - sending dns message over udp - msgid:%d\n", (int)hio_ntoh16(hio_dns_msg_to_pkt(msg)->id)); - tmout = HIO_IS_POS_NTIME(&msgxtn->wtmout)? &msgxtn->wtmout: HIO_NULL; + tmout = HIO_IS_NEG_NTIME(&msgxtn->wtmout)? HIO_NULL: &msgxtn->wtmout; /* TODO: optionally, override dnc->serv_addr and use the target address passed as a parameter */ return hio_dev_sck_timedwrite(dnc->udp_sck, hio_dns_msg_to_pkt(msg), msg->pktlen, tmout, msg, &msgxtn->servaddr); } diff --git a/lib/fcgi-cli.c b/lib/fcgi-cli.c index d895b29..4b106d3 100644 --- a/lib/fcgi-cli.c +++ b/lib/fcgi-cli.c @@ -31,7 +31,6 @@ struct hio_svc_fcgic_t HIO_SVC_HEADER; int stopping; - int tmout_set; hio_svc_fcgic_tmout_t tmout; hio_svc_fcgic_conn_t* conns; @@ -125,7 +124,7 @@ static void sck_on_connect (hio_dev_sck_t* sck) HIO_MEMSET (&conn->r, 0, HIO_SIZEOF(conn->r)); conn->r.state = R_AWAITING_HEADER; - if (conn->fcgic->tmout_set) + if (!HIO_IS_NEG_NTIME(&conn->fcgic->tmout.r)) hio_dev_sck_timedread (sck, 1, &conn->fcgic->tmout.r); } @@ -318,7 +317,7 @@ static int make_connection_socket (hio_svc_fcgic_t* fcgic, hio_svc_fcgic_conn_t* HIO_MEMSET (&ci, 0, HIO_SIZEOF(ci)); ci.remoteaddr = conn->addr; - if (fcgic->tmout_set) ci.connect_tmout = fcgic->tmout.c; + ci.connect_tmout = fcgic->tmout.c; if (hio_dev_sck_connect(sck, &ci) <= -1) { @@ -489,12 +488,11 @@ hio_svc_fcgic_t* hio_svc_fcgic_start (hio_t* hio, const hio_svc_fcgic_tmout_t* t fcgic->hio = hio; fcgic->svc_stop = (hio_svc_stop_t)hio_svc_fcgic_stop; + HIO_INIT_NTIME(&fcgic->tmout.c, -1, 0); + HIO_INIT_NTIME(&fcgic->tmout.r, -1, 0); + HIO_INIT_NTIME(&fcgic->tmout.w, -1, 0); - if (tmout) - { - fcgic->tmout = *tmout; - fcgic->tmout_set = 1; - } + if (tmout) fcgic->tmout = *tmout; HIO_SVCL_APPEND_SVC (&hio->actsvc, (hio_svc_t*)fcgic); HIO_DEBUG1 (hio, "FCGIC - STARTED SERVICE %p\n", fcgic); diff --git a/lib/fmt.c b/lib/fmt.c index 826d42f..9461d33 100644 --- a/lib/fmt.c +++ b/lib/fmt.c @@ -1094,7 +1094,7 @@ static int fmt_outv (hio_fmtout_t* fmtout, va_list ap) sign = 0; if (lm_flag & LF_J) { - #if 0 && defined(__GNUC__) && \ + #if 1 && !defined(__clang__) && defined(__GNUC__) && \ (HIO_SIZEOF_UINTMAX_T > HIO_SIZEOF_OOW_T) && \ (HIO_SIZEOF_UINTMAX_T != HIO_SIZEOF_LONG_LONG) && \ (HIO_SIZEOF_UINTMAX_T != HIO_SIZEOF_LONG) @@ -1106,7 +1106,7 @@ static int fmt_outv (hio_fmtout_t* fmtout, va_list ap) #if defined(HIO_ENDIAN_BIG) num = num << (8 * HIO_SIZEOF(hio_oow_t)) | (va_arg(ap, hio_oow_t)); #else - register int shift = i * HIO_SIZEOF(hio_oow_t); + int shift = i * HIO_SIZEOF(hio_oow_t); hio_oow_t x = va_arg(ap, hio_oow_t); num |= (hio_uintmax_t)x << (shift * HIO_BITS_PER_BYTE); #endif @@ -1136,7 +1136,7 @@ static int fmt_outv (hio_fmtout_t* fmtout, va_list ap) handle_sign: if (lm_flag & LF_J) { - #if 0 && defined(__GNUC__) && \ + #if 1 && !defined(__clang__) && defined(__GNUC__) && \ (HIO_SIZEOF_INTMAX_T > HIO_SIZEOF_OOI_T) && \ (HIO_SIZEOF_UINTMAX_T != HIO_SIZEOF_LONG_LONG) && \ (HIO_SIZEOF_UINTMAX_T != HIO_SIZEOF_LONG) @@ -1148,7 +1148,7 @@ static int fmt_outv (hio_fmtout_t* fmtout, va_list ap) #if defined(HIO_ENDIAN_BIG) num = num << (8 * HIO_SIZEOF(hio_oow_t)) | (va_arg(ap, hio_oow_t)); #else - register int shift = i * HIO_SIZEOF(hio_oow_t); + int shift = i * HIO_SIZEOF(hio_oow_t); hio_oow_t x = va_arg(ap, hio_oow_t); num |= (hio_uintmax_t)x << (shift * HIO_BITS_PER_BYTE); #endif diff --git a/lib/hio-fcgi.h b/lib/hio-fcgi.h index 2d685cf..14324d0 100644 --- a/lib/hio-fcgi.h +++ b/lib/hio-fcgi.h @@ -135,7 +135,7 @@ typedef int (*hio_svc_fcgic_on_write_t) ( typedef void (*hio_svc_fcgic_on_untie_t) ( hio_svc_fcgic_sess_t* sess, - void* ctx; + void* ctx ); struct hio_svc_fcgic_sess_t diff --git a/lib/hio-http.h b/lib/hio-http.h index 94bb5ab..6a5152b 100644 --- a/lib/hio-http.h +++ b/lib/hio-http.h @@ -79,8 +79,7 @@ typedef enum hio_perenc_http_option_t hio_perenc_bcstr_option_t; enum hio_svc_htts_option_t { HIO_SVC_HTTS_TASK_MAX, - HIO_SVC_HTTS_TASK_CGI_MAX, - HIO_SVC_HTTS_FCGI_TMOUT, + HIO_SVC_HTTS_TASK_CGI_MAX }; typedef enum hio_svc_htts_option_t hio_svc_htts_option_t; @@ -397,14 +396,23 @@ HIO_EXPORT hio_svc_htts_t* hio_svc_htts_start ( hio_oow_t xtnsize, hio_dev_sck_bind_t* binds, hio_oow_t nbinds, - hio_svc_htts_proc_req_t proc_req, - const hio_svc_fcgic_tmout_t* fcgic_tmout + hio_svc_htts_proc_req_t proc_req ); HIO_EXPORT void hio_svc_htts_stop ( hio_svc_htts_t* htts ); +HIO_EXPORT void* hio_svc_htts_getxtn ( + hio_svc_htts_t* htts +); + +#if defined(HIO_HAVE_INLINE) +static HIO_INLINE hio_t* hio_svc_htts_gethio(hio_svc_htts_t* svc) { return hio_svc_gethio((hio_svc_t*)svc); } +#else +# define hio_svc_htts_gethio(svc) hio_svc_gethio(svc) +#endif + HIO_EXPORT int hio_svc_htts_getoption ( hio_svc_htts_t* htts, hio_svc_htts_option_t id, @@ -417,16 +425,11 @@ HIO_EXPORT int hio_svc_htts_setoption ( const void* value ); -HIO_EXPORT void* hio_svc_htts_getxtn ( - hio_svc_htts_t* htts +HIO_EXPORT int hio_svc_htts_enablefcgic ( + hio_svc_htts_t* htts, + hio_svc_fcgic_tmout_t* tmout ); -#if defined(HIO_HAVE_INLINE) -static HIO_INLINE hio_t* hio_svc_htts_gethio(hio_svc_htts_t* svc) { return hio_svc_gethio((hio_svc_t*)svc); } -#else -# define hio_svc_htts_gethio(svc) hio_svc_gethio(svc) -#endif - HIO_EXPORT int hio_svc_htts_writetosidechan ( hio_svc_htts_t* htts, hio_oow_t idx, /* listener index */ diff --git a/lib/hio.c b/lib/hio.c index 584f632..aec5735 100644 --- a/lib/hio.c +++ b/lib/hio.c @@ -1444,7 +1444,7 @@ update_timer: dev->rtmridx = HIO_TMRIDX_INVALID; } - if (tmout && HIO_IS_POS_NTIME(tmout)) + if (tmout && !HIO_IS_NEG_NTIME(tmout)) { hio_tmrjob_t tmrjob; @@ -1584,7 +1584,7 @@ static HIO_INLINE int __enqueue_pending_write (hio_dev_t* dev, hio_iolen_t olen, j += iov[i].iov_len; } - if (tmout && HIO_IS_POS_NTIME(tmout)) + if (tmout && !HIO_IS_NEG_NTIME(tmout)) { hio_tmrjob_t tmrjob; @@ -1657,7 +1657,7 @@ static HIO_INLINE int __enqueue_pending_sendfile (hio_dev_t* dev, hio_iolen_t ol ((wq_sendfile_data_t*)q->ptr)->in_fd = in_fd; ((wq_sendfile_data_t*)q->ptr)->foff = foff; - if (tmout && HIO_IS_POS_NTIME(tmout)) + if (tmout && !HIO_IS_NEG_NTIME(tmout)) { hio_tmrjob_t tmrjob; diff --git a/lib/http-cgi.c b/lib/http-cgi.c index 30d6af3..03ba07d 100644 --- a/lib/http-cgi.c +++ b/lib/http-cgi.c @@ -192,6 +192,7 @@ static void cgi_on_kill (hio_svc_htts_task_t* task) } if (cgi->task_next) HIO_SVC_HTTS_TASKL_UNLINK_TASK (cgi); /* detach from the htts service only if it's attached */ + cgi->htts->stat.ntask_cgis--; HIO_DEBUG5 (hio, "HTTS(%p) - cgi(t=%p,c=%p[%d],p=%p) - killed the task\n", cgi->htts, cgi, cgi->task_client, (cgi->task_csck? cgi->task_csck->hnd: -1), cgi->peer); } @@ -938,9 +939,16 @@ int hio_svc_htts_docgi (hio_svc_htts_t* htts, hio_dev_sck_t* csck, hio_htre_t* r HIO_ASSERT (hio, hio_htre_getcontentlen(req) == 0); HIO_ASSERT (hio, cli->sck == csck); + if (htts->stat.ntask_cgis >= htts->option.task_cgi_max) + { + hio_seterrbfmt (hio, HIO_ENOCAPA, "too many cgi tasks"); + return -1; + } + cgi = (cgi_t*)hio_svc_htts_task_make(htts, HIO_SIZEOF(*cgi), cgi_on_kill, req, csck); if (HIO_UNLIKELY(!cgi)) goto oops; HIO_SVC_HTTS_TASK_RCUP((hio_svc_htts_task_t*)cgi); + htts->stat.ntask_cgis++; cgi->on_kill = on_kill; cgi->options = options; diff --git a/lib/http-file.c b/lib/http-file.c index 1363f2a..27f221d 100644 --- a/lib/http-file.c +++ b/lib/http-file.c @@ -825,7 +825,6 @@ static void unbind_task_from_peer (file_t* file, int rcdown) { while (n > 0) { -HIO_DEBUG1(hio, "RCDOWN.... %d\n", n); n--; HIO_SVC_HTTS_TASK_RCDOWN((hio_svc_htts_task_t*)file); } diff --git a/lib/http-prv.h b/lib/http-prv.h index 3c5e79e..c94c040 100644 --- a/lib/http-prv.h +++ b/lib/http-prv.h @@ -79,8 +79,17 @@ struct hio_svc_htts_t hio_becs_t* becbuf; /* temporary buffer for any work */ - int fcgic_tmout_set; - hio_svc_fcgic_tmout_t fcgic_tmout; + struct + { + hio_oow_t task_max; + hio_oow_t task_cgi_max; + } option; + + struct + { + hio_ooi_t ntasks; + hio_ooi_t ntask_cgis; + } stat; }; struct hio_svc_httc_t diff --git a/lib/http-svr.c b/lib/http-svr.c index 3566c47..8924dbf 100644 --- a/lib/http-svr.c +++ b/lib/http-svr.c @@ -427,7 +427,7 @@ static void halt_idle_clients (hio_t* hio, const hio_ntime_t* now, hio_tmrjob_t* /* ------------------------------------------------------------------------ */ -hio_svc_htts_t* hio_svc_htts_start (hio_t* hio, hio_oow_t xtnsize, hio_dev_sck_bind_t* binds, hio_oow_t nbinds, hio_svc_htts_proc_req_t proc_req, const hio_svc_fcgic_tmout_t* fcgic_tmout) +hio_svc_htts_t* hio_svc_htts_start (hio_t* hio, hio_oow_t xtnsize, hio_dev_sck_bind_t* binds, hio_oow_t nbinds, hio_svc_htts_proc_req_t proc_req) { hio_svc_htts_t* htts = HIO_NULL; union @@ -454,11 +454,8 @@ hio_svc_htts_t* hio_svc_htts_start (hio_t* hio, hio_oow_t xtnsize, hio_dev_sck_b htts->proc_req = proc_req; htts->idle_tmridx = HIO_TMRIDX_INVALID; - if (fcgic_tmout) - { - htts->fcgic_tmout_set = 1; - htts->fcgic_tmout = *fcgic_tmout; - } + htts->option.task_max = HIO_TYPE_MAX(hio_oow_t); + htts->option.task_cgi_max = HIO_TYPE_MAX(hio_oow_t); htts->becbuf = hio_becs_open(hio, 0, 256); if (HIO_UNLIKELY(!htts->becbuf)) goto oops; @@ -574,13 +571,6 @@ hio_svc_htts_t* hio_svc_htts_start (hio_t* hio, hio_oow_t xtnsize, hio_dev_sck_b HIO_SVC_HTTS_CLIL_INIT (&htts->cli); HIO_SVC_HTTS_TASKL_INIT (&htts->task); - htts->fcgic = hio_svc_fcgic_start(htts->hio, (htts->fcgic_tmout_set? &htts->fcgic_tmout: HIO_NULL)); - - if (HIO_UNLIKELY(!htts->fcgic)) - { - /* TODO: only warning ... */ - } - HIO_DEBUG1 (hio, "HTTS - STARTED SERVICE %p\n", htts); { @@ -674,6 +664,58 @@ void* hio_svc_htts_getxtn (hio_svc_htts_t* htts) return (void*)(htts + 1); } + +int hio_svc_htts_getoption (hio_svc_htts_t* htts, hio_svc_htts_option_t id, void* value) +{ + switch (id) + { + case HIO_SVC_HTTS_TASK_MAX: + *(hio_oow_t*)value = htts->option.task_max; + break; + + case HIO_SVC_HTTS_TASK_CGI_MAX: + *(hio_oow_t*)value = htts->option.task_cgi_max; + break; + + default: + goto einval; + } + + return 0; + +einval: + hio_seterrnum (htts->hio, HIO_EINVAL); +} + +int hio_svc_htts_setoption (hio_svc_htts_t* htts, hio_svc_htts_option_t id, const void* value) +{ + switch (id) + { + case HIO_SVC_HTTS_TASK_MAX: + htts->option.task_max = *(const hio_oow_t*)value; + break; + case HIO_SVC_HTTS_TASK_CGI_MAX: + htts->option.task_cgi_max = *(const hio_oow_t*)value; + break; + + default: + goto einval; + } + + return 0; + +einval: + hio_seterrnum (htts->hio, HIO_EINVAL); + return -1; +} + +int hio_svc_htts_enablefcgic (hio_svc_htts_t* htts, hio_svc_fcgic_tmout_t* tmout) +{ + if (htts->fcgic) return 0; + htts->fcgic = hio_svc_fcgic_start(htts->hio, tmout); + return htts->fcgic? 0: -1; +} + int hio_svc_htts_setservernamewithbcstr (hio_svc_htts_t* htts, const hio_bch_t* name) { hio_t* hio = htts->hio; @@ -795,6 +837,7 @@ hio_svc_htts_task_t* hio_svc_htts_task_make (hio_svc_htts_t* htts, hio_oow_t tas HIO_ASSERT (hio, csck->on_write == client_on_write); HIO_ASSERT (hio, csck->on_disconnect == client_on_disconnect); + htts->stat.ntasks++; HIO_DEBUG2 (hio, "HTTS(%p) - allocated task %p\n", htts, task); return task; } @@ -809,6 +852,7 @@ void hio_svc_htts_task_kill (hio_svc_htts_task_t* task) if (task->task_on_kill) task->task_on_kill (task); hio_freemem (hio, task); + htts->stat.ntasks--; HIO_DEBUG2 (hio, "HTTS(%p) - destroyed task %p\n", htts, task); } diff --git a/lib/http-thr.c b/lib/http-thr.c index 1de0210..6e2673f 100644 --- a/lib/http-thr.c +++ b/lib/http-thr.c @@ -184,7 +184,7 @@ static void thr_on_kill (hio_svc_htts_task_t* task) * it is the task destruction callback. (passing 0 to unbind_task_from_peer/client) */ - unbind_task_from_peer (task, 0); + unbind_task_from_peer (thr, 0); if (thr->task_csck) { @@ -301,7 +301,8 @@ oops: static int peer_capture_response_header (hio_htre_t* req, const hio_bch_t* key, const hio_htre_hdrval_t* val, void* ctx) { - return hio_svc_htts_task_addreshdrs((thr_t*)ctx, key, val); + thr_t* thr = (thr_t*)ctx; + return hio_svc_htts_task_addreshdrs(thr, key, val); } static int thr_peer_htrd_peek (hio_htrd_t* htrd, hio_htre_t* req) diff --git a/lib/sck.c b/lib/sck.c index 321968b..86bc9a4 100644 --- a/lib/sck.c +++ b/lib/sck.c @@ -1477,9 +1477,9 @@ fcntl (rdev->hnd, F_SETFL, flags | O_NONBLOCK); } else { - HIO_INIT_NTIME (&rdev->tmout, 0, 0); /* just in case */ + HIO_INIT_NTIME (&rdev->tmout, -1, 0); /* just in case */ - if (HIO_IS_POS_NTIME(&conn->connect_tmout)) + if (!HIO_IS_NEG_NTIME(&conn->connect_tmout)) { if (schedule_timer_job_after(rdev, &conn->connect_tmout, connect_timedout) <= -1) { @@ -1761,7 +1761,7 @@ static int harvest_outgoing_connection (hio_dev_sck_t* rdev) /* rdev->tmout has been set to the deadline of the connect task * when the CONNECT IOCTL command has been executed. use the * same deadline here */ - if (HIO_IS_POS_NTIME(&rdev->tmout) && + if (!HIO_IS_NEG_NTIME(&rdev->tmout) && schedule_timer_job_at(rdev, &rdev->tmout, ssl_connect_timedout) <= -1) { HIO_DEBUG1 (hio, "SCK(%p) - ssl-connect timeout scheduling failed. halting\n", rdev); @@ -1907,7 +1907,7 @@ static int make_accepted_client_connection (hio_dev_sck_t* rdev, hio_syshnd_t cl /* let the client device know the SSL context to use */ clidev->ssl_ctx = rdev->ssl_ctx; - if (HIO_IS_POS_NTIME(&rdev->tmout) && + if (!HIO_IS_NEG_NTIME(&rdev->tmout) && schedule_timer_job_after(clidev, &rdev->tmout, ssl_accept_timedout) <= -1) { /* timer job scheduling failed. halt the device */ diff --git a/lib/tmr.c b/lib/tmr.c index c6b7805..50b4071 100644 --- a/lib/tmr.c +++ b/lib/tmr.c @@ -240,7 +240,7 @@ int hio_schedtmrjobafter (hio_t* hio, const hio_ntime_t* fire_after, hio_tmrjob_ { hio_ntime_t fire_at; - HIO_ASSERT (hio, HIO_IS_POS_NTIME(fire_after)); + HIO_ASSERT (hio, !HIO_IS_NEG_NTIME(fire_after)); hio_gettime (hio, &fire_at); HIO_ADD_NTIME (&fire_at, &fire_at, fire_after); diff --git a/t/s-001.sh b/t/s-001.sh index 95379ed..845a73d 100644 --- a/t/s-001.sh +++ b/t/s-001.sh @@ -12,6 +12,7 @@ test_default_index() mkdir -p "${tmpdir}" ## check if index.html is retrieved + echo ../bin/hio-webs --file-no-list-dir "${srvaddr}" "${tmpdir}" 2>/dev/null & ../bin/hio-webs --file-no-list-dir "${srvaddr}" "${tmpdir}" 2>/dev/null & local jid=$!