public void StartBrowsing() { TCPConnection con = TCPConnection.getPeerConnection(Peer); if (!con.Connect()) { G2Log.Write("G2BrowseSearch could not connect to Peer " + this.Peer.ToString()); if (EndSearch != null) { EndSearch(referenceToPeer, referenceToSearchResults, packetResults); } return; } if (!SendHttpRequest(con)) { if (EndSearch != null) { EndSearch(referenceToPeer, referenceToSearchResults, packetResults); } Peer.Close(); return; } bool streaming = ReadResponseHeader(con); if (!streaming) { if (EndSearch != null) { EndSearch(referenceToPeer, referenceToSearchResults, packetResults); } Peer.Close(); return; } // start to read the flow of packets this.Peer.connection = new HubSocket(this.Peer, con.sock, reader); this.Peer.connection.Start(); G2Log.Write("G2BrowseSearch : browsing peer " + Peer.ToString() + " ..."); SearchTimer = new Timer(Settings.WAIT_TIME_BROWSING_MS); SearchTimer.Elapsed += new ElapsedEventHandler(SearchTimeOut); SearchTimer.AutoReset = false; SearchTimer.Start(); }
/** Remove the hub from the connected hub cache and close its connection */ public void RemoveConnectedHub(NodePeer hub) { lock (ConnectedHub_) { ConnectedHub_.Remove(hub); hub.Close(); G2Log.Write("Cache : Removing hub " + hub.ToString() + " ... "); } }
/** Remove the hub from the connected hub cache and close its connection */ public void RemoveConnectedHub(NodePeer hub) { lock (ConnectedHub_) { ConnectedHub_.Remove (hub); hub.Close (); G2Log.Write ("Cache : Removing hub " + hub.ToString() + " ... "); } }