Commit Graph

45 Commits

Author SHA1 Message Date
Joel Dice
6153a5c83b Merge remote-tracking branch 'git/master' 2011-11-04 08:11:14 -06:00
JET
39bee886e3 ByteBuffer and InputStream now better match the standard. 2011-10-20 13:45:47 -06:00
Joel Dice
84bcbbcaa3 implement asReadOnlyBuffer and getShort(int) in ByteBuffer 2011-09-29 18:25:03 -06:00
Joel Dice
0c253c40a2 add ServerSocketChannel.handleReadyOps to fix build 2011-01-13 07:03:28 -07:00
Joel Dice
39018c20e0 check connection readyness in SocketChannel.finishConnect if necessary 2011-01-11 18:39:48 -07:00
Joel Dice
eb3a9f010b fix false positive return from SocketChannel.finishConnect
This fixes a bug in finishConnect such that it would return true even
if the socket had not yet connected successfully.
2011-01-11 18:29:48 -07:00
Joel Dice
4f0dccb53c add Channels.newChannel methods 2011-01-11 18:26:37 -07:00
Joel Dice
a5742f5985 update copyright years 2010-12-05 20:21:09 -07:00
Joel Dice
b3accf1b30 ServerSocketChannel throws IOException, not Exception 2010-10-13 13:38:31 -06:00
Joel Dice
b3da635b63 add java.nio.channels.Channels implementation 2010-07-13 18:03:25 -06:00
Joel Dice
47d9039b69 switch from gethostbyname to getaddrinfo on POSIX systems
gethostbyname may return any combination of IPv4 and IPv6 addresses,
and it's not safe to assume the first address is IPv4, which is all
our code is currently prepared to handle.  In contrast, getaddrinfo
allows us to specify whether we want IPv4, IPv6, or both.

We should eventually make this switch on Windows as well, but the
status of getaddrinfo in Windows 2000 is not clear, and MinGW's
ws2tcpip.h only declares it for XP and above.

This commit also adds InetAddress.getByName for explicit DNS lookups.
2010-06-14 16:09:56 -06:00
Joel Dice
b908f575d5 fix several blocking SocketChannel bugs
In java-nio.cpp, we can't use GetPrimitiveArrayCritical when reading
from or writing to blocking sockets since it may block the rest of the
VM indefinitely.

In SelectableChannel.java, we can't use a null test on
SelectableChannel.key to determine whether the channel is open since
it might never be registered with a Selector.  According to the Sun
documentation, a SelectableChannel is open as soon as it's created, so
that's what we now implement.
2010-06-04 15:37:22 -06:00
Joel Dice
6118792ffd update copyright years 2009-12-02 19:08:29 -07:00
Joel Dice
3862128a3a tolerate EINTR in ServerSocketChannel.accept implementation
On POSIX systems, Avian sends a special signal to a thread to
implement Thread.getStackTrace() when called from a different thread.
If the target thread is blocked on a call to accept when this happens,
it will return -1, with errno set to EINTR.  Instead of treating this
as an error, we now just loop and call accept again.
2009-11-16 17:23:09 -07:00
Joel Dice
ef00ff80ef avoid EAGAIN or EWOULDBLOCK errors due to SocketSelector.wakup being called many times between calls to select 2009-10-30 08:55:55 -06:00
Joel Dice
efdfb796d9 implement SocketChannel.isConnected 2009-10-29 16:19:33 -06:00
Joel Dice
59ba4aecf2 implement non-blocking socket connections 2009-10-08 16:26:20 -06:00
Joel Dice
fb40b046fd fix regression in SocketSelector when selecting ServerSocketChannels 2009-09-28 16:54:49 -06:00
Joel Dice
80d4385cb8 implement blocking mode for SocketChannel and ServerSocketChannel 2009-08-03 08:58:56 -06:00
Joel Dice
29858a5299 implement Selector.selectNow() and select() 2009-07-23 13:08:41 -06:00
Joel Dice
d1018bf078 update copyright years 2009-03-15 12:02:36 -06:00
Joel Dice
8659c709b7 avoid passing null arguments to native methods in SocketChannel 2009-03-02 15:22:17 -07:00
Joel Dice
fccf906349 add minimal java.net.Socket implementation to support Socket.setTcpNoDelay 2008-11-22 15:32:53 -07:00
Joel Dice
86dfaf9ff0 implement ByteBuffer.getInt(int) 2008-08-12 11:09:17 -06:00
Joel Dice
91494d9081 add constructor to ByteBuffer 2008-03-28 18:08:08 -06:00
Joel Dice
6cddd10e0a various code cleanups, bug fixes, and compatibility fixes in NIO code 2008-03-25 16:17:29 -06:00
Joel Dice
3a208edbbc update NIO code to be more compatible with Java 2008-03-25 11:18:17 -06:00
Joel Dice
2edaa82801 prepend copyright notice and license to all source files; add license.txt and readme.txt 2008-02-19 11:06:52 -07:00
Joel Dice
a6a1f8ba98 make ByteBuffer implement Comparable 2007-11-15 11:53:01 -07:00
Joel Dice
d1048f9bcb implement ByteBuffer.get(byte[]) 2007-11-09 14:32:33 -07:00
Eric Scharff
1d04186a0c Fixed bug in ByteBuffer.getLong() 2007-10-31 09:27:26 -06:00
Eric Scharff
958d39aa03 Add debug information for ByteBuffer 2007-10-30 14:55:00 -06:00
Joel Dice
4b92017ea9 fix several win32 bugs in SocketSelector 2007-10-26 18:04:55 -06:00
Eric Scharff
79ad3bdb76 Exception thrown by ByteBuffer 2007-10-11 17:04:45 -06:00
Eric Scharff
32946417b7 Fixed subtle bug in getLong() 2007-10-11 16:42:33 -06:00
Eric Scharff
00cfa587bc Various bug fixes and optimizations 2007-10-11 15:41:23 -06:00
Eric Scharff
e831a41e90 Implemented ByteBuffer.clear() 2007-10-11 09:59:52 -06:00
Eric Scharff
9368dd2acc Fix another off-by-one error when EOS is hit on the socket 2007-10-07 11:35:48 -06:00
Eric Scharff
35a96a0d36 Fix an off-by-one error when EOS is hit on the socket 2007-10-07 09:53:07 -06:00
Eric Scharff
19b6e11cbc Make sure to report EOF when reading from a socket channel 2007-10-05 15:51:06 -06:00
Eric Scharff
98269286e5 Implemented a basic NIO socket channel interface. Non-blocking socket channels
and server socket channels are implemented.  This version works but only when
libnative is linked with g++ (because of C++ object creation code that fails
without this linking)
2007-10-05 15:32:56 -06:00
Eric Scharff
da6dd8fba3 Fix ByteBuffer bugs 2007-09-28 13:18:28 -06:00
Eric Scharff
bcd5f5b94b Fixed bulk put offset for sliced arrays 2007-09-28 12:19:13 -06:00
Eric Scharff
cc8dd6d8c0 Implemented ByteBuffer.flip() 2007-09-28 12:18:01 -06:00
Eric Scharff
b4afc538d4 (Hopefully correct) implementation of ByteBuffer 2007-09-28 12:16:25 -06:00