Class BuddyPluginBuddy

java.lang.Object
com.biglybt.plugin.net.buddy.BuddyPluginBuddy

public class BuddyPluginBuddy extends Object
  • Field Details

    • TRACE

      private static final boolean TRACE
      See Also:
    • CONNECTION_IDLE_TIMEOUT

      private static final int CONNECTION_IDLE_TIMEOUT
      See Also:
    • CONNECTION_KEEP_ALIVE

      private static final int CONNECTION_KEEP_ALIVE
      See Also:
    • MAX_ACTIVE_CONNECTIONS

      private static final int MAX_ACTIVE_CONNECTIONS
      See Also:
    • MAX_QUEUED_MESSAGES

      private static final int MAX_QUEUED_MESSAGES
      See Also:
    • RT_REQUEST_DATA

      private static final int RT_REQUEST_DATA
      See Also:
    • RT_REPLY_DATA

      private static final int RT_REPLY_DATA
      See Also:
    • RT_REPLY_ERROR

      private static final int RT_REPLY_ERROR
      See Also:
    • plugin_network

      private BuddyPluginNetwork plugin_network
    • created_time

      private long created_time
    • subsystem

      private int subsystem
    • authorised

      private boolean authorised
    • public_key

      private String public_key
    • nick_name

      private String nick_name
    • my_name

      private String my_name
    • recent_ygm

      private List<Long> recent_ygm
    • is_transient

      private boolean is_transient
    • last_status_seq

      private int last_status_seq
    • post_time

      private long post_time
    • current_ip

      private InetSocketAddress current_ip
    • latest_ipv4

      private InetSocketAddress latest_ipv4
    • latest_ipv6

      private InetSocketAddress latest_ipv6
    • tcp_port

      private int tcp_port
    • udp_port

      private int udp_port
    • online_status

      private int online_status
    • version

      private int version
    • online

      private boolean online
    • last_time_online

      private long last_time_online
    • status_check_count

      private long status_check_count
    • last_status_check_time

      private long last_status_check_time
    • check_active

      private boolean check_active
    • connections

      private List<BuddyPluginBuddy.buddyConnection> connections
    • messages

    • current_message

      private BuddyPluginBuddy.buddyMessage current_message
    • next_connection_id

      private int next_connection_id
    • next_message_id

      private int next_message_id
    • ygm_active

      private boolean ygm_active
    • ygm_pending

      private boolean ygm_pending
    • latest_ygm_time

      private long latest_ygm_time
    • last_message_received

      private String last_message_received
    • offline_seq_set

      private Set<Long> offline_seq_set
    • message_out_count

      private int message_out_count
    • message_in_count

      private int message_in_count
    • message_out_bytes

      private int message_out_bytes
    • message_in_bytes

      private int message_in_bytes
    • received_frag_details

      private String received_frag_details
    • persistent_msg_handler

      private BuddyPluginBuddyMessageHandler persistent_msg_handler
    • user_data

      private Map<Object,Object> user_data
    • keep_alive_outstanding

      private boolean keep_alive_outstanding
    • last_connect_attempt

      private volatile long last_connect_attempt
    • consec_connect_fails

      private volatile int consec_connect_fails
    • last_auto_reconnect

      private long last_auto_reconnect
    • rss_lock

      private Object rss_lock
    • rss_local_cats

      private Set<String> rss_local_cats
    • rss_remote_cats

      private Set<String> rss_remote_cats
    • rss_cats_read

      private Set<String> rss_cats_read
    • profile_info

      private List<String> profile_info
    • profile_info_outstanding

      private boolean profile_info_outstanding
    • profile_info_last

      private long profile_info_last
    • outgoing_connect_sem

      private AESemaphore outgoing_connect_sem
    • closing

      private volatile boolean closing
    • destroyed

      private volatile boolean destroyed
  • Constructor Details

    • BuddyPluginBuddy

      protected BuddyPluginBuddy(BuddyPluginNetwork _plugin_network, long _created_time, int _subsystem, boolean _authorised, String _pk, String _nick_name, String _my_name, int _version, String _rss_local_cats, String _rss_remote_cats, int _last_status_seq, long _last_time_online, List<Long> _recent_ygm, boolean _is_transient)
  • Method Details

    • getPluginNetwork

      public BuddyPluginNetwork getPluginNetwork()
    • isPublicNetwork

      public boolean isPublicNetwork()
    • setInitialStatus

      protected void setInitialStatus(long now, int num_buddies)
    • getPlugin

      protected BuddyPluginNetwork getPlugin()
    • getMessageHandler

      public BuddyPluginBuddyMessageHandler getMessageHandler()
    • persistentDispatchPending

      protected void persistentDispatchPending()
    • checkPersistentDispatch

      protected void checkPersistentDispatch()
    • persistentDispatch

      protected void persistentDispatch()
    • readConfigFile

      public Map readConfigFile(File name)
    • writeConfigFile

      public boolean writeConfigFile(File name, Map data)
    • getCreatedTime

      protected long getCreatedTime()
    • getSubsystem

      public int getSubsystem()
    • setSubsystem

      protected void setSubsystem(int _s)
    • isAuthorised

      public boolean isAuthorised()
    • setAuthorised

      protected void setAuthorised(boolean _a)
    • isTransient

      public boolean isTransient()
    • setTransient

      public void setTransient(boolean b)
    • getPublicKey

      public String getPublicKey()
    • getRawPublicKey

      protected byte[] getRawPublicKey()
    • getShortString

      protected String getShortString()
    • getNickName

      public String getNickName()
    • getVersion

      public int getVersion()
    • setVersion

      protected void setVersion(int v)
    • getLocalAuthorisedRSSTagsOrCategoriesAsString

      public String getLocalAuthorisedRSSTagsOrCategoriesAsString()
    • getLocalAuthorisedRSSTagsOrCategories

      public Set<String> getLocalAuthorisedRSSTagsOrCategories()
    • addLocalAuthorisedRSSTagOrCategory

      public void addLocalAuthorisedRSSTagOrCategory(String category)
    • removeLocalAuthorisedRSSTagOrCategory

      public void removeLocalAuthorisedRSSTagOrCategory(String category)
    • setLocalAuthorisedRSSTagsOrCategories

      public void setLocalAuthorisedRSSTagsOrCategories(String new_cats)
    • setLocalAuthorisedRSSTagsOrCategories

      public void setLocalAuthorisedRSSTagsOrCategories(Set<String> new_cats)
    • getRemoteAuthorisedRSSTagsOrCategories

      public Set<String> getRemoteAuthorisedRSSTagsOrCategories()
    • getRemoteAuthorisedRSSTagsOrCategoriesAsString

      public String getRemoteAuthorisedRSSTagsOrCategoriesAsString()
    • setRemoteAuthorisedRSSTagsOrCategories

      protected void setRemoteAuthorisedRSSTagsOrCategories(Set<String> new_cats)
    • isLocalRSSTagOrCategoryAuthorised

      public boolean isLocalRSSTagOrCategoryAuthorised(String category)
    • isRemoteRSSTagOrCategoryAuthorised

      public boolean isRemoteRSSTagOrCategoryAuthorised(String category)
    • localRSSTagOrCategoryRead

      protected void localRSSTagOrCategoryRead(String str)
    • getLocalReadTagsOrCategoriesAsString

      public String getLocalReadTagsOrCategoriesAsString()
    • getSubscriptionURL

      public URL getSubscriptionURL(String cat)
    • subscribeToCategory

      public void subscribeToCategory(String cat) throws BuddyPluginException
      Throws:
      BuddyPluginException
    • isSubscribedToCategory

      public boolean isSubscribedToCategory(String cat)
    • catsToString

      protected String catsToString(Set<String> cats)
    • catsIdentical

      protected boolean catsIdentical(Set<String> c1, Set<String> c2)
    • stringToCats

      protected Set<String> stringToCats(String str)
    • getOnlineStatus

      public int getOnlineStatus()
    • setOnlineStatus

      protected void setOnlineStatus(int s)
    • getName

      public String getName()
    • getMyName

      public String getMyName()
    • setMyName

      public void setMyName(String _my_name)
    • remove

      public void remove()
    • getIP

      public InetSocketAddress getIP()
    • getLatestIP

      public InetSocketAddress getLatestIP(boolean v4)
    • getAdjustedIP

      public InetSocketAddress getAdjustedIP()
    • getAdjustedIPs

      public List<InetSocketAddress> getAdjustedIPs()
    • getTCPPort

      public int getTCPPort()
    • getUDPPort

      public int getUDPPort()
    • isOnline

      public boolean isOnline(boolean is_connected)
    • isIdle

      protected boolean isIdle()
    • getLastTimeOnline

      public long getLastTimeOnline()
    • getProfileInfo

      public void getProfileInfo(BuddyPluginBuddy.ProfileUpdateInformer informer)
    • encrypt

      public BuddyPlugin.CryptoResult encrypt(byte[] payload) throws BuddyPluginException
      Throws:
      BuddyPluginException
    • decrypt

      public BuddyPlugin.CryptoResult decrypt(byte[] payload) throws BuddyPluginException
      Throws:
      BuddyPluginException
    • verify

      public boolean verify(byte[] payload, byte[] signature) throws BuddyPluginException
      Throws:
      BuddyPluginException
    • storeMessage

      public BuddyPluginBuddyMessage storeMessage(int type, Map msg)
    • retrieveMessages

      public List<BuddyPluginBuddyMessage> retrieveMessages(int type)
    • setMessagePending

      public void setMessagePending() throws BuddyPluginException
      Throws:
      BuddyPluginException
    • getLastMessagePending

      public long getLastMessagePending()
    • addYGMMarker

      protected boolean addYGMMarker(long marker)
    • setLastMessageReceived

      protected void setLastMessageReceived(String str)
    • getLastMessageReceived

      public String getLastMessageReceived()
    • getYGMMarkers

      protected List<Long> getYGMMarkers()
    • getLastStatusSeq

      protected int getLastStatusSeq()
    • buddyConnectionEstablished

      protected void buddyConnectionEstablished(boolean outgoing)
    • buddyMessageSent

      protected void buddyMessageSent(int size, boolean record_active)
    • buddyMessageReceived

      protected void buddyMessageReceived(int size)
    • buddyMessageFragmentReceived

      protected void buddyMessageFragmentReceived(int num_received, int total)
    • getMessageInFragmentDetails

      public String getMessageInFragmentDetails()
    • getMessageInCount

      public int getMessageInCount()
    • getMessageOutCount

      public int getMessageOutCount()
    • getBytesInCount

      public int getBytesInCount()
    • getBytesOutCount

      public int getBytesOutCount()
    • isConnected

      public boolean isConnected()
    • buddyActive

      protected void buddyActive()
    • ping

      public void ping() throws BuddyPluginException
      Throws:
      BuddyPluginException
    • sendCloseRequest

      protected void sendCloseRequest(boolean restarting)
    • receivedCloseRequest

      protected void receivedCloseRequest(Map request)
    • sendMessage

      public void sendMessage(int subsystem, Map content, int timeout_millis, BuddyPluginBuddyReplyListener listener) throws BuddyPluginException
      Throws:
      BuddyPluginException
    • sendMessageSupport

      protected void sendMessageSupport(Map content, int subsystem, int timeout_millis, BuddyPluginBuddyReplyListener original_listener) throws BuddyPluginException
      Throws:
      BuddyPluginException
    • dispatchMessage

      protected void dispatchMessage()
    • removeConnection

      protected void removeConnection(BuddyPluginBuddy.buddyConnection bc)
    • getLastStatusCheckTime

      protected long getLastStatusCheckTime()
    • statusCheckActive

      protected boolean statusCheckActive()
    • statusCheckStarts

      protected boolean statusCheckStarts()
    • statusCheckFailed

      protected void statusCheckFailed()
    • setAddress

      private void setAddress(InetSocketAddress address)
    • addressesEqual

      private boolean addressesEqual(InetSocketAddress ias1, InetSocketAddress ias2)
    • setCachedStatus

      protected void setCachedStatus(InetSocketAddress _ip, int _tcp_port, int _udp_port)
    • statusCheckComplete

      protected void statusCheckComplete(BuddyPluginNetwork.DDBDetails _ddb_details, long _post_time, InetSocketAddress _ias, int _tcp_port, int _udp_port, String _nick_name, int _online_status, int _status_seq, int _version)
    • checkTimeouts

      protected void checkTimeouts()
    • sendKeepAlive

      protected void sendKeepAlive()
    • getConnectionsString

      public String getConnectionsString()
    • disconnect

      public void disconnect()
    • isClosing

      protected boolean isClosing()
    • destroy

      protected void destroy()
    • logMessage

      protected void logMessage(String str)
    • outgoingConnection

      protected GenericMessageConnection outgoingConnection() throws BuddyPluginException
      Throws:
      BuddyPluginException
    • incomingConnection

      protected void incomingConnection(BuddyPluginNetwork.DDBDetails _ddb_details, GenericMessageConnection _connection) throws BuddyPluginException
      Throws:
      BuddyPluginException
    • addConnection

      protected void addConnection(BuddyPluginNetwork.DDBDetails _ddb_details, GenericMessageConnection _connection) throws BuddyPluginException
      Throws:
      BuddyPluginException
    • setUserData

      public void setUserData(Object key, Object value)
    • getUserData

      public Object getUserData(Object key)
    • log

      protected void log(String str)
    • log

      protected void log(String str, Throwable e)
    • getString

      public String getString()