WIP: Fazendo testes
This commit is contained in:
1 parent
581a924afc
commit
e5eb4f3f9c
3 files changed
+9
-2
No files matched your search
@@ -1 +0,0 @@
|
|||||||
plugin.MultiProtocolChat
|
|
||||||
@@ -262,6 +262,7 @@ public class SocketTCP extends Thread {
|
|||||||
* @param connection conexão cujo fluxo de entrada será processado.
|
* @param connection conexão cujo fluxo de entrada será processado.
|
||||||
*/
|
*/
|
||||||
private void startReceiver(TcpConnection connection) {
|
private void startReceiver(TcpConnection connection) {
|
||||||
|
System.out.println("Starting TCP connection receiver.");
|
||||||
|
|
||||||
if (!connection.isPrivate()) {
|
if (!connection.isPrivate()) {
|
||||||
publicConnectionReceiver(connection);
|
publicConnectionReceiver(connection);
|
||||||
@@ -273,8 +274,10 @@ public class SocketTCP extends Thread {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pluginManager.handleConnection(connection, connection.getReceiver()))
|
if (pluginManager.handleConnection(connection, connection.getReceiver())) {
|
||||||
|
System.out.println("Private connection receiver established.");
|
||||||
privateConnectionReceiver(connection);
|
privateConnectionReceiver(connection);
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
InfoMessage.sendSystemInfo(
|
InfoMessage.sendSystemInfo(
|
||||||
connection,
|
connection,
|
||||||
@@ -348,6 +351,7 @@ public class SocketTCP extends Thread {
|
|||||||
while (running) {
|
while (running) {
|
||||||
try {
|
try {
|
||||||
byte[] message = connection.receive();
|
byte[] message = connection.receive();
|
||||||
|
System.out.println("Um plugin recebeu uma mensagem");
|
||||||
InfoMessage sysMessage = InfoMessage.parseSystemInfo(message);
|
InfoMessage sysMessage = InfoMessage.parseSystemInfo(message);
|
||||||
|
|
||||||
if (sysMessage == null) {
|
if (sysMessage == null) {
|
||||||
|
|||||||
@@ -60,6 +60,8 @@ public class TcpConnection {
|
|||||||
output.write(message);
|
output.write(message);
|
||||||
output.flush();
|
output.flush();
|
||||||
updateLastActivity();
|
updateLastActivity();
|
||||||
|
|
||||||
|
System.out.println("TcpConnection enviou uma mensagem de tamanho: " + message.length);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -75,6 +77,8 @@ public class TcpConnection {
|
|||||||
byte[] receive() throws IOException {
|
byte[] receive() throws IOException {
|
||||||
int length = input.readInt();
|
int length = input.readInt();
|
||||||
|
|
||||||
|
System.out.println("TcpConnection recebeu uma mensagem de tamanho: " + length);
|
||||||
|
|
||||||
if (length < 0) throw new IOException("Invalid message length.");
|
if (length < 0) throw new IOException("Invalid message length.");
|
||||||
|
|
||||||
byte[] message = input.readNBytes(length);
|
byte[] message = input.readNBytes(length);
|
||||||
|
|||||||
Reference in new issue
Block a user