Package ch.ethz.inf.vs.californium.network.Exchange

Examples of ch.ethz.inf.vs.californium.network.Exchange.KeyMID


     * - CON  => ACK/RST/ACK+response/CON+response/NCON+response
     * - NCON => RST/CON+response/NCON+response
     * If this request goes lost, we do not get anything back.
     */
   
    KeyMID idByMID = new KeyMID(request.getMID(),
        request.getDestination().getAddress(), request.getDestinationPort());
    KeyToken idByTok = new KeyToken(request.getToken(),
        request.getDestination().getAddress(), request.getDestinationPort());
   
    exchange.setObserver(exchangeObserver);
View Full Code Here


      throw new NullPointerException("Response has no destination address set");
    if (response.getDestinationPort() == 0)
      throw new NullPointerException("Response hsa no destination port set");
   
    // Insert CON and NON to match ACKs and RSTs to the exchange
    KeyMID idByMID = new KeyMID(response.getMID(),
        response.getDestination().getAddress(), response.getDestinationPort());
    exchangesByMID.put(idByMID, exchange);
   
    if (response.getOptions().hasBlock2()) {
      Request request = exchange.getRequest();
View Full Code Here

     *     if ACK+response got lost => resend ACK+response
     *     if nothing has been sent yet => do nothing
     * (Retransmission is supposed to be done by the retransm. layer)
     */
   
    KeyMID idByMID = new KeyMID(request.getMID(), request.getSource().getAddress(), request.getSourcePort());
   
    /*
     * The differentiation between the case where there is a Block1 or
     * Block2 option and the case where there is none has the advantage that
     * all exchanges that do not need blockwise transfer have simpler and
View Full Code Here

     * - The first CON/NCON/ACK+response => deliver
     * - Retransmitted CON (because client got no ACK)
     *     => resend ACK
     */

    KeyMID idByMID = new KeyMID(response.getMID(),
        response.getSource().getAddress(), response.getSourcePort());
   
    KeyToken idByTok = new KeyToken(response.getToken(),
        response.getSource().getAddress(), response.getSourcePort());
   
View Full Code Here

    }
  }

  public Exchange receiveEmptyMessage(EmptyMessage message) {
   
    KeyMID idByMID = new KeyMID(message.getMID(),
        message.getSource().getAddress(), message.getSourcePort());
   
    Exchange exchange = exchangesByMID.get(idByMID);
   
    if (exchange != null) {
View Full Code Here

     
      if (exchange.getOrigin() == Origin.LOCAL) {
        // this endpoint created the Exchange by issuing a request
        Request request = exchange.getRequest();
        KeyToken idByTok = new KeyToken(exchange.getCurrentRequest().getToken(), request.getDestination().getAddress(), request.getDestinationPort());
        KeyMID idByMID = new KeyMID(request.getMID(), request.getDestination().getAddress(), request.getDestinationPort());
       
//        LOGGER.fine("Exchange completed: Cleaning up "+idByTok);
        exchangesByToken.remove(idByTok);
        // in case an empty ACK was lost
        exchangesByMID.remove(idByMID);
     
      } else {
        // this endpoint created the Exchange to respond a request
        Request request = exchange.getCurrentRequest();
        if (request != null) {
          // TODO: We can optimize this and only do it, when the request really had blockwise transfer
          KeyUri uriKey = new KeyUri(request.getURI(),
              request.getSource().getAddress(), request.getSourcePort());
//          LOGGER.warning("++++++++++++++++++Remote ongoing completed, cleaning up "+uriKey);
          ongoingExchanges.remove(uriKey);
        }
        // TODO: What if the request is only a block?
        // TODO: This should only happen if the transfer was blockwise

        Response response = exchange.getResponse();
        if (response != null) {
          // only response MIDs are stored for ACK and RST, no reponse Tokens
          KeyMID midKey = new KeyMID(response.getMID(),
              response.getDestination().getAddress(), response.getDestinationPort());
//          LOGGER.warning("++++++++++++++++++Remote ongoing completed, cleaning up "+midKey);
          exchangesByMID.remove(midKey);
        }
      }
View Full Code Here

TOP

Related Classes of ch.ethz.inf.vs.californium.network.Exchange.KeyMID

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.