mirror of
https://github.com/sirjonasxx/G-Earth.git
synced 2024-11-27 02:40:51 +01:00
small async packetsending change
This commit is contained in:
parent
684a30be3e
commit
86c694f8f8
@ -25,15 +25,13 @@ public class HConnection {
|
|||||||
public HConnection() {
|
public HConnection() {
|
||||||
new Thread(() -> {
|
new Thread(() -> {
|
||||||
while (true) {
|
while (true) {
|
||||||
if (inHandler != null) {
|
|
||||||
HPacket packet;
|
HPacket packet;
|
||||||
while ((packet = sendToClientAsyncQueue.poll()) != null) {
|
while ((packet = sendToClientAsyncQueue.poll()) != null) {
|
||||||
sendToClient(packet);
|
sendToClient(packet);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
try {
|
try {
|
||||||
Thread.sleep(1);
|
Thread.sleep(1);
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) { //java........................................
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -41,12 +39,10 @@ public class HConnection {
|
|||||||
|
|
||||||
new Thread(() -> {
|
new Thread(() -> {
|
||||||
while (true) {
|
while (true) {
|
||||||
if (outHandler != null) {
|
|
||||||
HPacket packet;
|
HPacket packet;
|
||||||
while ((packet = sendToServerAsyncQueue.poll()) != null) {
|
while ((packet = sendToServerAsyncQueue.poll()) != null) {
|
||||||
sendToServer(packet);
|
sendToServer(packet);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
try {
|
try {
|
||||||
Thread.sleep(1);
|
Thread.sleep(1);
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
|
Loading…
Reference in New Issue
Block a user