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
|
||||||
*/
|
*
|
||||||
int fd = wrapper->client->net.fd;
|
*
|
||||||
|
|
||||||
if (fd >= 0) {
|
|
||||||
/*
|
|
||||||
* if the socket is dead we have no chance of blocking,
|
* if the socket is dead we have no chance of blocking,
|
||||||
* so ignore any potential fcntl errors since they don't matter
|
* so ignore any potential fcntl errors since they don't matter
|
||||||
*/
|
*/
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
int flags = fcntl(fd, F_GETFL);
|
int flags = fcntl(wrapper->client->net.fd, F_GETFL);
|
||||||
if (flags > 0 && !(flags & O_NONBLOCK))
|
if (flags > 0 && !(flags & O_NONBLOCK))
|
||||||
fcntl(fd, F_SETFL, flags | O_NONBLOCK);
|
fcntl(wrapper->client->net.fd, F_SETFL, flags | O_NONBLOCK);
|
||||||
#else
|
#else
|
||||||
u_long iMode = 1;
|
u_long iMode = 1;
|
||||||
ioctlsocket(fd, FIONBIO, &iMode);
|
ioctlsocket(wrapper->client->net.fd, FIONBIO, &iMode);
|
||||||
#endif
|
#endif
|
||||||
}
|
|
||||||
|
|
||||||
mysql_close(wrapper->client);
|
mysql_close(wrapper->client);
|
||||||
wrapper->client->net.fd = -1;
|
wrapper->client->net.fd = -1;
|
||||||
|
Loading…
Reference in New Issue
Block a user