added HIO_ENOTCON to indicate 'not connected'

This commit is contained in:
hyung-hwan 2021-09-03 08:21:21 +00:00
parent c8c8655ff6
commit 0be47defef
3 changed files with 18 additions and 10 deletions

View File

@ -49,14 +49,15 @@ static hio_ooch_t errstr_20[] = {'I', '/', 'O', ' ', 'e', 'r', 'r', 'o', 'r', '\
static hio_ooch_t errstr_21[] = {'e', 'n', 'c', 'o', 'd', 'i', 'n', 'g', ' ', 'c', 'o', 'n', 'v', 'e', 'r', 's', 'i', 'o', 'n', ' ', 'e', 'r', 'r', 'o', 'r', '\0' }; static hio_ooch_t errstr_21[] = {'e', 'n', 'c', 'o', 'd', 'i', 'n', 'g', ' ', 'c', 'o', 'n', 'v', 'e', 'r', 's', 'i', 'o', 'n', ' ', 'e', 'r', 'r', 'o', 'r', '\0' };
static hio_ooch_t errstr_22[] = {'i', 'n', 's', 'u', 'f', 'f', 'i', 'c', 'i', 'e', 'n', 't', ' ', 'd', 'a', 't', 'a', ' ', 'f', 'o', 'r', ' ', 'e', 'n', 'c', 'o', 'd', 'i', 'n', 'g', ' ', 'c', 'o', 'n', 'v', 'e', 'r', 's', 'i', 'o', 'n', '\0' }; static hio_ooch_t errstr_22[] = {'i', 'n', 's', 'u', 'f', 'f', 'i', 'c', 'i', 'e', 'n', 't', ' ', 'd', 'a', 't', 'a', ' ', 'f', 'o', 'r', ' ', 'e', 'n', 'c', 'o', 'd', 'i', 'n', 'g', ' ', 'c', 'o', 'n', 'v', 'e', 'r', 's', 'i', 'o', 'n', '\0' };
static hio_ooch_t errstr_23[] = {'b', 'u', 'f', 'f', 'e', 'r', ' ', 'f', 'u', 'l', 'l', '\0' }; static hio_ooch_t errstr_23[] = {'b', 'u', 'f', 'f', 'e', 'r', ' ', 'f', 'u', 'l', 'l', '\0' };
static hio_ooch_t errstr_24[] = {'c', 'o', 'n', 'n', 'e', 'c', 't', 'i', 'o', 'n', ' ', 'r', 'e', 'f', 'u', 's', 'e', 'd', '\0' }; static hio_ooch_t errstr_24[] = {'n', 'o', 't', ' ', 'c', 'o', 'n', 'n', 'e', 'c', 't', 'e', 'd', '\0' };
static hio_ooch_t errstr_25[] = {'c', 'o', 'n', 'n', 'e', 'c', 't', 'i', 'o', 'n', ' ', 'r', 'e', 's', 'e', 't', '\0' }; static hio_ooch_t errstr_25[] = {'c', 'o', 'n', 'n', 'e', 'c', 't', 'i', 'o', 'n', ' ', 'r', 'e', 'f', 'u', 's', 'e', 'd', '\0' };
static hio_ooch_t errstr_26[] = {'n', 'o', ' ', 'c', 'a', 'p', 'a', 'b', 'i', 'l', 'i', 't', 'y', '\0' }; static hio_ooch_t errstr_26[] = {'c', 'o', 'n', 'n', 'e', 'c', 't', 'i', 'o', 'n', ' ', 'r', 'e', 's', 'e', 't', '\0' };
static hio_ooch_t errstr_27[] = {'t', 'i', 'm', 'e', 'd', ' ', 'o', 'u', 't', '\0' }; static hio_ooch_t errstr_27[] = {'n', 'o', ' ', 'c', 'a', 'p', 'a', 'b', 'i', 'l', 'i', 't', 'y', '\0' };
static hio_ooch_t errstr_28[] = {'n', 'o', ' ', 'r', 'e', 's', 'p', 'o', 'n', 's', 'e', '\0' }; static hio_ooch_t errstr_28[] = {'t', 'i', 'm', 'e', 'd', ' ', 'o', 'u', 't', '\0' };
static hio_ooch_t errstr_29[] = {'u', 'n', 'a', 'b', 'l', 'e', ' ', 't', 'o', ' ', 'm', 'a', 'k', 'e', ' ', 'd', 'e', 'v', 'i', 'c', 'e', '\0' }; static hio_ooch_t errstr_29[] = {'n', 'o', ' ', 'r', 'e', 's', 'p', 'o', 'n', 's', 'e', '\0' };
static hio_ooch_t errstr_30[] = {'d', 'e', 'v', 'i', 'c', 'e', ' ', 'e', 'r', 'r', 'o', 'r', '\0' }; static hio_ooch_t errstr_30[] = {'u', 'n', 'a', 'b', 'l', 'e', ' ', 't', 'o', ' ', 'm', 'a', 'k', 'e', ' ', 'd', 'e', 'v', 'i', 'c', 'e', '\0' };
static hio_ooch_t errstr_31[] = {'d', 'e', 'v', 'i', 'c', 'e', ' ', 'h', 'a', 'n', 'g', '-', 'u', 'p', '\0' }; static hio_ooch_t errstr_31[] = {'d', 'e', 'v', 'i', 'c', 'e', ' ', 'e', 'r', 'r', 'o', 'r', '\0' };
static hio_ooch_t errstr_32[] = {'d', 'e', 'v', 'i', 'c', 'e', ' ', 'h', 'a', 'n', 'g', '-', 'u', 'p', '\0' };
static hio_ooch_t* errstr[] = static hio_ooch_t* errstr[] =
{ {
errstr_0, errstr_1, errstr_2, errstr_3, errstr_4, errstr_0, errstr_1, errstr_2, errstr_3, errstr_4,
@ -65,7 +66,7 @@ static hio_ooch_t* errstr[] =
errstr_15, errstr_16, errstr_17, errstr_18, errstr_19, errstr_15, errstr_16, errstr_17, errstr_18, errstr_19,
errstr_20, errstr_21, errstr_22, errstr_23, errstr_24, errstr_20, errstr_21, errstr_22, errstr_23, errstr_24,
errstr_25, errstr_26, errstr_27, errstr_28, errstr_29, errstr_25, errstr_26, errstr_27, errstr_28, errstr_29,
errstr_30, errstr_31 errstr_30, errstr_31, errstr_32
}; };

View File

@ -99,6 +99,7 @@ enum hio_errnum_t
HIO_EECMORE, /**< insufficient data for encoding conversion */ HIO_EECMORE, /**< insufficient data for encoding conversion */
HIO_EBUFFULL, /**< buffer full */ HIO_EBUFFULL, /**< buffer full */
HIO_ENOTCON, /**< not connected */
HIO_ECONRF, /**< connection refused */ HIO_ECONRF, /**< connection refused */
HIO_ECONRS, /**< connection reset */ HIO_ECONRS, /**< connection reset */
HIO_ENOCAPA, /**< no capability */ HIO_ENOCAPA, /**< no capability */

View File

@ -312,7 +312,7 @@ static int dev_mar_ioctl (hio_dev_t* dev, int cmd, void* arg)
watch_mysql (rdev, 0); watch_mysql (rdev, 0);
hio_dev_mar_halt (rdev); /* i can't keep this device alive regardless of the caller's post-action */ hio_dev_mar_halt (rdev); /* i can't keep this device alive regardless of the caller's post-action */
hio_seterrbfmt (hio, HIO_ESYSERR, "%js", prev_errmsg); hio_seterrbfmt (hio, HIO_ENOTCON, "%js", prev_errmsg);
} }
return -1; return -1;
} }
@ -491,6 +491,12 @@ static int dev_evcb_mar_ready (hio_dev_t* dev, int events)
if (err == CR_SERVER_LOST || err == CR_SERVER_GONE_ERROR) if (err == CR_SERVER_LOST || err == CR_SERVER_GONE_ERROR)
{ {
/*
preserving the error information here isn't very useful because
the info won't survive until on_disconnect() is called...
hio_seterrbfmt (hio, HIO_ENOTCON, "%hs", mysql_error(rdev->hnd));
*/
rdev->broken = 1; rdev->broken = 1;
rdev->broken_syshnd = syshnd; rdev->broken_syshnd = syshnd;
watch_mysql (rdev, 0); watch_mysql (rdev, 0);