summaryrefslogtreecommitdiff
path: root/java/net/Socket.java
diff options
context:
space:
mode:
authorJeroen Frijters <jeroen@sumatra.nl>2007-03-19 08:51:16 +0000
committerJeroen Frijters <jeroen@sumatra.nl>2007-03-19 08:51:16 +0000
commit180f03432d00c217ae6beb9a802e057ca1175b1f (patch)
tree4f06f3639788965dfab3825f7bafb3d260618c4a /java/net/Socket.java
parent3bc306345d7dfb19364e55b297b7d9f8954855ea (diff)
downloadclasspath-180f03432d00c217ae6beb9a802e057ca1175b1f.tar.gz
2007-03-19 Jeroen Frijters <jeroen@frijters.net>
* java/net/Socket.java (implCreated): New field. (getImpl): Call impl.create() if it hasn't been called yet. (bind): Removed explicit impl.create() call.
Diffstat (limited to 'java/net/Socket.java')
-rw-r--r--java/net/Socket.java18
1 files changed, 17 insertions, 1 deletions
diff --git a/java/net/Socket.java b/java/net/Socket.java
index 2160a64ce..85e330e47 100644
--- a/java/net/Socket.java
+++ b/java/net/Socket.java
@@ -83,6 +83,11 @@ public class Socket
SocketImpl impl;
/**
+ * True if impl.create() has been called.
+ */
+ private boolean implCreated;
+
+ /**
* True if the socket is bound.
* Package private so it can be set from ServerSocket when accept is called.
*/
@@ -326,6 +331,18 @@ public class Socket
private SocketImpl getImpl() throws SocketException
{
+ if (! implCreated)
+ {
+ try
+ {
+ impl.create(true);
+ }
+ catch (IOException x)
+ {
+ throw (SocketException) new SocketException().initCause(x);
+ }
+ implCreated = true;
+ }
return impl;
}
@@ -359,7 +376,6 @@ public class Socket
// bind to address/port
try
{
- getImpl().create(true);
getImpl().bind(tmp.getAddress(), tmp.getPort());
bound = true;
}