#include <gnu/java/net/PlainSocketImpl$SocketInputStream.h>
#include <gnu/java/net/PlainSocketImpl$SocketOutputStream.h>
#include <java/io/IOException.h>
-#include <java/io/InterruptedIOException.h>
#include <java/net/BindException.h>
#include <java/net/ConnectException.h>
#include <java/net/InetAddress.h>
// use true, false instead of TRUE, FALSE because the
// 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)
throwConnectException ();
-
else if (dwRet == WSA_WAIT_TIMEOUT)
throw new ::java::net::SocketTimeoutException
(JvNewStringUTF ("connect timed out"));
// use true, false instead of TRUE, FALSE because the
// MS constants got undefined
+ // Reset and ignore our thread's interrupted flag.
+ ::java::lang::Thread::interrupted();
+
if (dwRet == WSA_WAIT_FAILED)
goto error;
else if (dwRet == WSA_WAIT_TIMEOUT)
throw new ::java::net::SocketTimeoutException
- (JvNewStringUTF ("accept timed out"));
+ (JvNewStringUTF ("Accept timed out"));
}
}
else
if (r == -1)
{
DWORD dwErr = WSAGetLastError();
- if (::java::lang::Thread::interrupted())
- {
- ::java::io::InterruptedIOException *iioe
- = new ::java::io::InterruptedIOException
- (_Jv_WinStrError (dwErr));
- iioe->bytesTransferred = 0;
- throw iioe;
- }
+
+ // 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();
+
// Some errors should not cause exceptions.
if (dwErr != WSAENOTCONN && dwErr != WSAECONNRESET
&& dwErr != WSAENOTSOCK)
if (r == -1)
{
DWORD dwErr = WSAGetLastError();
- if (::java::lang::Thread::interrupted())
- {
- ::java::io::InterruptedIOException *iioe
- = new ::java::io::InterruptedIOException
- (_Jv_WinStrError (dwErr));
- iioe->bytesTransferred = written;
- throw iioe;
- }
+
+ // Reset and ignore our thread's interrupted flag.
+ ::java::lang::Thread::interrupted();
+
// Some errors should not cause exceptions.
if (dwErr != WSAENOTCONN && dwErr != WSAECONNRESET
&& dwErr != WSAENOTSOCK)
dwErrorCode = WSAGetLastError ();
// save WSAGetLastError() before calling Thread.interrupted()
- if (::java::lang::Thread::interrupted())
- {
- ::java::io::InterruptedIOException *iioe =
- new ::java::io::InterruptedIOException
- (JvNewStringUTF("read interrupted"));
- iioe->bytesTransferred = r == -1 ? 0 : r;
- throw iioe;
- }
- else if (r == -1)
+ // Reset and ignore our thread's interrupted flag.
+ ::java::lang::Thread::interrupted();
+
+ if (r == -1)
{
error:
// Some errors cause us to return end of stream...
// Other errors need to be signalled.
if (dwErrorCode == WSAETIMEDOUT)
throw new ::java::net::SocketTimeoutException
- (JvNewStringUTF ("read timed out") );
+ (JvNewStringUTF ("Read timed out") );
else
_Jv_ThrowIOException (dwErrorCode);
}