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