added qse_shutsckhnd()
This commit is contained in:
parent
e8cef98c87
commit
2e6765e4ba
@ -55,6 +55,14 @@
|
||||
typedef int qse_sck_len_t;
|
||||
#endif
|
||||
|
||||
enum qse_shutsckhnd_how_t
|
||||
{
|
||||
QSE_SHUTSCKHND_R = 0,
|
||||
QSE_SHUTSCKHND_W = 1,
|
||||
QSE_SHUTSCKHND_RW = 2
|
||||
};
|
||||
typedef enum qse_shutsckhnd_how_t qse_shutsckhnd_how_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
@ -67,6 +75,12 @@ QSE_EXPORT void qse_closesckhnd (
|
||||
qse_sck_hnd_t handle
|
||||
);
|
||||
|
||||
|
||||
QSE_EXPORT void qse_shutsckhnd (
|
||||
qse_sck_hnd_t handle,
|
||||
qse_shutsckhnd_how_t how
|
||||
);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@ -51,6 +51,10 @@
|
||||
#endif
|
||||
|
||||
|
||||
#if !defined(SHUT_RDWR)
|
||||
# define SHUT_RDWR 2
|
||||
#endif
|
||||
|
||||
QSE_INLINE int qse_isvalidsckhnd (qse_sck_hnd_t handle)
|
||||
{
|
||||
#if defined(_WIN32)
|
||||
@ -80,6 +84,22 @@ QSE_INLINE void qse_closesckhnd (qse_sck_hnd_t handle)
|
||||
#endif
|
||||
}
|
||||
|
||||
QSE_INLINE void qse_shutsckhnd (qse_sck_hnd_t handle, qse_shutsckhnd_how_t how)
|
||||
{
|
||||
static int how_v[] = { SHUT_RD, SHUT_WR, SHUT_RDWR };
|
||||
|
||||
#if defined(_WIN32)
|
||||
shutdown (handle, how_v[how]);
|
||||
#elif defined(__OS2__)
|
||||
shutdown (handle, how_v[how]);
|
||||
#elif defined(__DOS__)
|
||||
/* TODO: */
|
||||
#else
|
||||
shutdown (handle, how_v[how]);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
#if 0
|
||||
qse_sck_hnd_t
|
||||
|
||||
|
@ -461,7 +461,7 @@ on failure xfer != ret.
|
||||
|
||||
#else
|
||||
|
||||
qse_mchar_t buf[MAX_SEND_SIZE];
|
||||
qse_mchar_t buf[MAX_SEND_SIZE]; /* TODO: move this into client, server, or httpd */
|
||||
qse_ssize_t ret;
|
||||
qse_foff_t foff;
|
||||
|
||||
@ -1829,36 +1829,16 @@ static int dir_read (qse_httpd_t* httpd, qse_ubi_t handle, qse_httpd_dirent_t* d
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------- */
|
||||
#if !defined(SHUT_RDWR)
|
||||
# define SHUT_RDWR 2
|
||||
#endif
|
||||
|
||||
static void client_close (qse_httpd_t* httpd, qse_httpd_client_t* client)
|
||||
{
|
||||
|
||||
#if defined(_WIN32)
|
||||
shutdown (client->handle.i, SHUT_RDWR);
|
||||
#elif defined(__OS2__)
|
||||
shutdown (client->handle.i, SHUT_RDWR);
|
||||
#elif defined(__DOS__)
|
||||
/* TODO: */
|
||||
#else
|
||||
shutdown (client->handle.i, SHUT_RDWR);
|
||||
#endif
|
||||
qse_shutsckhnd (client->handle.i, QSE_SHUTSCKHND_RW);
|
||||
qse_closesckhnd (client->handle.i);
|
||||
}
|
||||
|
||||
static void client_shutdown (qse_httpd_t* httpd, qse_httpd_client_t* client)
|
||||
{
|
||||
#if defined(_WIN32)
|
||||
shutdown (client->handle.i, SHUT_RDWR);
|
||||
#elif defined(__OS2__)
|
||||
shutdown (client->handle.i, SHUT_RDWR);
|
||||
#elif defined(__DOS__)
|
||||
/* TODO: */
|
||||
#else
|
||||
shutdown (client->handle.i, SHUT_RDWR);
|
||||
#endif
|
||||
qse_shutsckhnd (client->handle.i, QSE_SHUTSCKHND_RW);
|
||||
}
|
||||
|
||||
static qse_ssize_t client_recv (
|
||||
@ -1954,7 +1934,6 @@ static qse_ssize_t client_sendfile (
|
||||
|
||||
static int client_accepted (qse_httpd_t* httpd, qse_httpd_client_t* client)
|
||||
{
|
||||
|
||||
if (client->status & QSE_HTTPD_CLIENT_SECURE)
|
||||
{
|
||||
#if defined(HAVE_SSL)
|
||||
|
Loading…
x
Reference in New Issue
Block a user