Fixed: Исправлено сообщение с ошибкой о входе
- Обновлен Nukkit-Mot
This commit is contained in:
Binary file not shown.
@@ -6,15 +6,13 @@ import com.zhekasmirnov.apparatus.multiplayer.channel.data.SocketDataChannel;
|
|||||||
import com.zhekasmirnov.horizon.runtime.logger.Logger;
|
import com.zhekasmirnov.horizon.runtime.logger.Logger;
|
||||||
import com.zhekasmirnov.innercore.api.log.ICLog;
|
import com.zhekasmirnov.innercore.api.log.ICLog;
|
||||||
|
|
||||||
import java.io.DataInputStream;
|
|
||||||
import java.io.DataOutputStream;
|
import java.io.DataOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.Socket;
|
import java.net.Socket;
|
||||||
import java.util.concurrent.BlockingQueue;
|
import java.util.concurrent.LinkedBlockingDeque;
|
||||||
import java.util.concurrent.LinkedBlockingQueue;
|
|
||||||
|
|
||||||
public class PlayerSocketSendingThread extends Thread {
|
public class PlayerSocketSendingThread extends Thread {
|
||||||
private BlockingQueue<DataPacket> list = new LinkedBlockingQueue<>();
|
private LinkedBlockingDeque<DataPacket> list = new LinkedBlockingDeque<>();
|
||||||
|
|
||||||
private final DataOutputStream outputStream;
|
private final DataOutputStream outputStream;
|
||||||
private final SocketDataChannel channel;
|
private final SocketDataChannel channel;
|
||||||
@@ -27,14 +25,16 @@ public class PlayerSocketSendingThread extends Thread {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void send(DataPacket packet){
|
public void send(DataPacket packet){
|
||||||
list.add(packet);
|
list.addFirst(packet);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static boolean isClose = false;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
while (true){
|
while (true){
|
||||||
try{
|
try{
|
||||||
if(channel.isClosed()) break;
|
if(isClose) break;
|
||||||
|
|
||||||
if(list.size() > InnerCoreServer.getMaxPacketSending()){
|
if(list.size() > InnerCoreServer.getMaxPacketSending()){
|
||||||
channel.close();
|
channel.close();
|
||||||
@@ -56,6 +56,9 @@ public class PlayerSocketSendingThread extends Thread {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void close(){
|
public void close(){
|
||||||
|
long start = System.currentTimeMillis();
|
||||||
|
while (list.size() <= 15 && !list.isEmpty() && System.currentTimeMillis() - start <= 1000L){}
|
||||||
|
isClose = true;
|
||||||
try {
|
try {
|
||||||
outputStream.close();
|
outputStream.close();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
|
|||||||
Reference in New Issue
Block a user