mirror of
https://github.com/lunarmodules/luasocket.git
synced 2024-12-26 04:28:20 +01:00
Merge pull request #108 from daurnimator/master
src/usocket: Do not setblocking on destroy, shutdown, and listen.
This commit is contained in:
commit
6dcecd8f45
@ -92,7 +92,6 @@ int socket_close(void) {
|
|||||||
\*-------------------------------------------------------------------------*/
|
\*-------------------------------------------------------------------------*/
|
||||||
void socket_destroy(p_socket ps) {
|
void socket_destroy(p_socket ps) {
|
||||||
if (*ps != SOCKET_INVALID) {
|
if (*ps != SOCKET_INVALID) {
|
||||||
socket_setblocking(ps);
|
|
||||||
close(*ps);
|
close(*ps);
|
||||||
*ps = SOCKET_INVALID;
|
*ps = SOCKET_INVALID;
|
||||||
}
|
}
|
||||||
@ -140,9 +139,7 @@ int socket_bind(p_socket ps, SA *addr, socklen_t len) {
|
|||||||
\*-------------------------------------------------------------------------*/
|
\*-------------------------------------------------------------------------*/
|
||||||
int socket_listen(p_socket ps, int backlog) {
|
int socket_listen(p_socket ps, int backlog) {
|
||||||
int err = IO_DONE;
|
int err = IO_DONE;
|
||||||
socket_setblocking(ps);
|
|
||||||
if (listen(*ps, backlog)) err = errno;
|
if (listen(*ps, backlog)) err = errno;
|
||||||
socket_setnonblocking(ps);
|
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -150,9 +147,7 @@ int socket_listen(p_socket ps, int backlog) {
|
|||||||
*
|
*
|
||||||
\*-------------------------------------------------------------------------*/
|
\*-------------------------------------------------------------------------*/
|
||||||
void socket_shutdown(p_socket ps, int how) {
|
void socket_shutdown(p_socket ps, int how) {
|
||||||
socket_setblocking(ps);
|
|
||||||
shutdown(*ps, how);
|
shutdown(*ps, how);
|
||||||
socket_setnonblocking(ps);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*-------------------------------------------------------------------------*\
|
/*-------------------------------------------------------------------------*\
|
||||||
|
Loading…
Reference in New Issue
Block a user