updated some error messages

This commit is contained in:
hyung-hwan 2022-06-25 16:00:28 +00:00
parent 9b6b6f2bb2
commit 066ffc6ced
3 changed files with 24 additions and 17 deletions

View File

@ -767,6 +767,9 @@ static HIO_INLINE void handle_event (hio_t* hio, hio_dev_t* dev, int events, int
{ {
/* 1. input ended and its reporting failed or /* 1. input ended and its reporting failed or
* 2. input ended and no writing is possible */ * 2. input ended and no writing is possible */
if (dev->dev_cap & HIO_DEV_CAP_OUT_CLOSED)
HIO_DEBUG1 (hio, "DEV(%p) - halting a stream device as output is closed\n", dev);
else
HIO_DEBUG2 (hio, "DEV(%p) - halting a stream device for on_read failure while output is closed - %js\n", dev, hio_geterrmsg(hio)); HIO_DEBUG2 (hio, "DEV(%p) - halting a stream device for on_read failure while output is closed - %js\n", dev, hio_geterrmsg(hio));
hio_dev_halt (dev); hio_dev_halt (dev);
dev = HIO_NULL; dev = HIO_NULL;
@ -792,8 +795,7 @@ static HIO_INLINE void handle_event (hio_t* hio, hio_dev_t* dev, int events, int
} }
else if (y == 0) else if (y == 0)
{ {
/* don't be greedy. read only once /* don't be greedy. read only once for this loop iteration */
* for this loop iteration */
break; break;
} }
} }
@ -835,8 +837,7 @@ static HIO_INLINE void handle_event (hio_t* hio, hio_dev_t* dev, int events, int
} }
} }
if ((dev->dev_cap & HIO_DEV_CAP_IN_CLOSED) && if ((dev->dev_cap & HIO_DEV_CAP_IN_CLOSED) && (dev->dev_cap & HIO_DEV_CAP_OUT_CLOSED))
(dev->dev_cap & HIO_DEV_CAP_OUT_CLOSED))
{ {
HIO_DEBUG1 (hio, "DEV(%p) - halting a device for closed input and output\n", dev); HIO_DEBUG1 (hio, "DEV(%p) - halting a device for closed input and output\n", dev);
hio_dev_halt (dev); hio_dev_halt (dev);

View File

@ -348,6 +348,7 @@ static void cgi_peer_on_close (hio_dev_pro_t* pro, hio_dev_pro_sid_t sid)
break; break;
case HIO_DEV_PRO_IN: case HIO_DEV_PRO_IN:
HIO_DEBUG4 (hio, "HTTS(%p) - peer %p(pid=%d) closing slave[%d]\n", cgi->client->htts, pro, (int)pro->child_pid, sid);
cgi_mark_over (cgi, CGI_OVER_WRITE_TO_PEER); cgi_mark_over (cgi, CGI_OVER_WRITE_TO_PEER);
break; break;
@ -370,21 +371,23 @@ static int cgi_peer_on_read (hio_dev_pro_t* pro, hio_dev_pro_sid_t sid, const vo
if (dlen <= -1) if (dlen <= -1)
{ {
HIO_DEBUG3 (hio, "HTTPS(%p) - read error from peer %p(pid=%u)\n", cgi->client->htts, pro, (unsigned int)pro->child_pid); HIO_DEBUG3 (hio, "HTTS(%p) - read error from peer %p(pid=%u)\n", cgi->client->htts, pro, (unsigned int)pro->child_pid);
goto oops; goto oops;
} }
if (dlen == 0) if (dlen == 0)
{ {
HIO_DEBUG3 (hio, "HTTPS(%p) - EOF from peer %p(pid=%u)\n", cgi->client->htts, pro, (unsigned int)pro->child_pid); HIO_DEBUG3 (hio, "HTTS(%p) - EOF from peer %p(pid=%u)\n", cgi->client->htts, pro, (unsigned int)pro->child_pid);
if (!(cgi->over & CGI_OVER_READ_FROM_PEER)) if (!(cgi->over & CGI_OVER_READ_FROM_PEER))
{ {
/* the cgi script could be misbehaviing. int n;
/* the cgi script could be misbehaving.
* it still has to read more but EOF is read. * it still has to read more but EOF is read.
* otherwise client_peer_htrd_poke() should have been called */ * otherwise cgi_peer_htrd_poke() should have been called */
if (cgi_write_last_chunk_to_client(cgi) <= -1) goto oops; n = cgi_write_last_chunk_to_client(cgi);
cgi_mark_over (cgi, CGI_OVER_READ_FROM_PEER); cgi_mark_over (cgi, CGI_OVER_READ_FROM_PEER);
if (n <= -1) goto oops;
} }
} }
else else
@ -395,7 +398,7 @@ static int cgi_peer_on_read (hio_dev_pro_t* pro, hio_dev_pro_sid_t sid, const vo
if (hio_htrd_feed(cgi->peer_htrd, data, dlen, &rem) <= -1) if (hio_htrd_feed(cgi->peer_htrd, data, dlen, &rem) <= -1)
{ {
HIO_DEBUG3 (hio, "HTTPS(%p) - unable to feed peer htrd - peer %p(pid=%u)\n", cgi->htts, pro, (unsigned int)pro->child_pid); HIO_DEBUG3 (hio, "HTTS(%p) - unable to feed peer htrd - peer %p(pid=%u)\n", cgi->htts, pro, (unsigned int)pro->child_pid);
if (!cgi->ever_attempted_to_write_to_client && if (!cgi->ever_attempted_to_write_to_client &&
!(cgi->over & CGI_OVER_WRITE_TO_CLIENT)) !(cgi->over & CGI_OVER_WRITE_TO_CLIENT))
@ -627,7 +630,7 @@ static int cgi_peer_on_write (hio_dev_pro_t* pro, hio_iolen_t wrlen, void* wrctx
else if (wrlen == 0) else if (wrlen == 0)
{ {
/* indicated EOF */ /* indicated EOF */
/* do nothing here as i didn't incremented num_pending_writes_to_peer when making the write request */ /* do nothing here as i didn't increment num_pending_writes_to_peer when making the write request */
cgi->num_pending_writes_to_peer--; cgi->num_pending_writes_to_peer--;
HIO_ASSERT (hio, cgi->num_pending_writes_to_peer == 0); HIO_ASSERT (hio, cgi->num_pending_writes_to_peer == 0);
@ -679,7 +682,7 @@ static int cgi_client_on_read (hio_dev_sck_t* sck, const void* buf, hio_iolen_t
if (len <= -1) if (len <= -1)
{ {
/* read error */ /* read error */
HIO_DEBUG2 (cli->htts->hio, "HTTPS(%p) - read error on client %p(%d)\n", sck, (int)sck->hnd); HIO_DEBUG2 (cli->htts->hio, "HTTS(%p) - read error on client %p(%d)\n", sck, (int)sck->hnd);
goto oops; goto oops;
} }
@ -692,7 +695,7 @@ static int cgi_client_on_read (hio_dev_sck_t* sck, const void* buf, hio_iolen_t
if (len == 0) if (len == 0)
{ {
/* EOF on the client side. arrange to close */ /* EOF on the client side. arrange to close */
HIO_DEBUG3 (hio, "HTTPS(%p) - EOF from client %p(hnd=%d)\n", cgi->client->htts, sck, (int)sck->hnd); HIO_DEBUG3 (hio, "HTTS(%p) - EOF from client %p(hnd=%d)\n", cgi->client->htts, sck, (int)sck->hnd);
if (!(cgi->over & CGI_OVER_READ_FROM_CLIENT)) /* if this is true, EOF is received without cgi_client_htrd_poke() */ if (!(cgi->over & CGI_OVER_READ_FROM_CLIENT)) /* if this is true, EOF is received without cgi_client_htrd_poke() */
{ {
@ -711,7 +714,7 @@ static int cgi_client_on_read (hio_dev_sck_t* sck, const void* buf, hio_iolen_t
if (rem > 0) if (rem > 0)
{ {
/* TODO store this to client buffer. once the current resource is completed, arrange to call on_read() with it */ /* TODO store this to client buffer. once the current resource is completed, arrange to call on_read() with it */
HIO_DEBUG3 (hio, "HTTPS(%p) - excessive data after contents by cgi client %p(%d)\n", sck->hio, sck, (int)sck->hnd); HIO_DEBUG3 (hio, "HTTS(%p) - excessive data after contents by cgi client %p(%d)\n", sck->hio, sck, (int)sck->hnd);
} }
} }
@ -730,7 +733,7 @@ static int cgi_client_on_write (hio_dev_sck_t* sck, hio_iolen_t wrlen, void* wrc
if (wrlen <= -1) if (wrlen <= -1)
{ {
HIO_DEBUG3 (hio, "HTTPS(%p) - unable to write to client %p(%d)\n", sck->hio, sck, (int)sck->hnd); HIO_DEBUG3 (hio, "HTTS(%p) - unable to write to client %p(%d)\n", sck->hio, sck, (int)sck->hnd);
goto oops; goto oops;
} }

View File

@ -401,7 +401,10 @@ static int dev_pro_make_master (hio_dev_t* dev, void* ctx)
rdev->on_write = info->on_write; rdev->on_write = info->on_write;
rdev->on_close = info->on_close; rdev->on_close = info->on_close;
HIO_DEBUG4 (hio, "PRO(%p) - in %p out %p err %p\n", dev, rdev->slave[HIO_DEV_PRO_IN], rdev->slave[HIO_DEV_PRO_OUT], rdev->slave[HIO_DEV_PRO_ERR]); HIO_DEBUG7 (hio, "PRO(%p) - slave[%d] %p slave[%d] %p slave[%d] %p\n", dev,
HIO_DEV_PRO_IN, rdev->slave[HIO_DEV_PRO_IN],
HIO_DEV_PRO_OUT, rdev->slave[HIO_DEV_PRO_OUT],
HIO_DEV_PRO_ERR, rdev->slave[HIO_DEV_PRO_ERR]);
return 0; return 0;
oops: oops: