@Override public WriteResult tcpWritePacket(PseudoTCPBase tcp,byte[] buffer,int len){
  if (randomInt() < loss_) {
    if (logger.isLoggable(Level.FINE)) {
      logger.log(Level.FINE,"Randomly dropping packet, size=" + len);
    }
  }
 else {
    if (len > Math.min(local_mtu_,remote_mtu_)) {
      if (logger.isLoggable(Level.FINE)) {
        logger.log(Level.FINE,"Dropping packet that exceeds path MTU, size=" + len);
      }
    }
 else {
      if (tcp == localTcp) {
        timer.schedule(getWriteRemotePacketTask(buffer,len),delay_);
      }
 else {
        timer.schedule(getWriteLocalPacketTask(buffer,len),delay_);
      }
    }
  }
  return WriteResult.WR_SUCCESS;
}

@ Override public WriteResult tcpWritePacket ( PseudoTCPBase tcp , byte [ ] buffer , int len ) { if ( randomInt ( ) < loss_ ) { if ( logger . isLoggable ( Level . FINE ) ) { logger . log ( Level . FINE , "Randomly dropping packet, size=" + len ) ; } } else { if ( len > Math . min ( local_mtu_ , remote_mtu_ ) ) { if ( logger . isLoggable ( Level . FINE ) ) { logger . log ( Level . FINE , "Dropping packet that exceeds path MTU, size=" + len ) ; } } else { if ( tcp == localTcp ) { timer . schedule ( getWriteRemotePacketTask ( buffer , len ) , delay_ ) ; } else { timer . schedule ( getWriteLocalPacketTask ( buffer , len ) , delay_ ) ; } } } return WriteResult . WR_SUCCESS ; }
handles passing packets between local and remote peers . here are taken decisions about packets loss and delay .
