/** * Enables access to event mechanism of a channel and is normally not used by clients directly. * * @param evt sends an Event to a specific protocol layer and receives a response. * @return a response from a particular protocol layer targeted by Event parameter */ public Object down(Event evt) { if(evt.type() == 1) // MSG return ch.down((Message)evt.getArg()); return ch.down(evt); }
public Object down(Event evt) { Object retval=super.down(evt); switch(evt.type()) { case Event.ADD_PHYSICAL_ADDRESS: Tuple<Address,PhysicalAddress> tuple=evt.arg(); IpAddress val=(IpAddress)tuple.getVal2(); addr_table.put(tuple.getVal1(), new InetSocketAddress(val.getIpAddress(), val.getPort())); break; case Event.VIEW_CHANGE: for(Iterator<Map.Entry<Address,SocketAddress>> it=addr_table.entrySet().iterator(); it.hasNext();) { Map.Entry<Address,SocketAddress> entry=it.next(); if(!view.containsMember(entry.getKey())) { SocketAddress sock_addr=entry.getValue(); it.remove(); Connection conn=connections.remove(sock_addr); Util.close(conn); } } break; } return retval; }
public Object up(Event evt) { switch(evt.type()) { case Event.GET_SECRET_KEY: return new Tuple<>(secret_key, sym_version); case Event.SET_SECRET_KEY: Tuple<SecretKey,byte[]> tuple=evt.arg(); try { setKeys(null, tuple.getVal1(), tuple.getVal2()); } catch(Exception ex) { log.error("failed setting secret key", ex); } return null; } return up_prot.up(evt); }
public Object down(Event evt) { switch(evt.type()) { case Event.SET_LOCAL_ADDRESS: local_addr=evt.arg(); break; case Event.VIEW_CHANGE: handleView(evt.arg()); break; case Event.FETCH_SECRET_KEY: Address target=evt.arg(); try { fetchSecretKeyFrom(target); } catch(Exception e) { // throw new RuntimeException(e); log.warn("failed fetching secret key from %s: %s", target, e); } return null; // the event is consumed and should not be passed further down } return down_prot.down(evt); }
/** * Enables access to event mechanism of a channel and is normally not used by clients directly. * * @param evt sends an Event to a specific protocol layer and receives a response. * @return a response from a particular protocol layer targeted by Event parameter */ public Object down(Event evt) { if(evt.type() == 1) // MSG return ch.down((Message)evt.getArg()); return ch.down(evt); }
public Object down(Event evt) { Object retval=super.down(evt); switch(evt.type()) { case Event.ADD_PHYSICAL_ADDRESS: Tuple<Address,PhysicalAddress> tuple=evt.arg(); IpAddress val=(IpAddress)tuple.getVal2(); addr_table.put(tuple.getVal1(), new InetSocketAddress(val.getIpAddress(), val.getPort())); break; case Event.VIEW_CHANGE: for(Iterator<Map.Entry<Address,SocketAddress>> it=addr_table.entrySet().iterator(); it.hasNext();) { Map.Entry<Address,SocketAddress> entry=it.next(); if(!view.containsMember(entry.getKey())) { SocketAddress sock_addr=entry.getValue(); it.remove(); Connection conn=connections.remove(sock_addr); Util.close(conn); } } break; } return retval; }
public Object up(Event evt) { switch(evt.type()) { case Event.GET_SECRET_KEY: return new Tuple<>(secret_key, sym_version); case Event.SET_SECRET_KEY: Tuple<SecretKey,byte[]> tuple=evt.arg(); try { setKeys(null, tuple.getVal1(), tuple.getVal2()); } catch(Exception ex) { log.error("failed setting secret key", ex); } return null; } return up_prot.up(evt); }
public Object down(Event evt) { switch(evt.type()) { case Event.SET_LOCAL_ADDRESS: local_addr=evt.arg(); break; case Event.VIEW_CHANGE: handleView(evt.arg()); break; case Event.FETCH_SECRET_KEY: Address target=evt.arg(); try { fetchSecretKeyFrom(target); } catch(Exception e) { // throw new RuntimeException(e); log.warn("failed fetching secret key from %s: %s", target, e); } return null; // the event is consumed and should not be passed further down } return down_prot.down(evt); }