WIP bugfix

This commit is contained in:
GustavoHMDS committed 2026-09-28 12:42:49 -03:00
1 parent b5bbd1df2d
commit 57059c3ef0
7 files changed
+6 -6

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);
} }