Class EntityHandler

java.lang.Object
com.biglybt.core.networkmanager.impl.EntityHandler

public class EntityHandler extends Object
Manages transfer entities on behalf of peer connections. Each entity handler has a global pool which manages all connections by default. Connections can also be "upgraded" to a higher connection control level, i.e. each connection has its own specialized entity for performance purposes.
  • Field Details

    • upgraded_connections

      private final HashMap upgraded_connections
    • lock

      private final AEMonitor lock
    • global_uploader

      private final MultiPeerUploader global_uploader
    • global_downloader

      private final MultiPeerDownloader2 global_downloader
    • global_registered

      private boolean global_registered
    • handler_type

      private final int handler_type
    • net_man

      private final NetworkManager net_man
  • Constructor Details

    • EntityHandler

      public EntityHandler(NetworkManager _net_man, int type, RateHandler rate_handler)
      Create a new entity handler using the given rate handler.
      Parameters:
      type - read or write type handler
      rate_handler - global max rate handler
  • Method Details

    • registerPeerConnection

      public void registerPeerConnection(NetworkConnectionBase connection)
      Register a peer connection for management by the handler.
      Parameters:
      connection - to add to the global pool
    • cancelPeerConnection

      public boolean cancelPeerConnection(NetworkConnectionBase connection)
      Remove a peer connection from the entity handler.
      Parameters:
      connection - to cancel
    • upgradePeerConnection

      public void upgradePeerConnection(NetworkConnectionBase connection, RateHandler handler, int partition_id)
      Upgrade a peer connection from the general pool to its own high-speed entity.
      Parameters:
      connection - to upgrade from global management
      handler - individual connection rate handler
    • downgradePeerConnection

      public void downgradePeerConnection(NetworkConnectionBase connection)
      Downgrade (return) a peer connection back into the general pool.
      Parameters:
      connection - to downgrade back into the global entity
    • getRateHandler

      public RateHandler getRateHandler(NetworkConnectionBase connection)