Commit 81d2d258 by Michael Koch Committed by Michael Koch

2003-06-14 Michael Koch <konqueror@gmx.de>

	* gnu/java/nio/FileChannelImpl.java
        (map_address): Removed incorrect comment.
	* gnu/java/nio/SelectorImpl.java
        (register): Remove code duplication and code for file channel handling.
	* gnu/java/nio/ServerSocketChannelImpl.java
        (serverSocket): Renamed from sock_object.
        (ServerSocketChannel): Initialize serverSocket.
        (socket): Return serverSocket.
	* gnu/java/nio/SocketChannelImpl.java
        (socket): Renamed from sock_object.
        (isConnectionPenging): Simplified.
        (socket): Return socket.

From-SVN: r67940
parent 34e8290f
2003-06-14 Michael Koch <konqueror@gmx.de> 2003-06-14 Michael Koch <konqueror@gmx.de>
* gnu/java/nio/FileChannelImpl.java
(map_address): Removed incorrect comment.
* gnu/java/nio/SelectorImpl.java
(register): Remove code duplication and code for file channel handling.
* gnu/java/nio/ServerSocketChannelImpl.java
(serverSocket): Renamed from sock_object.
(ServerSocketChannel): Initialize serverSocket.
(socket): Return serverSocket.
* gnu/java/nio/SocketChannelImpl.java
(socket): Renamed from sock_object.
(isConnectionPenging): Simplified.
(socket): Return socket.
2003-06-14 Michael Koch <konqueror@gmx.de>
* java/security/BasicPermission.java: * java/security/BasicPermission.java:
New version from classpath. New version from classpath.
......
...@@ -35,6 +35,7 @@ this exception to your version of the library, but you are not ...@@ -35,6 +35,7 @@ this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */ exception statement from your version. */
package gnu.java.nio; package gnu.java.nio;
import java.io.EOFException; import java.io.EOFException;
...@@ -64,8 +65,6 @@ import gnu.gcj.RawData; ...@@ -64,8 +65,6 @@ import gnu.gcj.RawData;
public class FileChannelImpl extends FileChannel public class FileChannelImpl extends FileChannel
{ {
// GCJ LOCAL: This variable stores a pointer to the memory
// where the file is mapped.
RawData map_address; RawData map_address;
int length; int length;
......
...@@ -250,50 +250,31 @@ public class SelectorImpl extends AbstractSelector ...@@ -250,50 +250,31 @@ public class SelectorImpl extends AbstractSelector
protected SelectionKey register (AbstractSelectableChannel ch, int ops, protected SelectionKey register (AbstractSelectableChannel ch, int ops,
Object att) Object att)
{ {
// // filechannel is not selectable ? SelectionKeyImpl result;
// if (ch instanceof FileChannelImpl)
// {
// FileChannelImpl fc = (FileChannelImpl) ch;
// SelectionKeyImpl impl = new SelectionKeyImpl (ch, this, fc.fd);
// keys.add (impl);
// impl.interestOps (ops);
// impl.attach (att);
// return impl;
// }
// else
if (ch instanceof SocketChannelImpl) if (ch instanceof SocketChannelImpl)
{ {
SocketChannelImpl sc = (SocketChannelImpl) ch; SocketChannelImpl sc = (SocketChannelImpl) ch;
SelectionKeyImpl impl = new SelectionKeyImpl (ch, this, sc.fd); result = new SelectionKeyImpl (ch, this, sc.fd);
add (impl);
impl.interestOps (ops);
impl.attach (att);
return impl;
} }
else if (ch instanceof DatagramChannelImpl) else if (ch instanceof DatagramChannelImpl)
{ {
DatagramChannelImpl dc = (DatagramChannelImpl) ch; DatagramChannelImpl dc = (DatagramChannelImpl) ch;
SelectionKeyImpl impl = new SelectionKeyImpl (ch, this, dc.fd); result = new SelectionKeyImpl (ch, this, dc.fd);
add (impl);
impl.interestOps (ops);
impl.attach (att);
return impl;
} }
else if (ch instanceof ServerSocketChannelImpl) else if (ch instanceof ServerSocketChannelImpl)
{ {
ServerSocketChannelImpl ssc = (ServerSocketChannelImpl) ch; ServerSocketChannelImpl ssc = (ServerSocketChannelImpl) ch;
SelectionKeyImpl impl = new SelectionKeyImpl (ch, this, ssc.fd); result = new SelectionKeyImpl (ch, this, ssc.fd);
add (impl);
impl.interestOps (ops);
impl.attach (att);
return impl;
} }
else else
{ {
System.err.println ("INTERNAL ERROR, no known channel type"); throw new InternalError ("No known channel type");
} }
return null; add (result);
result.interestOps (ops);
result.attach (att);
return result;
} }
} }
...@@ -47,7 +47,7 @@ import java.nio.channels.spi.SelectorProvider; ...@@ -47,7 +47,7 @@ import java.nio.channels.spi.SelectorProvider;
class ServerSocketChannelImpl extends ServerSocketChannel class ServerSocketChannelImpl extends ServerSocketChannel
{ {
ServerSocket sock_object; ServerSocket serverSocket;
int fd; int fd;
// int local_port; // int local_port;
boolean blocking = true; boolean blocking = true;
...@@ -62,7 +62,7 @@ class ServerSocketChannelImpl extends ServerSocketChannel ...@@ -62,7 +62,7 @@ class ServerSocketChannelImpl extends ServerSocketChannel
try try
{ {
sock_object = new ServerSocket (); serverSocket = new ServerSocket ();
} }
catch (IOException e) catch (IOException e)
{ {
...@@ -106,6 +106,6 @@ class ServerSocketChannelImpl extends ServerSocketChannel ...@@ -106,6 +106,6 @@ class ServerSocketChannelImpl extends ServerSocketChannel
public ServerSocket socket () public ServerSocket socket ()
{ {
return sock_object; return serverSocket;
} }
} }
...@@ -35,6 +35,7 @@ this exception to your version of the library, but you are not ...@@ -35,6 +35,7 @@ this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */ exception statement from your version. */
package gnu.java.nio; package gnu.java.nio;
import java.io.IOException; import java.io.IOException;
...@@ -50,7 +51,7 @@ import gnu.classpath.Configuration; ...@@ -50,7 +51,7 @@ import gnu.classpath.Configuration;
public class SocketChannelImpl extends SocketChannel public class SocketChannelImpl extends SocketChannel
{ {
Socket sock_object; Socket socket;
int fd; int fd;
int local_port; int local_port;
boolean blocking = true; boolean blocking = true;
...@@ -141,20 +142,17 @@ public class SocketChannelImpl extends SocketChannel ...@@ -141,20 +142,17 @@ public class SocketChannelImpl extends SocketChannel
public boolean isConnectionPending () public boolean isConnectionPending ()
{ {
if (blocking) return blocking ? true : false;
return true;
return false;
} }
public Socket socket () public Socket socket ()
{ {
if (sock_object != null) if (socket != null)
{ {
//sock_object.ch = this; //socket.ch = this;
} }
return sock_object; return socket;
} }
public int read (ByteBuffer dst) throws IOException public int read (ByteBuffer dst) throws IOException
......
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