mirror of
https://github.com/ruby/ruby.git
synced 2025-08-15 13:39:04 +02:00
Check for availability of MSG_DONTWAIT
.
This commit is contained in:
parent
2eacd94951
commit
3244bb931b
1 changed files with 5 additions and 0 deletions
|
@ -745,7 +745,12 @@ bsock_readable_p(VALUE self)
|
||||||
RB_IO_POINTER(self, fptr);
|
RB_IO_POINTER(self, fptr);
|
||||||
|
|
||||||
char buffer[1];
|
char buffer[1];
|
||||||
|
#ifdef MSG_DONTWAIT
|
||||||
int result = recv(fptr->fd, buffer, 1, MSG_PEEK | MSG_DONTWAIT);
|
int result = recv(fptr->fd, buffer, 1, MSG_PEEK | MSG_DONTWAIT);
|
||||||
|
#else
|
||||||
|
rb_io_set_nonblock(fptr);
|
||||||
|
int result = recv(fptr->fd, buffer, 1, MSG_PEEK);
|
||||||
|
#endif
|
||||||
|
|
||||||
if (result > 0) {
|
if (result > 0) {
|
||||||
return Qtrue;
|
return Qtrue;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue