Search in sources :

Example 1 with MalformedCommunicationPacket

use of i2p.bote.packet.MalformedCommunicationPacket in project i2p.i2p-bote by i2p.

the class I2PPacketDispatcher method dispatchPacket.

/**
 * Creates a packet from a byte array and fires listeners.
 * @param packetData
 * @param sender
 */
private void dispatchPacket(byte[] packetData, Destination sender) {
    CommunicationPacket packet;
    try {
        packet = CommunicationPacket.createPacket(packetData);
        logPacket(packet, sender);
        firePacketReceivedEvent(packet, sender);
    } catch (MalformedPacketException e) {
        log.warn("Ignoring unparseable packet.", e);
        firePacketReceivedEvent(new MalformedCommunicationPacket(), sender);
    }
}
Also used : CommunicationPacket(i2p.bote.packet.CommunicationPacket) MalformedCommunicationPacket(i2p.bote.packet.MalformedCommunicationPacket) MalformedPacketException(i2p.bote.packet.MalformedPacketException) MalformedCommunicationPacket(i2p.bote.packet.MalformedCommunicationPacket)

Aggregations

CommunicationPacket (i2p.bote.packet.CommunicationPacket)1 MalformedCommunicationPacket (i2p.bote.packet.MalformedCommunicationPacket)1 MalformedPacketException (i2p.bote.packet.MalformedPacketException)1