Commit 89c57110 by Mohan Embar Committed by Mohan Embar

natPlainDatagramSocketImplWin32.cc: Removed unused InterruptedIOException.h include.

	* gnu/java/net/natPlainDatagramSocketImplWin32.cc:
	Removed unused InterruptedIOException.h include.
	* gnu/java/net/natPlainSocketImplWin32.cc
	(connect): Reset and ignore our thread's interrupted
	flag instead of testing and throwing an InterruptedIOException
	if set.
	(accept): Likewise + changed case of SocketTimeoutException
	text.
	(write): Likewise (for both overloads).
	(doRead): Likewise.

From-SVN: r74716
parent 5cd4d463
2003-12-16 Mohan Embar <gnustuff@thisiscool.com> 2003-12-16 Mohan Embar <gnustuff@thisiscool.com>
* gnu/java/net/natPlainDatagramSocketImplWin32.cc:
Removed unused InterruptedIOException.h include.
* gnu/java/net/natPlainSocketImplWin32.cc
(connect): Reset and ignore our thread's interrupted
flag instead of testing and throwing an InterruptedIOException
if set.
(accept): Likewise + changed case of SocketTimeoutException
text.
(write): Likewise (for both overloads).
(doRead): Likewise.
2003-12-16 Mohan Embar <gnustuff@thisiscool.com>
* win32.cc (WSAEventWrapper): Implemented default * win32.cc (WSAEventWrapper): Implemented default
constructor and init() methods. constructor and init() methods.
(_Jv_select): Removed. (_Jv_select): Removed.
......
...@@ -17,7 +17,6 @@ details. */ ...@@ -17,7 +17,6 @@ details. */
#include <gnu/java/net/PlainDatagramSocketImpl.h> #include <gnu/java/net/PlainDatagramSocketImpl.h>
#include <java/io/IOException.h> #include <java/io/IOException.h>
#include <java/io/InterruptedIOException.h>
#include <java/net/BindException.h> #include <java/net/BindException.h>
#include <java/net/SocketException.h> #include <java/net/SocketException.h>
#include <java/net/InetAddress.h> #include <java/net/InetAddress.h>
......
...@@ -17,7 +17,6 @@ details. */ ...@@ -17,7 +17,6 @@ details. */
#include <gnu/java/net/PlainSocketImpl$SocketInputStream.h> #include <gnu/java/net/PlainSocketImpl$SocketInputStream.h>
#include <gnu/java/net/PlainSocketImpl$SocketOutputStream.h> #include <gnu/java/net/PlainSocketImpl$SocketOutputStream.h>
#include <java/io/IOException.h> #include <java/io/IOException.h>
#include <java/io/InterruptedIOException.h>
#include <java/net/BindException.h> #include <java/net/BindException.h>
#include <java/net/ConnectException.h> #include <java/net/ConnectException.h>
#include <java/net/InetAddress.h> #include <java/net/InetAddress.h>
...@@ -176,9 +175,13 @@ gnu::java::net::PlainSocketImpl::connect (::java::net::SocketAddress *addr, ...@@ -176,9 +175,13 @@ gnu::java::net::PlainSocketImpl::connect (::java::net::SocketAddress *addr,
// use true, false instead of TRUE, FALSE because the // use true, false instead of TRUE, FALSE because the
// MS constants got undefined // MS constants got undefined
// Reset and ignore our thread's interrupted flag.
// It's not possible to interrupt these sort of
// operations on Win32 anyway.
::java::lang::Thread::interrupted();
if (dwRet == WSA_WAIT_FAILED) if (dwRet == WSA_WAIT_FAILED)
throwConnectException (); throwConnectException ();
else if (dwRet == WSA_WAIT_TIMEOUT) else if (dwRet == WSA_WAIT_TIMEOUT)
throw new ::java::net::SocketTimeoutException throw new ::java::net::SocketTimeoutException
(JvNewStringUTF ("connect timed out")); (JvNewStringUTF ("connect timed out"));
...@@ -275,11 +278,14 @@ gnu::java::net::PlainSocketImpl::accept (gnu::java::net::PlainSocketImpl *s) ...@@ -275,11 +278,14 @@ gnu::java::net::PlainSocketImpl::accept (gnu::java::net::PlainSocketImpl *s)
// use true, false instead of TRUE, FALSE because the // use true, false instead of TRUE, FALSE because the
// MS constants got undefined // MS constants got undefined
// Reset and ignore our thread's interrupted flag.
::java::lang::Thread::interrupted();
if (dwRet == WSA_WAIT_FAILED) if (dwRet == WSA_WAIT_FAILED)
goto error; goto error;
else if (dwRet == WSA_WAIT_TIMEOUT) else if (dwRet == WSA_WAIT_TIMEOUT)
throw new ::java::net::SocketTimeoutException throw new ::java::net::SocketTimeoutException
(JvNewStringUTF ("accept timed out")); (JvNewStringUTF ("Accept timed out"));
} }
} }
else else
...@@ -361,14 +367,12 @@ gnu::java::net::PlainSocketImpl$SocketOutputStream::write(jint b) ...@@ -361,14 +367,12 @@ gnu::java::net::PlainSocketImpl$SocketOutputStream::write(jint b)
if (r == -1) if (r == -1)
{ {
DWORD dwErr = WSAGetLastError(); DWORD dwErr = WSAGetLastError();
if (::java::lang::Thread::interrupted())
{ // Reset and ignore our thread's interrupted flag.
::java::io::InterruptedIOException *iioe // It's not possible to interrupt these sort of
= new ::java::io::InterruptedIOException // operations on Win32 anyway.
(_Jv_WinStrError (dwErr)); ::java::lang::Thread::interrupted();
iioe->bytesTransferred = 0;
throw iioe;
}
// Some errors should not cause exceptions. // Some errors should not cause exceptions.
if (dwErr != WSAENOTCONN && dwErr != WSAECONNRESET if (dwErr != WSAENOTCONN && dwErr != WSAECONNRESET
&& dwErr != WSAENOTSOCK) && dwErr != WSAENOTSOCK)
...@@ -397,14 +401,10 @@ gnu::java::net::PlainSocketImpl$SocketOutputStream::write(jbyteArray b, ...@@ -397,14 +401,10 @@ gnu::java::net::PlainSocketImpl$SocketOutputStream::write(jbyteArray b,
if (r == -1) if (r == -1)
{ {
DWORD dwErr = WSAGetLastError(); DWORD dwErr = WSAGetLastError();
if (::java::lang::Thread::interrupted())
{ // Reset and ignore our thread's interrupted flag.
::java::io::InterruptedIOException *iioe ::java::lang::Thread::interrupted();
= new ::java::io::InterruptedIOException
(_Jv_WinStrError (dwErr));
iioe->bytesTransferred = written;
throw iioe;
}
// Some errors should not cause exceptions. // Some errors should not cause exceptions.
if (dwErr != WSAENOTCONN && dwErr != WSAECONNRESET if (dwErr != WSAENOTCONN && dwErr != WSAECONNRESET
&& dwErr != WSAENOTSOCK) && dwErr != WSAENOTSOCK)
...@@ -456,15 +456,10 @@ doRead(int native_fd, void* buf, int count, int timeout) ...@@ -456,15 +456,10 @@ doRead(int native_fd, void* buf, int count, int timeout)
dwErrorCode = WSAGetLastError (); dwErrorCode = WSAGetLastError ();
// save WSAGetLastError() before calling Thread.interrupted() // save WSAGetLastError() before calling Thread.interrupted()
if (::java::lang::Thread::interrupted()) // Reset and ignore our thread's interrupted flag.
{ ::java::lang::Thread::interrupted();
::java::io::InterruptedIOException *iioe =
new ::java::io::InterruptedIOException if (r == -1)
(JvNewStringUTF("read interrupted"));
iioe->bytesTransferred = r == -1 ? 0 : r;
throw iioe;
}
else if (r == -1)
{ {
error: error:
// Some errors cause us to return end of stream... // Some errors cause us to return end of stream...
...@@ -474,7 +469,7 @@ error: ...@@ -474,7 +469,7 @@ error:
// Other errors need to be signalled. // Other errors need to be signalled.
if (dwErrorCode == WSAETIMEDOUT) if (dwErrorCode == WSAETIMEDOUT)
throw new ::java::net::SocketTimeoutException throw new ::java::net::SocketTimeoutException
(JvNewStringUTF ("read timed out") ); (JvNewStringUTF ("Read timed out") );
else else
_Jv_ThrowIOException (dwErrorCode); _Jv_ThrowIOException (dwErrorCode);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment