no need to check if the FD is >= 0 now that we centralized the close/free logic. Once closed, none of that code will run again
This commit is contained in:
parent
c8020f29ac
commit
e823b9ec0d
|
@ -113,23 +113,19 @@ static VALUE nogvl_close(void *ptr) {
|
||||||
* we'll send a QUIT message to the server, but that message is more of a
|
* we'll send a QUIT message to the server, but that message is more of a
|
||||||
* formality than a hard requirement since the socket is getting shutdown
|
* formality than a hard requirement since the socket is getting shutdown
|
||||||
* anyways, so ensure the socket write does not block our interpreter
|
* anyways, so ensure the socket write does not block our interpreter
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* if the socket is dead we have no chance of blocking,
|
||||||
|
* so ignore any potential fcntl errors since they don't matter
|
||||||
*/
|
*/
|
||||||
int fd = wrapper->client->net.fd;
|
#ifndef _WIN32
|
||||||
|
int flags = fcntl(wrapper->client->net.fd, F_GETFL);
|
||||||
if (fd >= 0) {
|
if (flags > 0 && !(flags & O_NONBLOCK))
|
||||||
/*
|
fcntl(wrapper->client->net.fd, F_SETFL, flags | O_NONBLOCK);
|
||||||
* if the socket is dead we have no chance of blocking,
|
#else
|
||||||
* so ignore any potential fcntl errors since they don't matter
|
u_long iMode = 1;
|
||||||
*/
|
ioctlsocket(wrapper->client->net.fd, FIONBIO, &iMode);
|
||||||
#ifndef _WIN32
|
#endif
|
||||||
int flags = fcntl(fd, F_GETFL);
|
|
||||||
if (flags > 0 && !(flags & O_NONBLOCK))
|
|
||||||
fcntl(fd, F_SETFL, flags | O_NONBLOCK);
|
|
||||||
#else
|
|
||||||
u_long iMode = 1;
|
|
||||||
ioctlsocket(fd, FIONBIO, &iMode);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
mysql_close(wrapper->client);
|
mysql_close(wrapper->client);
|
||||||
wrapper->client->net.fd = -1;
|
wrapper->client->net.fd = -1;
|
||||||
|
|
Loading…
Reference in New Issue