Skip to content

Commit

Permalink
Let JAVA native gateway have more smoother socket response rate
Browse files Browse the repository at this point in the history
  • Loading branch information
flyskywhy committed Nov 5, 2021
1 parent b7633b1 commit 466bf93
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ The usb serial port part include `.aar` library from [felHR85/UsbSerial](https:/
The socket part copy and modify code from [[email protected]](https://github.com/Rapsssito/react-native-tcp-socket/tree/v5.2.1)

## Changelog
### [2.3.0] - 2021-11-05
Remove executorService usage in writeSocketBytes, thus JAVA native gateway can have more smoother socket response rate.

### [2.2.0] - 2021-09-01
High performance JAVA native gateway passthrough between socket and serialport without JS bridge

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -807,17 +807,12 @@ public void run() {
}

public void writeSocketBytes(@NonNull final Integer cId, @NonNull final byte[] bytes) {
executorService.execute(new Thread(new Runnable() {
@Override
public void run() {
TcpSocketClient socketClient = getTcpClient(cId);
try {
socketClient.write(bytes);
} catch (IOException e) {
onError(cId, e.toString());
}
}
}));
TcpSocketClient socketClient = getTcpClient(cId);
try {
socketClient.write(bytes);
} catch (IOException e) {
onError(cId, e.toString());
}
}

@SuppressLint("StaticFieldLeak")
Expand Down

0 comments on commit 466bf93

Please sign in to comment.