Files
AsminVoicechat/source/decompiled/de/maxhenkel/voicechat/plugins/impl/VoicechatSocketBase.java
T
asminme bbccd4a815
Build AsminVoicechat / prepare-release (push) Successful in 14s
Build AsminVoicechat / build-and-test (17) (push) Canceled after 0s
Build AsminVoicechat / build-and-test (18) (push) Canceled after 0s
Build AsminVoicechat / build-and-test (19) (push) Canceled after 0s
Build AsminVoicechat / build-and-test (20) (push) Canceled after 0s
Build AsminVoicechat / build-and-test (21) (push) Canceled after 0s
Build AsminVoicechat / build-and-test (22) (push) Canceled after 0s
Build AsminVoicechat / build-and-test (23) (push) Canceled after 0s
Build AsminVoicechat / build-and-test (24) (push) Canceled after 0s
Build AsminVoicechat / build-and-test (25) (push) Canceled after 0s
Build AsminVoicechat / build-and-test (26) (push) Canceled after 0s
Build AsminVoicechat / build-and-test (27-ea) (push) Canceled after 0s
Build AsminVoicechat / build-and-test (16) (push) Canceled after 38s
first commit
2026-10-24 15:18:03 +02:00

30 lines
1.2 KiB
Java

/*
* Decompiled with CFR 0.152.
*/
package de.maxhenkel.voicechat.plugins.impl;
import de.maxhenkel.voicechat.Voicechat;
import de.maxhenkel.voicechat.debug.CooldownTimer;
import de.maxhenkel.voicechat.plugins.impl.RawUdpPacketImpl;
import java.io.IOException;
import java.net.DatagramPacket;
import java.net.DatagramSocket;
public class VoicechatSocketBase {
private final byte[] BUFFER = new byte[4096];
public RawUdpPacketImpl read(DatagramSocket socket) throws IOException {
DatagramPacket packet = new DatagramPacket(this.BUFFER, this.BUFFER.length);
socket.receive(packet);
if (packet.getLength() >= this.BUFFER.length) {
CooldownTimer.run("udp_packet_too_large", () -> Voicechat.LOGGER.warn("Packet from {} is too large", packet.getSocketAddress()));
throw new IOException(String.format("Packet from %s is too large", packet.getSocketAddress()));
}
long timestamp = System.currentTimeMillis();
byte[] data = new byte[packet.getLength()];
System.arraycopy(packet.getData(), packet.getOffset(), data, 0, packet.getLength());
return new RawUdpPacketImpl(data, packet.getSocketAddress(), timestamp);
}
}