feature/separacao-gerenciadores #1

Merged
gustavo merged 31 commits from feature/separacao-gerenciadores into main 2026-09-30 18:34:54 -03:00
7 changed files with 6 additions and 6 deletions
Showing only changes of commit 57059c3ef0 - Show all commits

No files matched your search

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+1 -1
View File
@@ -146,7 +146,7 @@ public class MainWindow extends javax.swing.JFrame {
return this.socketUDP; return this.socketUDP;
} }
public SocketTCP getSocketTCP() { public SocketTCP getSocketTCP() {
return this.socketTCP; return this.socketTCP;
} }
+4 -4
View File
@@ -75,17 +75,17 @@ public class SocketTCP extends Thread {
* do envio. Falhas durante o estabelecimento ou envio são registradas na * do envio. Falhas durante o estabelecimento ou envio são registradas na
* saída padrão e não são propagadas ao chamador.</p> * saída padrão e não são propagadas ao chamador.</p>
* *
* @param msg mensagem serializada em bytes que será enviada. * @param msg mensagem que será enviada.
* @param destinationAddress endereço IP do peer que receberá a mensagem. * @param destinationAddress endereço IP do peer que receberá a mensagem.
*/ */
public void send(byte[] msg, InetAddress destinationAddress) { public void send(Message msg, InetAddress destinationAddress) {
try { try {
TcpConnection connection = getPublicConnection(destinationAddress, main.getIdentifier(), main.getIdentifier()); TcpConnection connection = getPublicConnection(destinationAddress, main.getIdentifier(), main.getIdentifier());
if (connection == null) { if (connection == null) {
System.out.println("Could not establish TCP connection."); System.out.println("Could not establish TCP connection.");
return; return;
} }
connection.send(msg); connection.send(msg.toByteArray());
} catch (Exception ex) { } catch (Exception ex) {
System.out.println("Could not send TCP message."); System.out.println("Could not send TCP message.");
System.out.println(ex.toString()); System.out.println(ex.toString());
@@ -391,7 +391,7 @@ public class SocketTCP extends Thread {
SysInfoMessage sysMessage = SysInfoMessage.parseSystemInfo(message); SysInfoMessage sysMessage = SysInfoMessage.parseSystemInfo(message);
if (sysMessage == null) { if (sysMessage == null) {
privatePlugin.receiveBytes(message); privatePlugin.receiveBytes(connection, message);
continue; continue;
} }
@@ -4,6 +4,6 @@ import pitiupi.net.tcp.TcpConnection;
public interface PrivateConnectionPlugin extends Plugin { public interface PrivateConnectionPlugin extends Plugin {
public void receivePrivateConnection(TcpConnection connection); public void receivePrivateConnection(TcpConnection connection);
public void receiveBytes(byte[] bytes); public void receiveBytes(TcpConnection connection, byte[] bytes);
public void onSocketClosed(TcpConnection connection); public void onSocketClosed(TcpConnection connection);
} }