Skip to content

Commit

Permalink
0.3.3 still (refactory)
Browse files Browse the repository at this point in the history
1. nio flow change
2. version
  • Loading branch information
gazer2kanlin committed Jan 14, 2019
1 parent a9bdd87 commit 736c976
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
5 changes: 4 additions & 1 deletion uia.comm/src/main/java/uia/comm/SocketServer.java
Original file line number Diff line number Diff line change
Expand Up @@ -650,18 +650,21 @@ private void running() {

}

// 1. find out channels ready to work
Iterator<SelectionKey> iter = this.serverSelector.selectedKeys().iterator();
while (iter.hasNext()) {
SelectionKey key = iter.next();
iter.remove();

try {
// 1. ready to accept a new connection
if (key.isAcceptable()) {
ServerSocketChannel client = (ServerSocketChannel) key.channel();
SocketChannel ch = client.accept();
clientConnected(ch);
}
else if (key.isReadable()) {
// 2. ready to read data
if (key.isReadable()) {
SocketDataController controller = (SocketDataController) key.attachment();
if (!controller.receive()) {
logger.debug(String.format("%s> %s> try to disconnect(running)",
Expand Down
7 changes: 7 additions & 0 deletions uia.comm/src/main/java/uia/comm/Version.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package uia.comm;

public interface Version {

public static final String NO = "20190114A";

}

0 comments on commit 736c976

Please sign in to comment.