Examples of AZGenericMapPayload


Examples of com.aelitis.azureus.core.peermanager.messaging.azureus.AZGenericMapPayload

        try{
          Message[] messages = client.readMessages();
       
          if( messages != null ) {       
            for( int i=0; i < messages.length; i++ ) {
              AZGenericMapPayload msg = (AZGenericMapPayload)messages[i];
              ClientMessage client_msg = new ClientMessage( msg.getID(), client, msg.getMapPayload(), null )//note no handler. we let the listener attach it   
              listener.messageReceived( client_msg )
            }
          } 
         
          return( client.getLastReadMadeProgress());
        }
        catch( Throwable t ) {
          if ( !client.isClosePending()){
           
            //System.out.println( "[" +new Date()+ "] Connection read error [" +sc.socket().getInetAddress()+ "] [" +client.getDebugString()+ "]: " +t.getMessage() );
          }
         
          listener.connectionError( client, t );
          return( false );
        }
      }

      //FAILURE
      public void selectFailure( VirtualChannelSelector selector, SocketChannel sc, Object attachment, Throwable msg ) {
        if ( !destroyed ){
          msg.printStackTrace();
        }
        listener.connectionError( client, msg );
      }
    };
   
   
    //WRITES
    final VirtualChannelSelector.VirtualSelectorListener write_listener = new VirtualChannelSelector.VirtualSelectorListener() {
      public boolean selectSuccess( VirtualChannelSelector selector, SocketChannel sc, Object attachment ) {    
        try{
          boolean more_writes_needed = client.writeMessages();
       
          if( more_writes_needed ) {
            write_selector.resumeSelects( client.getSocketChannel() )//we need to resume since write selects are auto-paused after select op
          }
         
          return( client.getLastWriteMadeProgress());
        }
        catch( Throwable t ) {
          //System.out.println( "[" +new Date()+ "] Connection write error [" +sc.socket().getInetAddress()+ "] [" +client.getDebugString()+ "]: " +t.getMessage() );
          listener.connectionError( client, t );
          return( false );
        }
      }

      public void selectFailure( VirtualChannelSelector selector, SocketChannel sc, Object attachment, Throwable msg ) {
        if ( !destroyed ){
          msg.printStackTrace();
        }
        listener.connectionError( client, msg );
      }
    };
View Full Code Here

Examples of com.aelitis.azureus.core.peermanager.messaging.azureus.AZGenericMapPayload

      message.reportFailed( new Exception("No longer connected" ));
      //listener.connectionError( vconn ); //no need to call this, as there is no connection to remove
      return;
    }
   
    Message reply = new AZGenericMapPayload( message.getMessageID(), message.getPayload(), (byte)1 );

    vconn.sendMessage( message, reply );
   
    write_selector.resumeSelects( vconn.getSocketChannel() )//start write selecting now that there's something to send
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.