Prefer constants for shutdown
over magic numbers
This commit is contained in:
parent
bc85c8d852
commit
37712c1ed6
@ -124,7 +124,7 @@ bsock_close_read(VALUE sock)
|
||||
rb_io_t *fptr;
|
||||
|
||||
GetOpenFile(sock, fptr);
|
||||
shutdown(fptr->fd, 0);
|
||||
shutdown(fptr->fd, SHUT_RD);
|
||||
if (!(fptr->mode & FMODE_WRITABLE)) {
|
||||
return rb_io_close(sock);
|
||||
}
|
||||
@ -157,7 +157,7 @@ bsock_close_write(VALUE sock)
|
||||
if (!(fptr->mode & FMODE_READABLE)) {
|
||||
return rb_io_close(sock);
|
||||
}
|
||||
shutdown(fptr->fd, 1);
|
||||
shutdown(fptr->fd, SHUT_WR);
|
||||
fptr->mode &= ~FMODE_WRITABLE;
|
||||
|
||||
return Qnil;
|
||||
|
@ -48,7 +48,7 @@ socks_s_close(VALUE sock)
|
||||
rb_io_t *fptr;
|
||||
|
||||
GetOpenFile(sock, fptr);
|
||||
shutdown(fptr->fd, 2);
|
||||
shutdown(fptr->fd, SHUT_RDWR);
|
||||
return rb_io_close(sock);
|
||||
}
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user