Methods Summary |
---|
public long | getElapsedTime()
if ( send_time == 0 || reply_time == 0 ){
return( -1 );
}
long res = reply_time - send_time;
if ( res < 0 ){
res = 0;
}
// do something sensible with 0 time!
if ( res == 0 ){
res = SystemTime.TIME_GRANULARITY_MILLIS / 2;
}
return( res );
|
protected com.aelitis.net.udp.uc.PRUDPPacket | getReply()
sem.reserve();
if ( exception != null ){
throw( exception );
}
return( reply );
|
protected long | getSendTime()
return( send_time );
|
protected long | getTimeout()
return( timeout );
|
protected void | sent()
send_time = SystemTime.getCurrentTime();
|
protected void | setException(com.aelitis.net.udp.uc.PRUDPPacketHandlerException e)
// don't override existing reply for synchronous callers as they can
// do what they want with it
if ( reply == null ){
reply_time = SystemTime.getCurrentTime();
exception = e;
}
sem.release();
// still report errors to asyn clients (even when a reply has been received)
// as they need something to indicate that a continuation packet wasn't received
// and that the request has timed-out. ie. a multi-packet reply must terminate
// either with the reception of a non-continuation (i.e. last) packet *or* a
// timeout/error
if ( receiver != null ){
receiver.error( e );
}
|
protected void | setReply(com.aelitis.net.udp.uc.PRUDPPacket packet, java.net.InetSocketAddress originator, long receive_time)
if ( reply == null ){
reply_time = receive_time;
reply = packet;
}else{
packet.setPreviousPacket( reply );
reply = packet;
}
if( !packet.hasContinuation()){
sem.release();
}
if ( receiver != null ){
receiver.packetReceived( this, packet, originator );
}
|