[前][次][番号順一覧][スレッド一覧]

ruby-changes:9622

From: matz <ko1@a...>
Date: Mon, 29 Dec 2008 16:33:26 +0900 (JST)
Subject: [ruby-changes:9622] Ruby:r21162 (trunk): * ext/socket/socket.c (s_recvfrom_nonblock): default maxlen to be

matz	2008-12-29 16:32:56 +0900 (Mon, 29 Dec 2008)

  New Revision: 21162

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=21162

  Log:
    * 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].

  Modified files:
    trunk/ChangeLog
    trunk/ext/socket/socket.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 21161)
+++ ChangeLog	(revision 21162)
@@ -26,6 +26,12 @@
 
 	* io.c (rb_scan_open_args): ditto.
 
+Mon Dec 29 10:12:12 2008  Yukihiro Matsumoto  <matz@r...>
+
+	* 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@r...>
 
 	* cont.c: small RDoc fix mentioned from <radek.bulat at gmail.com>
Index: ext/socket/socket.c
===================================================================
--- ext/socket/socket.c	(revision 21161)
+++ ext/socket/socket.c	(revision 21162)
@@ -690,11 +690,12 @@
     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 @@
 
 /*
  * 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 @@
 
 /*
  * 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.

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]