summaryrefslogtreecommitdiffstats
path: root/libjava/classpath/gnu/javax/print/ipp/IppRequest.java
diff options
context:
space:
mode:
Diffstat (limited to 'libjava/classpath/gnu/javax/print/ipp/IppRequest.java')
-rw-r--r--libjava/classpath/gnu/javax/print/ipp/IppRequest.java16
1 files changed, 13 insertions, 3 deletions
diff --git a/libjava/classpath/gnu/javax/print/ipp/IppRequest.java b/libjava/classpath/gnu/javax/print/ipp/IppRequest.java
index 8abab519282..05a6faae72e 100644
--- a/libjava/classpath/gnu/javax/print/ipp/IppRequest.java
+++ b/libjava/classpath/gnu/javax/print/ipp/IppRequest.java
@@ -119,6 +119,11 @@ public class IppRequest
{
/**
+ * The printer-poll timeout.
+ */
+ private static final int timeout = 1000;
+
+ /**
* Helper class used to write the attributes of a request
* into the supplied data output stream in the correct way.
*
@@ -789,7 +794,7 @@ public class IppRequest
alreadySent = true;
- OutputStream stream = stream = connection.getOutputStream();
+ OutputStream stream = connection.getOutputStream();
DataOutputStream out = new DataOutputStream(stream);
// the header 8 bytes long
@@ -838,8 +843,13 @@ public class IppRequest
out.flush();
stream.flush();
-
- int responseCode = responseCode = connection.getResponseCode();
+
+ // Set the connection timeout, for if the printer is offline.
+ // FIXME: The print services polling should probably be done in its
+ // own thread.
+ connection.setConnectTimeout( timeout );
+
+ int responseCode = connection.getResponseCode();
if (responseCode == HttpURLConnection.HTTP_OK)
{
OpenPOWER on IntegriCloud