Lines 36-41
Link Here
|
36 |
import java.net.ServerSocket; |
36 |
import java.net.ServerSocket; |
37 |
import java.net.Socket; |
37 |
import java.net.Socket; |
38 |
import java.net.SocketException; |
38 |
import java.net.SocketException; |
|
|
39 |
import java.net.SocketTimeoutException; |
39 |
|
40 |
|
40 |
import javax.management.ListenerNotFoundException; |
41 |
import javax.management.ListenerNotFoundException; |
41 |
import javax.management.MBeanNotificationInfo; |
42 |
import javax.management.MBeanNotificationInfo; |
Lines 882-887
Link Here
|
882 |
|
883 |
|
883 |
synchronized void process(SelectionKey sk) { |
884 |
synchronized void process(SelectionKey sk) { |
884 |
if(!sk.isValid()) { |
885 |
if(!sk.isValid()) { |
|
|
886 |
SocketInputStream sis = (SocketInputStream)ep.getNote(isNote); |
887 |
sis.closeIt(); |
885 |
return; |
888 |
return; |
886 |
} |
889 |
} |
887 |
if(sk.isReadable()) { |
890 |
if(sk.isReadable()) { |
Lines 959-973
Link Here
|
959 |
Iterator it = sels.iterator(); |
962 |
Iterator it = sels.iterator(); |
960 |
while(it.hasNext()) { |
963 |
while(it.hasNext()) { |
961 |
SelectionKey sk = (SelectionKey)it.next(); |
964 |
SelectionKey sk = (SelectionKey)it.next(); |
962 |
if(sk.isValid()) { |
965 |
if(sk.isAcceptable()) { |
963 |
if(sk.isAcceptable()) { |
966 |
acceptConnections(); |
964 |
acceptConnections(); |
|
|
965 |
} else { |
966 |
SocketConnection sc = (SocketConnection)sk.attachment(); |
967 |
sc.process(sk); |
968 |
} |
969 |
} else { |
967 |
} else { |
970 |
sk.cancel(); |
968 |
SocketConnection sc = (SocketConnection)sk.attachment(); |
|
|
969 |
sc.process(sk); |
971 |
} |
970 |
} |
972 |
it.remove(); |
971 |
it.remove(); |
973 |
} |
972 |
} |
Lines 1081-1088
Link Here
|
1081 |
nr = -1; // Can't handle this yet |
1080 |
nr = -1; // Can't handle this yet |
1082 |
} |
1081 |
} |
1083 |
if(nr < 0) { |
1082 |
if(nr < 0) { |
1084 |
isClosed = true; |
1083 |
closeIt(); |
1085 |
notify(); |
|
|
1086 |
return false; |
1084 |
return false; |
1087 |
} else if(nr == 0) { |
1085 |
} else if(nr == 0) { |
1088 |
if(!nioIsBroken) { |
1086 |
if(!nioIsBroken) { |
Lines 1093-1098
Link Here
|
1093 |
return true; |
1091 |
return true; |
1094 |
} |
1092 |
} |
1095 |
|
1093 |
|
|
|
1094 |
synchronized void closeIt() { |
1095 |
isClosed = true; |
1096 |
if(blocking) |
1097 |
notify(); |
1098 |
} |
1099 |
|
1096 |
public int read(byte [] data) throws IOException { |
1100 |
public int read(byte [] data) throws IOException { |
1097 |
return read(data, 0, data.length); |
1101 |
return read(data, 0, data.length); |
1098 |
} |
1102 |
} |
Lines 1132-1138
Link Here
|
1132 |
if(fill(len) < 0) { |
1136 |
if(fill(len) < 0) { |
1133 |
isClosed = true; |
1137 |
isClosed = true; |
1134 |
} |
1138 |
} |
1135 |
} |
1139 |
} else if(!isClosed) { |
|
|
1140 |
throw new SocketTimeoutException("Read request timed out"); |
1141 |
} |
1136 |
} |
1142 |
} |
1137 |
} |
1143 |
} |
1138 |
|
1144 |
|