removed MIO_SCK_SCK_MAKE_IMPSYSHND

This commit is contained in:
hyung-hwan 2020-07-29 17:58:15 +00:00
parent f7c441b981
commit b1ede90231
2 changed files with 4 additions and 31 deletions

View File

@ -286,11 +286,8 @@ typedef enum mio_dev_sck_type_t mio_dev_sck_type_t;
enum mio_dev_sck_make_option_t
{
/* import the system handle specified in the hnd field */
MIO_DEV_SCK_MAKE_IMPSYSHND = (1 << 0),
/* for now, accept failure doesn't affect the listing socket if this is set */
MIO_DEV_SCK_MAKE_LENIENT = (1 << 1)
MIO_DEV_SCK_MAKE_LENIENT = (1 << 0)
};
typedef enum mio_dev_sck_make_option_t mio_dev_sck_make_option_t;

View File

@ -80,11 +80,6 @@
/* ========================================================================= */
static MIO_INLINE void close_async_socket (mio_t* mio, mio_syshnd_t sck)
{
close (sck);
}
static mio_syshnd_t open_async_socket (mio_t* mio, int domain, int type, int proto)
{
mio_syshnd_t sck = MIO_SYSHND_INVALID;
@ -360,26 +355,7 @@ static int dev_sck_make (mio_dev_t* dev, void* ctx)
goto oops;
}
if (arg->options & MIO_DEV_SCK_MAKE_IMPSYSHND)
{
/* Make sure to pass a proper type for a given socket handle when you use MIO_DEV_SCK_MAKE_IMPSYSHND.
* Otherwise, some innerworking of the library may go wrong */
if (sck_type_map[arg->type].domain == __AF_QX)
{
/* can't import a handle of this type */
mio_seterrnum (mio, MIO_EINVAL);
goto oops;
}
hnd = arg->syshnd;
if (hnd == MIO_SYSHND_INVALID)
{
mio_seterrnum (mio, MIO_EINVAL);
goto oops;
}
if (mio_makesyshndasync(mio, hnd) <= -1) goto oops;
}
else if (sck_type_map[arg->type].domain == __AF_QX)
if (sck_type_map[arg->type].domain == __AF_QX)
{
hnd = open_async_qx(mio, &side_chan);
if (hnd == MIO_SYSHND_INVALID) goto oops;
@ -405,7 +381,7 @@ static int dev_sck_make (mio_dev_t* dev, void* ctx)
return 0;
oops:
if (hnd != MIO_SYSHND_INVALID) close_async_socket (mio, hnd);
if (hnd != MIO_SYSHND_INVALID) close (hnd);
if (side_chan != MIO_SYSHND_INVALID) close (side_chan);
return -1;
}
@ -491,7 +467,7 @@ static int dev_sck_kill (mio_dev_t* dev, int force)
if (rdev->hnd != MIO_SYSHND_INVALID)
{
close_async_socket (mio, rdev->hnd);
close (rdev->hnd);
rdev->hnd = MIO_SYSHND_INVALID;
}