summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-12-29 07:32:56 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-12-29 07:32:56 +0000
commit6dd1910a3d7b5e2057c5671f971709b4c38c1e5b (patch)
tree4cd26088751ec49ff5ebfab28390e2bbb8d9f995
parent7be399c567c0e2ba746b63c8bbabc13e6dcb14af (diff)
* ext/socket/socket.c (s_recvfrom_nonblock): default maxlen to be
65536. suggested by akr in [ruby-core:20918]. response to feature request #936 in [ruby-core:20917]. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21162 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog6
-rw-r--r--ext/socket/socket.c9
2 files changed, 13 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 0e71660b69..d37523def4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -26,6 +26,12 @@ Mon Dec 29 10:58:54 2008 NARUSE, Yui <naruse@ruby-lang.org>
* io.c (rb_scan_open_args): ditto.
+Mon Dec 29 10:12:12 2008 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * ext/socket/socket.c (s_recvfrom_nonblock): default maxlen to be
+ 65536. suggested by akr in [ruby-core:20918]. response to
+ feature request #936 in [ruby-core:20917].
+
Mon Dec 29 07:15:16 2008 Yukihiro Matsumoto <matz@ruby-lang.org>
* cont.c: small RDoc fix mentioned from <radek.bulat at gmail.com>
diff --git a/ext/socket/socket.c b/ext/socket/socket.c
index a8b53bd534..8c8bc7ddc3 100644
--- a/ext/socket/socket.c
+++ b/ext/socket/socket.c
@@ -690,11 +690,12 @@ s_recvfrom_nonblock(VALUE sock, int argc, VALUE *argv, enum sock_recv_type from)
int fd, flags;
VALUE addr = Qnil;
- rb_scan_args(argc, argv, "11", &len, &flg);
+ rb_scan_args(argc, argv, "2", &len, &flg);
+ if (len == Qnil) buflen = 65536;
+ else buflen = NUM2INT(len);
if (flg == Qnil) flags = 0;
else flags = NUM2INT(flg);
- buflen = NUM2INT(len);
#ifdef MSG_DONTWAIT
/* MSG_DONTWAIT avoids the race condition between fcntl and recvfrom.
@@ -748,11 +749,13 @@ bsock_recv(int argc, VALUE *argv, VALUE sock)
/*
* call-seq:
+ * basicsocket.recv_nonblock() => mesg
* basicsocket.recv_nonblock(maxlen) => mesg
* basicsocket.recv_nonblock(maxlen, flags) => mesg
*
* Receives up to _maxlen_ bytes from +socket+ using recvfrom(2) after
* O_NONBLOCK is set for the underlying file descriptor.
+ * If _maxlen_ is ommitted, its default value is 65536.
* _flags_ is zero or more of the +MSG_+ options.
* The result, _mesg_, is the data received.
*
@@ -1878,11 +1881,13 @@ udp_send(int argc, VALUE *argv, VALUE sock)
/*
* call-seq:
+ * udpsocket.recvfrom_nonblock() => [mesg, sender_inet_addr]
* udpsocket.recvfrom_nonblock(maxlen) => [mesg, sender_inet_addr]
* udpsocket.recvfrom_nonblock(maxlen, flags) => [mesg, sender_inet_addr]
*
* Receives up to _maxlen_ bytes from +udpsocket+ using recvfrom(2) after
* O_NONBLOCK is set for the underlying file descriptor.
+ * If _maxlen_ is ommitted, its default value is 65536.
* _flags_ is zero or more of the +MSG_+ options.
* The first element of the results, _mesg_, is the data received.
* The second element, _sender_inet_addr_, is an array to represent the sender address.