This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Patch] [MinGW] [4.0] FYI: Fix Socket read returns EOF when count == 0...


Hi People,

>David> 2005-03-14  David Daney  <ddaney@avtrex.com>
>David> 	* gnu/java/net/natPlainSocketImplPosix.cc (read_helper): Handle
>David> 	count == 0 case.
>
>David> O.K to commit to HEAD?
>David> How about the 4.0 branch for good measure?
>

Tom> Yes to both.  Thanks.

Tom> FWIW I think the Win32 code needs this as well.

The following patch didn't seem to harm anything on the
4.0 branch, so I assumed that Tom's and Bryce's approval
of David's POSIX version constituted approval for the Win32
version of this as well and checked it in.

(The only reason I put my name first is so people wouldn't
bug David concerning this.)

-- Mohan
http://www.thisiscool.com/
http://www.animalsong.org/

2005-03-22  Mohan Embar  <gnustuff@thisiscool.com>
	    David Daney  <ddaney@avtrex.com>

	* gnu/java/net/natPlainSocketImplWin32.cc (read): Handle
	count == 0 case.

===================================================================
RCS file: /cvs/gcc/gcc/libjava/gnu/java/net/natPlainSocketImplWin32.cc,v
retrieving revision 1.9
diff -u -2 -r1.9 natPlainSocketImplWin32.cc
--- gnu/java/net/natPlainSocketImplWin32.cc	16 Dec 2003 22:57:06 -0000	1.9
+++ gnu/java/net/natPlainSocketImplWin32.cc	22 Mar 2005 19:25:06 -0000
@@ -492,4 +492,9 @@
   jint offset, jint count)
 {
+  // If zero bytes were requested, short circuit so that recv
+  // doesn't signal EOF.
+  if (count == 0)
+    return 0;
+
   if (! buffer)
     throw new ::java::lang::NullPointerException;





Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]