if (length == 2 || length == 4) return;
byte[] b = new byte[length];
System.arraycopy(p.getData(), 0, b, 0, length);
Buffer buffer = new ByteArrayBuffer(b);
EventHandler handler = new EventHandler();
SipParser parser = new SipParser(buffer, handler);
try
{
parser.parse();
SipMessage message = handler.getMessage();
message.setConnection(new UdpConnection(p.getAddress(), p.getPort()));
/*
message.set5uple(getTransportOrdinal(), getAddr(), getPort(), p.getAddress(), p.getPort());
if (message.isRequest())
((SipRequest) message).setEndpoint(this);
*/
process(message);
}
catch (Throwable t)
{
if (_statsStartedAt != -1)
{
synchronized (_statsLock)
{
_nbParseErrors++;
}
}
Log.warn(t);
//if (handler.hasException())
//Log.warn(handler.getException());
if (Log.isDebugEnabled())
Log.debug("Buffer content: \r\n" + HexString.toDetailedHexString(buffer.array(), p.getLength()));
}
}