Public Types | |
enum | ConnectionDirection { Upload, Download, Unknown } |
enum | FileRequestAnswer { FileNotAvailable, NoFreeSlots, LetsGo } |
Public Member Functions | |
delegate void | CompletedEventHandler (Peer peer) |
void | Connect () |
delegate void | ConnectedEventHandler (Peer peer) |
void | ConnectTo (string dst_ip, int dst_port) |
delegate void | DataReceivedEventHandler (Peer peer) |
override void | Disconnect () |
Prototype for the Disconnect method used in the Peer/Hub classes. | |
delegate void | DisconnectedEventHandler (Peer peer) |
delegate FileRequestAnswer | FileListRequestReceivedEventHandler (Peer peer) |
delegate FileRequestAnswer | FileRequestReceivedEventHandler (Peer peer) |
void | GetFileList (Queue.QueueEntry entry) |
void | GetTTHL (Queue.QueueEntry entry) |
delegate void | HandShakeCompletedEventHandler (Peer peer) |
Peer () | |
Peer (string address) | |
Peer (string dst_ip, int dst_port) | |
Peer (Socket client) | |
Peer (Socket client, string nick) | |
void | SendError (string message) |
void | SendFailed (string message) |
void | SendFileNotAvailableError () |
void | SendMaxedOut () |
void | StartDownload (string filename, string output_filename, long output_file_length) |
void | StartDownload (Queue.QueueEntry.Source source, Queue.QueueEntry entry) |
void | StartDownload () |
void | StartDownloadTransfer () |
void | StartHandShake () |
bool | StartUpload () |
void | StartUploadTransfer () |
delegate void | UnableToConnectEventHandler (Peer peer) |
void | Ungrab () |
Public Attributes | |
event CompletedEventHandler | Completed |
event ConnectedEventHandler | Connected |
event DataReceivedEventHandler | DataReceived |
event DisconnectedEventHandler | Disconnected |
event FileListRequestReceivedEventHandler | FileListRequestReceived |
event FileRequestReceivedEventHandler | FileRequestReceived |
event HandShakeCompletedEventHandler | HandShakeCompleted |
event UnableToConnectEventHandler | UnableToConnect |
Protected Member Functions | |
void | UploadTransferCallback (IAsyncResult ar) |
Protected Attributes | |
long | bytes_already_downloaded = 0 |
long | bytes_already_uploaded = 0 |
long | bytes_downloaded = 0 |
long | bytes_uploaded = 0 |
ConnectionDirection | direction = ConnectionDirection.Unknown |
bool | is_downloading = false |
bool | is_uploading = false |
string | peer_nick = "unknown" |
Queue.QueueEntry | queue_entry = new Queue.QueueEntry() |
Queue.QueueEntry.Source | source = new Queue.QueueEntry.Source() |
float | speed = 0 |
long | tthl_size = 0 |
byte[] | upload_file_list_data = null |
string | upload_filename = "" |
long | upload_length = 0 |
long | upload_offset = 0 |
string | upload_request_filename = "" |
Properties | |
long | BytesAlreadyDownloaded [get] |
long | BytesAlreadyUploaded [get] |
long | BytesDownloaded [get] |
long | BytesUploaded [get] |
ConnectionDirection | Direction [get] |
bool | IsDownloading [get] |
bool | IsUploading [get] |
string | PeerNick [get, set] |
Queue.QueueEntry | QueueEntry [get] |
Queue.QueueEntry.Source | Source [get] |
float | Speed [get] |
long | TTHLSize [get] |
byte[] | UploadFileListData [get, set] |
string | UploadFilename [get, set] |
long | UploadLength [get] |
long | UploadOffset [get] |
string | UploadRequestFilename [get] |
Private Member Functions | |
void | DecideDirection () |
bool | InterpretCommand (string received_command) |
internal function to interpret a command received from the remote peer | |
int | InterpretReceivedString (string received_string) |
internal function to interpret the received bytes of a socket | |
void | OnConnect (IAsyncResult result) |
void | OnReceive (IAsyncResult result) |
void | StartReceiving () |
void | WriteDataToFile (int bytes_start, int bytes_end) |
Private Attributes | |
bool | first_bytes_received = false |
int | handshake_his_value = 0 |
int | handshake_my_value = 0 |
ConnectionDirection | his_direction_wish = ConnectionDirection.Unknown |
int | start_tick = 0 |
Stream | stream = null |
long | upload_block_size = 1024 |
Definition at line 12 of file Peer.cs.
DCPlusPlus.Peer.Peer | ( | Socket | client, | |
string | nick | |||
) |
Definition at line 1141 of file Peer.cs.
01142 { 01143 this.nick = nick; 01144 this.socket = client; 01145 is_connected = true; 01146 StartReceiving(); 01147 }
DCPlusPlus.Peer.Peer | ( | Socket | client | ) |
Definition at line 1148 of file Peer.cs.
01149 { 01150 is_connected = true; 01151 this.socket = client; 01152 StartReceiving(); 01153 }
DCPlusPlus.Peer.Peer | ( | string | dst_ip, | |
int | dst_port | |||
) |
DCPlusPlus.Peer.Peer | ( | string | address | ) |
Definition at line 1159 of file Peer.cs.
01160 { 01161 string tmp = address; 01162 int port_start = tmp.IndexOf(":"); 01163 if (port_start != -1) 01164 { 01165 int tmp_port = 411; 01166 string tmp_port_string = tmp.Substring(port_start + 1); 01167 try 01168 { 01169 tmp_port = int.Parse(tmp_port_string); 01170 } 01171 catch (Exception) 01172 { 01173 Console.WriteLine("error parsing port : " + tmp_port_string); 01174 } 01175 01176 tmp = tmp.Substring(0, port_start); 01177 port = tmp_port; 01178 } 01179 ip = tmp; //ip or adress property? 01180 }
DCPlusPlus.Peer.Peer | ( | ) |
delegate void DCPlusPlus.Peer.CompletedEventHandler | ( | Peer | peer | ) |
void DCPlusPlus.Peer.Connect | ( | ) |
Definition at line 1226 of file Peer.cs.
Referenced by DCPlusPlus.Client.ConnectHub().
01227 { 01228 if (is_connecting) 01229 {//better handling of fast user retries 01230 error_code = ErrorCodes.UserDisconnect; 01231 Disconnect(); 01232 } 01233 if (!is_connected) 01234 { 01235 try 01236 { 01237 is_connecting = true; 01238 //Disconnect();//if still connected , disconnect first 01239 socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); 01240 socket.Blocking = false; 01241 IPEndPoint endpoint = new IPEndPoint(IPAddress.Parse(ip), port); 01242 AsyncCallback event_connect = new AsyncCallback(OnConnect); 01243 socket.BeginConnect(endpoint, event_connect, socket); 01244 socket.ReceiveTimeout = 500; 01245 socket.SendTimeout = 500; 01246 } 01247 catch (Exception ex) 01248 { 01249 Console.WriteLine("Error connecting to Peer: " + ip + ":" + port + "(exception:" + ex.Message + ")"); 01250 error_code = ErrorCodes.UnableToConnect; 01251 Disconnect(); 01252 } 01253 } 01254 01255 }
Here is the caller graph for this function:
delegate void DCPlusPlus.Peer.ConnectedEventHandler | ( | Peer | peer | ) |
void DCPlusPlus.Peer.ConnectTo | ( | string | dst_ip, | |
int | dst_port | |||
) |
delegate void DCPlusPlus.Peer.DataReceivedEventHandler | ( | Peer | peer | ) |
void DCPlusPlus.Peer.DecideDirection | ( | ) | [private] |
Definition at line 1120 of file Peer.cs.
01121 { 01122 if (direction == ConnectionDirection.Unknown && his_direction_wish != ConnectionDirection.Unknown) 01123 {//only decide once 01124 if (handshake_my_value < handshake_his_value) 01125 direction = his_direction_wish; 01126 else direction = ConnectionDirection.Download; 01127 01128 try 01129 { 01130 if (HandShakeCompleted != null) 01131 HandShakeCompleted(this); 01132 01133 } 01134 catch (Exception ex) 01135 { 01136 Console.WriteLine("Exception in Handshake Event: " + ex.Message); 01137 } 01138 01139 } 01140 }
override void DCPlusPlus.Peer.Disconnect | ( | ) | [virtual] |
Prototype for the Disconnect method used in the Peer/Hub classes.
Implements DCPlusPlus.Connection.
Definition at line 1194 of file Peer.cs.
Referenced by DCPlusPlus.Peer.OnReceive(), DCPlusPlus.Peer.SendFileNotAvailableError(), DCPlusPlus.Peer.SendMaxedOut(), DCPlusPlus.Peer.StartReceiving(), DCPlusPlus.Peer.StartUpload(), DCPlusPlus.Peer.StartUploadTransfer(), DCPlusPlus.Peer.UploadTransferCallback(), and DCPlusPlus.Peer.WriteDataToFile().
01195 { 01196 if (stream != null) 01197 { 01198 stream.Close(); 01199 } 01200 if (is_connected || is_connecting) 01201 { 01202 if (socket != null) 01203 { 01204 //if (socket.Connected) 01205 //{ 01206 this.socket.Close(); 01207 } else Console.WriteLine("This socket is unused -> no disconnect needed."); 01208 //} 01209 if (is_connected) 01210 { 01211 if (Disconnected != null) 01212 Disconnected(this); 01213 } 01214 else if (is_connecting) 01215 { 01216 if (UnableToConnect != null) 01217 UnableToConnect(this); 01218 } 01219 is_connected = false; 01220 is_connecting = false; 01221 is_downloading = false; 01222 is_uploading = false; 01223 //else Console.WriteLine("This peer is already disconnected"); 01224 } 01225 }
Here is the caller graph for this function:
delegate void DCPlusPlus.Peer.DisconnectedEventHandler | ( | Peer | peer | ) |
delegate FileRequestAnswer DCPlusPlus.Peer.FileListRequestReceivedEventHandler | ( | Peer | peer | ) |
delegate FileRequestAnswer DCPlusPlus.Peer.FileRequestReceivedEventHandler | ( | Peer | peer | ) |
void DCPlusPlus.Peer.GetFileList | ( | Queue.QueueEntry | entry | ) |
Definition at line 569 of file Peer.cs.
References DCPlusPlus.Connection.CheckForExtension(), DCPlusPlus.Peer.direction, DCPlusPlus.Peer.queue_entry, DCPlusPlus.Connection.SendCommand(), and DCPlusPlus.Peer.source.
00570 {//try to download a filelist that the peer offers by his supports 00571 //it would be fine to have these converted on the spot to our standard filelist format (files.xml.bz2) 00572 this.queue_entry = entry; 00573 this.source = entry.Sources[0];//filelist queue entry have exactly one source , no more no less 00574 direction = ConnectionDirection.Download; 00575 long start_pos = 1; 00576 if (File.Exists(queue_entry.OutputFilename)) 00577 { 00578 File.Delete(queue_entry.OutputFilename);//delete old filelist if happen to be there 00579 } 00580 00581 string filename = "MyList.DcLst"; 00582 if (CheckForExtension("XmlBZList")) 00583 filename = "files.xml.bz2"; 00584 else if (CheckForExtension("BZList")) 00585 filename = "MyList.bz2"; 00586 00587 source.Filename = filename; 00588 00589 if (CheckForExtension("ADCGet")) 00590 { 00591 start_pos = start_pos - 1; 00592 SendCommand("ADCGET", "file " + source.Filename + " " + start_pos + " -1"); 00593 Console.WriteLine("Trying to adc-fetch filelist(" + filename + ") from: '" + entry.Sources[0].UserName + "'"); 00594 } 00595 else 00596 { 00597 SendCommand("Get", filename + "$" + start_pos); 00598 Console.WriteLine("Trying to fetch filelist(" + filename + ") from: '" + entry.Sources[0].UserName + "'"); 00599 } 00600 00601 }
Here is the call graph for this function:
void DCPlusPlus.Peer.GetTTHL | ( | Queue.QueueEntry | entry | ) |
Definition at line 602 of file Peer.cs.
References DCPlusPlus.Peer.bytes_already_downloaded, DCPlusPlus.Connection.CheckForExtension(), DCPlusPlus.Peer.direction, DCPlusPlus.Peer.queue_entry, DCPlusPlus.Connection.SendCommand(), and DCPlusPlus.Peer.source.
00603 {//try to download a tthl block if peer offers this via supports 00604 this.queue_entry = entry; 00605 //this.source = entry.Sources[0]; 00606 //this.source = source; 00607 direction = ConnectionDirection.Download; 00608 long start_pos = 0; 00609 if (File.Exists(queue_entry.OutputFilename + ".tthl")) 00610 { 00611 File.Delete(queue_entry.OutputFilename + ".tthl");//delete old tthl file if happen to be there 00612 } 00613 00614 bytes_already_downloaded = 0; 00615 /*if (File.Exists(queue_entry.OutputFilename)) 00616 { 00617 FileInfo fi = new FileInfo(queue_entry.OutputFilename); 00618 if (fi.Length >= queue_entry.Filesize) 00619 {//abort , file is complete or something else may happened here 00620 Disconnect(); 00621 return; 00622 } 00623 start_pos = fi.Length + 1; 00624 bytes_already_downloaded = fi.Length; 00625 stream = new FileStream(queue_entry.OutputFilename, FileMode.Append, FileAccess.Write, System.IO.FileShare.ReadWrite); 00626 } 00627 else start_pos = 1; 00628 */ 00629 00630 if (CheckForExtension("ADCGet") && CheckForExtension("TTHL") && CheckForExtension("TTHF") && queue_entry.HasTTH) 00631 { 00632 SendCommand("ADCGET", "tthl TTH/" + queue_entry.TTH + " " + start_pos + " -1"); 00633 //SendCommand("ADCGET", "tthl " + source.Filename + " " + start_pos + " -1"); 00634 //Console.WriteLine("Trying to adc-fetch tthl file(" + entry.OutputFilename + ".tthl) from: '" + source.UserName + "'"); 00635 Console.WriteLine("Trying to adc-fetch tthl for file(" + entry.OutputFilename + ")"); 00636 } 00637 else 00638 { 00639 Console.WriteLine("Trying to fetch tthl for file(" + entry.OutputFilename+") from: '" + source.UserName + "' that doesn't support it"); 00640 } 00641 00642 }
Here is the call graph for this function:
delegate void DCPlusPlus.Peer.HandShakeCompletedEventHandler | ( | Peer | peer | ) |
bool DCPlusPlus.Peer.InterpretCommand | ( | string | received_command | ) | [private] |
internal function to interpret a command received from the remote peer
received_command |
Definition at line 882 of file Peer.cs.
00883 { 00884 int command_end = received_command.IndexOf(" "); 00885 if (command_end == -1) command_end = received_command.Length; 00886 00887 if (command_end != -1) 00888 { 00889 string parameter = ""; 00890 string[] parameters ={ }; 00891 string command = received_command.Substring(1); 00892 if (command_end != received_command.Length) 00893 { 00894 command = received_command.Substring(1, command_end - 1); 00895 parameter = received_command.Substring(command_end + 1); 00896 parameters = parameter.Split(" ".ToCharArray(), StringSplitOptions.RemoveEmptyEntries); 00897 } 00898 //Console.WriteLine("Command: '" + command + "' ,Parameter(" + parameters.Length + "): '" + parameter + "'"); 00899 00900 switch (command) 00901 { 00902 case "Direction": 00903 //Console.WriteLine("Direction command received: " + parameter); 00904 handshake_his_value = int.Parse(parameters[1]); 00905 if (parameters[0] == "Download") //turns arround in terms of our perception of the direction. 00906 his_direction_wish = ConnectionDirection.Upload; 00907 else his_direction_wish = ConnectionDirection.Download; 00908 DecideDirection(); 00909 break; 00910 00911 case "MyNick": 00912 peer_nick = parameters[0]; 00913 //Console.WriteLine("peer nick: "+peer_nick); 00914 //handshake complete 00915 break; 00916 00917 case "Supports": 00918 //Console.WriteLine("Supports command received: " + parameter); 00919 supports = (string[])parameters.Clone(); 00920 break; 00921 00922 case "MaxedOut": 00923 error_code = ErrorCodes.NoFreeSlots; 00924 Disconnect(); 00925 break; 00926 case "Error": 00927 error_code = ErrorCodes.NoErrorYet; 00928 if (parameter == "File not found" || parameter == "File Not Available") 00929 error_code = ErrorCodes.FileNotAvailable; 00930 Disconnect(); 00931 break; 00932 00933 case "GetListLen": 00934 //Console.WriteLine("GetListLen command received: " + parameter); 00935 break; 00936 //TODO check for correct direction ..else skip ,same for startdownload 00937 case "ADCGET": 00938 case "Get": 00939 if (command == "ADCGET") 00940 { 00941 Console.WriteLine("ADCGET command received: " + parameter); 00942 upload_request_filename = parameters[1]; 00943 try 00944 { 00945 upload_offset = long.Parse(parameters[2]); 00946 upload_length = long.Parse(parameters[3]); 00947 } 00948 catch (Exception ex) 00949 { 00950 Console.WriteLine("error parsing offsets: " + ex.Message); 00951 } 00952 } 00953 else if (command == "Get") 00954 { 00955 Console.WriteLine("Get command received: " + parameter); 00956 int offset_start = parameter.LastIndexOf("$"); 00957 if (offset_start == -1) 00958 break; //no offset given skip this request 00959 long offset = 1; 00960 string filename = parameter.Substring(0, offset_start); 00961 try 00962 { 00963 offset = long.Parse(parameter.Substring(offset_start + 1)); 00964 } 00965 catch (Exception ex) 00966 { 00967 Console.WriteLine("error parsing offset: " + ex.Message); 00968 } 00969 upload_request_filename = filename; 00970 upload_offset = offset - 1; //we want to send the first byte too , right ? 00971 upload_length = -1; 00972 } 00973 FileRequestAnswer answer = FileRequestAnswer.FileNotAvailable; 00974 if (upload_request_filename == "MyList.DcLst" || upload_request_filename == "MyList.bz2") 00975 {//not supported right now,maybe never 00976 SendFileNotAvailableError(); 00977 error_code = ErrorCodes.FileNotAvailable; 00978 Disconnect(); 00979 } 00980 else if (upload_request_filename == "files.xml.bz2") 00981 { 00982 if (FileListRequestReceived != null) 00983 answer = FileListRequestReceived(this); 00984 } 00985 else 00986 { 00987 if (FileRequestReceived != null) 00988 answer = FileRequestReceived(this); 00989 } 00990 //give back answer and maybe disconnect if needed or start upload 00991 00992 if (answer == FileRequestAnswer.LetsGo) 00993 { 00994 Console.WriteLine("Ok lets go , upload something."); 00995 if (!StartUpload()) 00996 { 00997 Console.WriteLine("Upload starting failed.Disconnecting..."); 00998 Disconnect(); 00999 } 01000 } 01001 else if (answer == FileRequestAnswer.FileNotAvailable) 01002 { 01003 Console.WriteLine("Sorry file not found replied."); 01004 SendFileNotAvailableError(); 01005 Disconnect(); 01006 } 01007 else if (answer == FileRequestAnswer.NoFreeSlots) 01008 { 01009 Console.WriteLine("Sorry no free slot for you."); 01010 SendMaxedOut(); 01011 Disconnect(); 01012 } 01013 break; 01014 01015 case "Send": 01016 Console.WriteLine("Send command received: " + parameter); 01017 StartUploadTransfer(); 01018 break; 01019 01020 case "ADCSND": 01021 Console.WriteLine("ADCSEND command received: " + parameter); 01022 try 01023 { 01024 long temp_upload_offset = long.Parse(parameters[2]); 01025 long temp_upload_length = long.Parse(parameters[3]); 01026 if (queue_entry.Type == Queue.QueueEntry.EntryType.File && !queue_entry.WantTTHL && (temp_upload_length + temp_upload_offset) != queue_entry.Filesize) Disconnect();//fail safe to secure downloads a bit 01027 if (queue_entry.Type == Queue.QueueEntry.EntryType.FileList) 01028 queue_entry.Filesize = temp_upload_offset + temp_upload_length; 01029 if (queue_entry.Type == Queue.QueueEntry.EntryType.File && queue_entry.WantTTHL) 01030 tthl_size = temp_upload_length; 01031 } 01032 catch (Exception ex) { Console.WriteLine("Error parsing file length: " + ex.Message); } 01033 StartDownloadTransfer(); 01034 return (true); 01035 //break; 01036 01037 01038 case "FileLength": 01039 Console.WriteLine("FileLength command received: " + parameter); 01040 try 01041 { 01042 long filelength = long.Parse(parameters[0]); 01043 if (queue_entry.Type == Queue.QueueEntry.EntryType.File && filelength != queue_entry.Filesize) Disconnect();//fail safe to secure downloads a bit 01044 if (queue_entry.Type == Queue.QueueEntry.EntryType.FileList) 01045 queue_entry.Filesize = filelength; 01046 } 01047 catch (Exception ex) { Console.WriteLine("Error parsing file length: " + ex.Message); } 01048 StartDownloadTransfer(); 01049 break; 01050 01051 case "Key": 01052 //Console.WriteLine("Key command received: " + parameter); 01053 //Random rnd = new Random(); 01054 //SendCommand("Direction","Download "+rnd.Next(49999).ToString()); 01055 //SendCommand("GetListLen"); 01056 01057 /* 01058 try 01059 { 01060 if (HandShakeCompleted != null) 01061 HandShakeCompleted(this); 01062 01063 } 01064 catch (Exception ex) 01065 { 01066 Console.WriteLine("Exception in Handshake Event: " + ex.Message); 01067 } 01068 */ 01069 01070 01071 //SendCommand("Get", "extras series\\Extras - S01E05 [digitaldistractions].avi$1"); 01072 //SendCommand("Get", "MyList.DcLst$1"); 01073 //SendCommand("Get", "files.xml.bz2$1"); 01074 //out_stream = System.IO.File.Create("temp.avi"); 01075 //out_stream = new FileStream("temp.avi", FileMode.Create, FileAccess.Write, System.IO.FileShare.ReadWrite); 01076 //SendCommand("Send"); 01077 break; 01078 01079 case "Lock": 01080 //Console.WriteLine("Lock Command received: " + parameter); 01081 if (parameters.Length > 1) 01082 { 01083 string key = parameters[0]; 01084 //Console.WriteLine("Key: " + key); 01085 if (key.StartsWith("EXTENDEDPROTOCOL")) 01086 { 01087 is_extended_protocol = true; 01088 //Console.WriteLine("Peer is using the dc++ protocol enhancements."); 01089 SendCommand("Supports", "MiniSlots XmlBZList TTHL TTHF ADCGet"); 01090 //SendCommand("Supports", "MiniSlots XmlBZList ADCGet TTHL TTHF GetZBlock ZLIG "); 01091 //SendCommand("Supports", "MiniSlots XmlBZList TTHL TTHF GetZBlock ZLIG "); 01092 //SendCommand("Supports", "BZList TTHL TTHF GetZBlock´ZLIG "); 01093 } 01094 01095 string decoded_key = L2K(key); 01096 Random rnd = new Random(); 01097 handshake_my_value = rnd.Next(32767); 01098 //StartHandShake(); 01099 if (direction == ConnectionDirection.Upload) 01100 SendCommand("Direction", "Upload " + handshake_my_value.ToString()); 01101 else SendCommand("Direction", "Download " + handshake_my_value.ToString()); 01102 01103 DecideDirection(); 01104 01105 //Console.WriteLine("SendingDecoded key: " + decoded_key); 01106 SendCommand("Key", decoded_key); 01107 01108 01109 } 01110 break; 01111 01112 default: 01113 Console.WriteLine("Unknown Command received: " + command + ", Parameter: " + parameter); 01114 break; 01115 } 01116 } 01117 else Console.WriteLine("Error interpreting command: " + received_command); 01118 return (false); 01119 }
int DCPlusPlus.Peer.InterpretReceivedString | ( | string | received_string | ) | [private] |
internal function to interpret the received bytes of a socket
received_string | data read from socket |
Definition at line 856 of file Peer.cs.
Referenced by DCPlusPlus.Peer.OnReceive().
00857 { 00858 //TODO counter possible packet splits in messages 00859 string[] received_strings = received_string.Split("|".ToCharArray(), StringSplitOptions.RemoveEmptyEntries); 00860 int interpreter_pos = 0; 00861 for (int i = 0; i < received_strings.Length; i++) 00862 { 00863 interpreter_pos += received_strings[i].Length + 1; 00864 if (received_strings[i].StartsWith("$")) 00865 { 00866 if (InterpretCommand(received_strings[i])) 00867 return (interpreter_pos); 00868 } 00869 else Console.WriteLine("Received a non command line: " + received_strings[i]); 00870 } 00871 return (-1);//tell the receive handler that we dont want to use any rest bytes from the bytes read in the actual call 00872 00873 }
Here is the caller graph for this function:
void DCPlusPlus.Peer.OnConnect | ( | IAsyncResult | result | ) | [private] |
Definition at line 1262 of file Peer.cs.
01263 { 01264 Socket connect_socket = (Socket)result.AsyncState; 01265 try 01266 { 01267 if (connect_socket.Connected) 01268 { 01269 AsyncCallback event_receive = new AsyncCallback(OnReceive); 01270 receive_buffer = new byte[32768]; 01271 connect_socket.BeginReceive(receive_buffer, 0, receive_buffer.Length, SocketFlags.None, event_receive, connect_socket); 01272 //Console.WriteLine("Successfully connected to peer: " + ip+":"+port); 01273 is_connected = true; 01274 is_connecting = false; 01275 if (Connected != null) 01276 Connected(this); 01277 } 01278 else 01279 { 01280 //Console.WriteLine("Unable to connect to peer"); 01281 error_code = ErrorCodes.UnableToConnect; 01282 Disconnect(); 01283 } 01284 } 01285 catch (Exception ex) 01286 { 01287 Console.WriteLine("Error during connect to peer(exception:" + ex.Message + ")."); 01288 error_code = ErrorCodes.UnableToConnect; 01289 Disconnect(); 01290 } 01291 }
void DCPlusPlus.Peer.OnReceive | ( | IAsyncResult | result | ) | [private] |
Definition at line 313 of file Peer.cs.
References DCPlusPlus.Peer.bytes_already_downloaded, DCPlusPlus.Peer.bytes_downloaded, DCPlusPlus.Peer.Completed, DCPlusPlus.Peer.Disconnect(), DCPlusPlus.Connection.Disconnected, DCPlusPlus.Connection.error_code, DCPlusPlus.Connection.Exception, DCPlusPlus.Peer.first_bytes_received, DCPlusPlus.Peer.InterpretReceivedString(), DCPlusPlus.Peer.is_downloading, DCPlusPlus.Peer.queue_entry, DCPlusPlus.Connection.receive_buffer, DCPlusPlus.Peer.stream, and DCPlusPlus.Peer.WriteDataToFile().
Referenced by DCPlusPlus.Peer.StartReceiving().
00314 { 00315 try 00316 { 00317 Socket receive_socket = (Socket)result.AsyncState; 00318 //Console.WriteLine("Connection socket."); 00319 if (!receive_socket.Connected) 00320 { 00321 //Console.WriteLine("Connection connected."); 00322 if (queue_entry.Filesize > 0 && bytes_downloaded + bytes_already_downloaded == queue_entry.Filesize) 00323 { 00324 if (Completed != null) 00325 Completed(this); 00326 error_code = ErrorCodes.Disconnected; 00327 Disconnect(); 00328 return; 00329 } 00330 if (first_bytes_received)//we need to unclaim our used entry too 00331 queue_entry.UnclaimEntry(); 00332 Console.WriteLine("Connection to peer dropped."); 00333 /*if (Disconnected != null) 00334 Disconnected(this);*/ 00335 error_code = ErrorCodes.Disconnected; 00336 Disconnect(); 00337 return; 00338 } 00339 int received_bytes = receive_socket.EndReceive(result); 00340 if (received_bytes > 0) 00341 { 00342 if (is_downloading) 00343 { 00344 WriteDataToFile(0, received_bytes); 00345 } 00346 else 00347 { 00348 string received_string = System.Text.Encoding.Default.GetString(receive_buffer, 0, received_bytes); 00349 //Console.WriteLine("Received a string: "+received_string); 00350 //interpret string and act accordingly 00351 int bytes_used = InterpretReceivedString(received_string); 00352 if (bytes_used != -1 && bytes_used < received_bytes) 00353 {//we already received some data from the file ... 00354 WriteDataToFile(bytes_used, received_bytes); 00355 } 00356 } 00357 AsyncCallback event_receive = new AsyncCallback(OnReceive); 00358 receive_socket.BeginReceive(receive_buffer, 0, receive_buffer.Length, SocketFlags.None, event_receive, receive_socket); 00359 } 00360 else 00361 { 00362 if (queue_entry.Filesize > 0 && bytes_downloaded + bytes_already_downloaded == queue_entry.Filesize) 00363 { 00364 if (Completed != null) 00365 Completed(this); 00366 error_code = ErrorCodes.Disconnected; 00367 Disconnect(); 00368 return; 00369 } 00370 if (first_bytes_received) //we need to unclaim our used entry too 00371 queue_entry.UnclaimEntry(); 00372 Console.WriteLine("Connection to peer dropped."); 00373 error_code = ErrorCodes.Disconnected; 00374 Disconnect(); 00375 } 00376 } 00377 catch (Exception ex) 00378 { 00379 //Console.WriteLine("Exception during receive of data: " + ex.Message); 00380 if (queue_entry.Filesize > 0 && bytes_downloaded + bytes_already_downloaded == queue_entry.Filesize) 00381 { 00382 if (Completed != null) 00383 Completed(this); 00384 if (stream == null) 00385 stream.Close(); 00386 return; 00387 } 00388 if (first_bytes_received) 00389 queue_entry.UnclaimEntry(); 00390 Console.WriteLine("Error receiving data from Peer: " + ex.Message); 00391 error_code = ErrorCodes.Exception; 00392 Disconnect(); 00393 } 00394 00395 }
Here is the call graph for this function:
Here is the caller graph for this function:
void DCPlusPlus.Peer.SendError | ( | string | message | ) |
Definition at line 655 of file Peer.cs.
References DCPlusPlus.Connection.SendCommand().
Referenced by DCPlusPlus.Peer.SendFileNotAvailableError().
00656 { 00657 SendCommand("Error", message); 00658 }
Here is the call graph for this function:
Here is the caller graph for this function:
void DCPlusPlus.Peer.SendFailed | ( | string | message | ) |
Definition at line 659 of file Peer.cs.
References DCPlusPlus.Connection.SendCommand().
00660 { 00661 SendCommand("Failed", message); 00662 }
Here is the call graph for this function:
void DCPlusPlus.Peer.SendFileNotAvailableError | ( | ) |
Definition at line 649 of file Peer.cs.
References DCPlusPlus.Peer.Disconnect(), DCPlusPlus.Connection.error_code, DCPlusPlus.Connection.NoErrorYet, and DCPlusPlus.Peer.SendError().
Referenced by DCPlusPlus.Peer.StartUpload().
00650 { 00651 SendError("File Not Available"); 00652 error_code = ErrorCodes.NoErrorYet; 00653 Disconnect(); 00654 }
Here is the call graph for this function:
Here is the caller graph for this function:
void DCPlusPlus.Peer.SendMaxedOut | ( | ) |
Definition at line 643 of file Peer.cs.
References DCPlusPlus.Peer.Disconnect(), DCPlusPlus.Connection.error_code, DCPlusPlus.Connection.NoErrorYet, and DCPlusPlus.Connection.SendCommand().
00644 { 00645 SendCommand("MaxedOut"); 00646 error_code = ErrorCodes.NoErrorYet; 00647 Disconnect(); 00648 }
Here is the call graph for this function:
void DCPlusPlus.Peer.StartDownload | ( | string | filename, | |
string | output_filename, | |||
long | output_file_length | |||
) |
Definition at line 836 of file Peer.cs.
00837 { 00838 //this.output_filename = output_filename; 00839 //this.filename = filename; 00840 queue_entry = new Queue.QueueEntry(); 00841 queue_entry.OutputFilename = output_filename; 00842 queue_entry.Filesize = output_file_length; 00843 source = new Queue.QueueEntry.Source(); 00844 source.Filename = filename; 00845 StartDownload(); 00846 }
void DCPlusPlus.Peer.StartDownload | ( | Queue.QueueEntry.Source | source, | |
Queue.QueueEntry | entry | |||
) |
Definition at line 830 of file Peer.cs.
00831 { 00832 this.queue_entry = entry; 00833 this.source = source; 00834 StartDownload(); 00835 }
void DCPlusPlus.Peer.StartDownload | ( | ) |
Definition at line 798 of file Peer.cs.
00799 { 00800 direction = ConnectionDirection.Download; 00801 long start_pos = 1; 00802 if (File.Exists(queue_entry.OutputFilename)) 00803 { 00804 FileInfo fi = new FileInfo(queue_entry.OutputFilename); 00805 if (fi.Length >= queue_entry.Filesize) 00806 {//abort , file is complete or something else may happened here 00807 Disconnect(); 00808 return; 00809 } 00810 start_pos = fi.Length + 1; 00811 bytes_already_downloaded = fi.Length; 00812 stream = new FileStream(queue_entry.OutputFilename, FileMode.Append, FileAccess.Write, System.IO.FileShare.ReadWrite); 00813 } 00814 else start_pos = 1; 00815 00816 if (CheckForExtension("ADCGet")) 00817 { 00818 start_pos = start_pos - 1; 00819 if (CheckForExtension("TTHF") && queue_entry.HasTTH) 00820 SendCommand("ADCGET", "file TTH/" + queue_entry.TTH + " " + start_pos + " " + (queue_entry.Filesize - start_pos)); 00821 else SendCommand("ADCGET", "file " + source.Filename + " " + start_pos + " " + (queue_entry.Filesize - start_pos)); 00822 Console.WriteLine("Trying to adc-fetch file: '" + source.Filename + "' starting from pos:" + start_pos); 00823 } 00824 else 00825 { 00826 SendCommand("Get", source.Filename + "$" + start_pos); 00827 Console.WriteLine("Trying to fetch file: '" + source.Filename + "' starting from pos:" + start_pos); 00828 } 00829 }
void DCPlusPlus.Peer.StartDownloadTransfer | ( | ) |
Definition at line 788 of file Peer.cs.
00789 { 00790 is_downloading = true; 00791 start_tick = System.Environment.TickCount; 00792 bytes_downloaded = 0; 00793 if (!CheckForExtension("ADCGet")) 00794 { 00795 SendCommand("Send"); 00796 } 00797 }
void DCPlusPlus.Peer.StartHandShake | ( | ) |
Definition at line 1187 of file Peer.cs.
01188 { 01189 SendCommand("MyNick", nick); 01190 string key = CreateKey(false); 01191 //Console.WriteLine("sending lock: '"+key+"'"); 01192 SendCommand("Lock", key); 01193 }
void DCPlusPlus.Peer.StartReceiving | ( | ) | [private] |
Definition at line 229 of file Peer.cs.
References DCPlusPlus.Peer.Disconnect(), DCPlusPlus.Connection.Disconnected, DCPlusPlus.Connection.error_code, DCPlusPlus.Connection.Exception, DCPlusPlus.Peer.OnReceive(), DCPlusPlus.Connection.receive_buffer, and DCPlusPlus.Connection.socket.
00230 { 00231 try 00232 { 00233 if (socket.Connected) 00234 { 00235 AsyncCallback event_receive = new AsyncCallback(OnReceive); 00236 receive_buffer = new byte[32768]; 00237 socket.BeginReceive(receive_buffer, 0, receive_buffer.Length, SocketFlags.None, event_receive, socket); 00238 } 00239 else 00240 { 00241 Console.WriteLine("Connection to peer aborted."); 00242 error_code = ErrorCodes.Disconnected; 00243 Disconnect(); 00244 } 00245 00246 } 00247 catch (Exception ex) 00248 { 00249 Console.WriteLine("Error during starting of receiving data from peer: " + ex.Message); 00250 error_code = ErrorCodes.Disconnected; 00251 Disconnect(); 00252 } 00253 00254 }
Here is the call graph for this function:
bool DCPlusPlus.Peer.StartUpload | ( | ) |
Definition at line 663 of file Peer.cs.
References DCPlusPlus.Connection.CheckForExtension(), DCPlusPlus.Peer.direction, DCPlusPlus.Peer.Disconnect(), DCPlusPlus.Connection.Exception, DCPlusPlus.Connection.SendCommand(), DCPlusPlus.Peer.SendFileNotAvailableError(), DCPlusPlus.Peer.StartUploadTransfer(), DCPlusPlus.Peer.stream, DCPlusPlus.Peer.upload_file_list_data, DCPlusPlus.Peer.upload_filename, DCPlusPlus.Peer.upload_length, DCPlusPlus.Peer.upload_offset, and DCPlusPlus.Peer.upload_request_filename.
00664 { 00665 direction = ConnectionDirection.Upload; //TODO enhance Direction handling -> esp uploading if we have nothing to to download from the user 00666 if (!string.IsNullOrEmpty(upload_filename)) 00667 { 00668 if (upload_file_list_data != null) 00669 { 00670 upload_length = upload_file_list_data.Length; 00671 stream = new MemoryStream(upload_file_list_data); 00672 stream.Seek(upload_offset, SeekOrigin.Begin); 00673 } 00674 else 00675 { 00676 if (File.Exists(upload_filename)) 00677 { 00678 FileInfo fi = new FileInfo(upload_filename); 00679 if (fi.Length < upload_offset) 00680 {//abort , file is complete or something else may happened here 00681 Console.WriteLine("error requesting data at offset: " + fi.Length + " after file end: " + upload_offset); 00682 Disconnect(); 00683 return (false); 00684 } 00685 if (fi.Length < upload_offset + upload_length || upload_length == -1) 00686 {//abort , file is complete or something else may happened here 00687 upload_length = fi.Length - upload_offset; 00688 } 00689 //Console.WriteLine("Trying to open file: "+f); 00690 try 00691 { 00692 stream = new FileStream(upload_filename, FileMode.Open, FileAccess.Read, System.IO.FileShare.ReadWrite); 00693 stream.Seek(upload_offset, SeekOrigin.Begin); 00694 } 00695 catch (Exception ex) 00696 { 00697 Console.WriteLine("exception opening file: " + ex.Message); 00698 SendFileNotAvailableError(); 00699 return (false); 00700 } 00701 } 00702 else 00703 { 00704 Console.WriteLine("Requested file not found: " + upload_filename); 00705 SendFileNotAvailableError(); 00706 return (false); 00707 } 00708 } 00709 if (CheckForExtension("ADCGet")) 00710 { 00711 00712 string send_parameters = "file " + upload_request_filename + " " + upload_offset + " " + upload_length; 00713 Console.WriteLine("adc send parameters : " + send_parameters); 00714 SendCommand("ADCSND", send_parameters); 00715 Console.WriteLine("Trying to adc-upload file: '" + upload_filename + "' starting from pos:" + upload_offset + " length: " + upload_length); 00716 StartUploadTransfer(); 00717 } 00718 else 00719 { 00720 SendCommand("FileLength", upload_length.ToString()); 00721 Console.WriteLine("Trying to upload file: '" + upload_filename + "' starting from pos:" + upload_offset + " length: " + upload_length); 00722 } 00723 return (true); 00724 } 00725 return (false); 00726 }
Here is the call graph for this function:
void DCPlusPlus.Peer.StartUploadTransfer | ( | ) |
Definition at line 728 of file Peer.cs.
References DCPlusPlus.Peer.bytes_uploaded, DCPlusPlus.Peer.Disconnect(), DCPlusPlus.Connection.error_code, DCPlusPlus.Connection.Exception, DCPlusPlus.Peer.is_uploading, DCPlusPlus.Connection.socket, DCPlusPlus.Peer.start_tick, DCPlusPlus.Peer.stream, DCPlusPlus.Peer.upload_block_size, DCPlusPlus.Peer.upload_length, DCPlusPlus.Peer.upload_request_filename, and DCPlusPlus.Peer.UploadTransferCallback().
Referenced by DCPlusPlus.Peer.StartUpload().
00729 { 00730 is_uploading = true; 00731 start_tick = System.Environment.TickCount; 00732 bytes_uploaded = 0; 00733 if (socket != null) 00734 { 00735 if (!socket.Connected) return; 00736 try 00737 { 00738 if (upload_length < upload_block_size) upload_block_size = upload_length;//TODO maybe better to change back after upload finished .. if we reuse peers 00739 byte[] send_bytes = new byte[upload_block_size]; 00740 int bytes_read = stream.Read(send_bytes, (int)0, (int)upload_block_size); 00741 Console.WriteLine("Sending the first " + bytes_read + " byte(s) of file: " + upload_request_filename); 00742 socket.BeginSend(send_bytes, 0, bytes_read, SocketFlags.None, new AsyncCallback(UploadTransferCallback), socket); 00743 //socket.BeginSend(upload_file_list_data, 0, upload_file_list_data.Length, SocketFlags.None, new AsyncCallback(UploadTransferCallback), socket); 00744 } 00745 catch (Exception e) 00746 { 00747 Console.WriteLine("Error sending command to peer: " + e.Message); 00748 error_code = ErrorCodes.Exception; 00749 Disconnect(); 00750 } 00751 } 00752 00753 }
Here is the call graph for this function:
Here is the caller graph for this function:
delegate void DCPlusPlus.Peer.UnableToConnectEventHandler | ( | Peer | peer | ) |
void DCPlusPlus.Peer.Ungrab | ( | ) |
void DCPlusPlus.Peer.UploadTransferCallback | ( | IAsyncResult | ar | ) | [protected] |
Definition at line 754 of file Peer.cs.
References DCPlusPlus.Peer.bytes_uploaded, DCPlusPlus.Peer.Disconnect(), DCPlusPlus.Connection.error_code, DCPlusPlus.Connection.NoErrorYet, DCPlusPlus.Connection.socket, DCPlusPlus.Peer.stream, DCPlusPlus.Peer.upload_block_size, and DCPlusPlus.Peer.upload_length.
Referenced by DCPlusPlus.Peer.StartUploadTransfer().
00755 { 00756 Socket upload_data_socket = (Socket)ar.AsyncState; 00757 try 00758 { 00759 int bytes_sent = upload_data_socket.EndSend(ar); 00760 bytes_uploaded += bytes_sent; 00761 if (socket != null) 00762 { 00763 if (bytes_uploaded == upload_length) 00764 { 00765 error_code = ErrorCodes.NoErrorYet; //TODO add some download error_code ..and rename the whole thing to something more intuitive 00766 Disconnect(); 00767 return; 00768 } 00769 if (!socket.Connected) return; 00770 if (upload_length - bytes_uploaded < upload_block_size) upload_block_size = upload_length - bytes_uploaded;//TODO maybe better to change back after upload finished .. if we reuse peers 00771 byte[] send_bytes = new byte[upload_block_size]; 00772 //int bytes_read = stream.Read(send_bytes, (int)upload_offset + (int)bytes_uploaded, (int)upload_block_size); 00773 int bytes_read = stream.Read(send_bytes, 0, (int)upload_block_size); 00774 //Console.WriteLine("Already sent " + bytes_uploaded + " byte(s) of file: " + upload_request_filename); 00775 //bytes_uploaded += bytes_read; 00776 socket.BeginSend(send_bytes, 0, bytes_read, SocketFlags.None, new AsyncCallback(UploadTransferCallback), socket); 00777 //socket.BeginSend(upload_file_list_data, 0, upload_file_list_data.Length, SocketFlags.None, new AsyncCallback(UploadTransferCallback), socket); 00778 } 00779 00780 } 00781 catch (Exception ex) 00782 { 00783 Console.WriteLine("exception during sending of data: " + ex.Message); 00784 error_code = ErrorCodes.Exception; 00785 Disconnect(); 00786 } 00787 }
Here is the call graph for this function:
Here is the caller graph for this function:
void DCPlusPlus.Peer.WriteDataToFile | ( | int | bytes_start, | |
int | bytes_end | |||
) | [private] |
Definition at line 255 of file Peer.cs.
References DCPlusPlus.Peer.bytes_already_downloaded, DCPlusPlus.Peer.bytes_downloaded, DCPlusPlus.Connection.CheckForExtension(), DCPlusPlus.Peer.Completed, DCPlusPlus.Peer.DataReceived, DCPlusPlus.Peer.Disconnect(), DCPlusPlus.Connection.error_code, DCPlusPlus.Peer.first_bytes_received, DCPlusPlus.Connection.NoErrorYet, DCPlusPlus.Peer.queue_entry, DCPlusPlus.Connection.QueueEntryInUse, DCPlusPlus.Connection.receive_buffer, DCPlusPlus.Connection.SendCommand(), DCPlusPlus.Peer.speed, DCPlusPlus.Peer.start_tick, DCPlusPlus.Peer.stream, and DCPlusPlus.Peer.tthl_size.
Referenced by DCPlusPlus.Peer.OnReceive().
00256 { 00257 if (!first_bytes_received) 00258 { 00259 if (queue_entry.TryToClaimEntry(this)) //TODO -> this can be moved to client with an event handler (FirstBytesReceived(this);) 00260 { 00261 first_bytes_received = true; 00262 } 00263 else 00264 { 00265 Console.WriteLine("Queue Entry already in use , disconnecting."); 00266 error_code = ErrorCodes.QueueEntryInUse; 00267 Disconnect(); 00268 } 00269 } 00270 bytes_downloaded += bytes_end - bytes_start; 00271 //TODO quite buggy divide by zero prob 00272 speed = (float)(((float)bytes_downloaded / 1024.0f) / ((float)(System.Environment.TickCount - start_tick) / 1000.0f)); 00273 //Console.WriteLine("Received " + received_bytes + " bytes of data. with a speed of: " + (((System.Environment.TickCount - start_tick) / 1000) / (bytes_downloaded / 1024)) + " KB/s"); 00274 if (stream == null) 00275 {//if we do not append we still have to create the output file 00276 if(queue_entry.WantTTHL) 00277 stream = new FileStream(queue_entry.OutputFilename+".tthl", FileMode.Create, FileAccess.Write, System.IO.FileShare.ReadWrite); 00278 else 00279 stream = new FileStream(queue_entry.OutputFilename, FileMode.Create, FileAccess.Write, System.IO.FileShare.ReadWrite); 00280 } 00281 stream.Write(receive_buffer, bytes_start, bytes_end); 00282 stream.Flush(); 00283 if (DataReceived != null) 00284 DataReceived(this); 00285 if (queue_entry.WantTTHL) 00286 { 00287 if (tthl_size > 0 && bytes_downloaded + bytes_already_downloaded == tthl_size) 00288 { 00289 queue_entry.WantTTHL = false; 00290 queue_entry.UnclaimEntry(); 00291 /*if (Completed != null) 00292 Completed(this);*/ 00293 if (!CheckForExtension("ADCGet")) 00294 SendCommand("Send"); 00295 error_code = ErrorCodes.NoErrorYet; 00296 Disconnect(); 00297 } 00298 } 00299 else 00300 { 00301 if (queue_entry.Filesize > 0 && bytes_downloaded + bytes_already_downloaded == queue_entry.Filesize) 00302 { 00303 if (Completed != null) 00304 Completed(this); 00305 if (!CheckForExtension("ADCGet")) 00306 SendCommand("Send"); 00307 error_code = ErrorCodes.NoErrorYet; 00308 Disconnect(); 00309 } 00310 } 00311 00312 }
Here is the call graph for this function:
Here is the caller graph for this function:
long DCPlusPlus.Peer.bytes_already_downloaded = 0 [protected] |
Definition at line 62 of file Peer.cs.
Referenced by DCPlusPlus.Peer.GetTTHL(), DCPlusPlus.Peer.OnReceive(), and DCPlusPlus.Peer.WriteDataToFile().
long DCPlusPlus.Peer.bytes_already_uploaded = 0 [protected] |
long DCPlusPlus.Peer.bytes_downloaded = 0 [protected] |
Definition at line 70 of file Peer.cs.
Referenced by DCPlusPlus.Peer.OnReceive(), and DCPlusPlus.Peer.WriteDataToFile().
long DCPlusPlus.Peer.bytes_uploaded = 0 [protected] |
Definition at line 86 of file Peer.cs.
Referenced by DCPlusPlus.Peer.StartUploadTransfer(), and DCPlusPlus.Peer.UploadTransferCallback().
event CompletedEventHandler DCPlusPlus.Peer.Completed |
Definition at line 29 of file Peer.cs.
Referenced by DCPlusPlus.Peer.OnReceive(), DCPlusPlus.Client.SetupPeerEventHandler(), and DCPlusPlus.Peer.WriteDataToFile().
event ConnectedEventHandler DCPlusPlus.Peer.Connected |
event DataReceivedEventHandler DCPlusPlus.Peer.DataReceived |
Definition at line 31 of file Peer.cs.
Referenced by DCPlusPlus.Client.SetupPeerEventHandler(), and DCPlusPlus.Peer.WriteDataToFile().
ConnectionDirection DCPlusPlus.Peer.direction = ConnectionDirection.Unknown [protected] |
Definition at line 102 of file Peer.cs.
Referenced by DCPlusPlus.Peer.GetFileList(), DCPlusPlus.Peer.GetTTHL(), and DCPlusPlus.Peer.StartUpload().
event DisconnectedEventHandler DCPlusPlus.Peer.Disconnected |
Reimplemented from DCPlusPlus.Connection.
Definition at line 23 of file Peer.cs.
Referenced by DCPlusPlus.Client.SetupPeerEventHandler().
event FileListRequestReceivedEventHandler DCPlusPlus.Peer.FileListRequestReceived |
event FileRequestReceivedEventHandler DCPlusPlus.Peer.FileRequestReceived |
bool DCPlusPlus.Peer.first_bytes_received = false [private] |
Definition at line 190 of file Peer.cs.
Referenced by DCPlusPlus.Peer.OnReceive(), and DCPlusPlus.Peer.WriteDataToFile().
int DCPlusPlus.Peer.handshake_his_value = 0 [private] |
int DCPlusPlus.Peer.handshake_my_value = 0 [private] |
event HandShakeCompletedEventHandler DCPlusPlus.Peer.HandShakeCompleted |
ConnectionDirection DCPlusPlus.Peer.his_direction_wish = ConnectionDirection.Unknown [private] |
bool DCPlusPlus.Peer.is_downloading = false [protected] |
bool DCPlusPlus.Peer.is_uploading = false [protected] |
string DCPlusPlus.Peer.peer_nick = "unknown" [protected] |
Queue.QueueEntry DCPlusPlus.Peer.queue_entry = new Queue.QueueEntry() [protected] |
Definition at line 126 of file Peer.cs.
Referenced by DCPlusPlus.Peer.GetFileList(), DCPlusPlus.Peer.GetTTHL(), DCPlusPlus.Peer.OnReceive(), and DCPlusPlus.Peer.WriteDataToFile().
Queue.QueueEntry.Source DCPlusPlus.Peer.source = new Queue.QueueEntry.Source() [protected] |
Definition at line 134 of file Peer.cs.
Referenced by DCPlusPlus.Peer.GetFileList(), and DCPlusPlus.Peer.GetTTHL().
float DCPlusPlus.Peer.speed = 0 [protected] |
int DCPlusPlus.Peer.start_tick = 0 [private] |
Definition at line 52 of file Peer.cs.
Referenced by DCPlusPlus.Peer.StartUploadTransfer(), and DCPlusPlus.Peer.WriteDataToFile().
Stream DCPlusPlus.Peer.stream = null [private] |
Definition at line 61 of file Peer.cs.
Referenced by DCPlusPlus.Peer.OnReceive(), DCPlusPlus.Peer.StartUpload(), DCPlusPlus.Peer.StartUploadTransfer(), DCPlusPlus.Peer.UploadTransferCallback(), and DCPlusPlus.Peer.WriteDataToFile().
long DCPlusPlus.Peer.tthl_size = 0 [protected] |
event UnableToConnectEventHandler DCPlusPlus.Peer.UnableToConnect |
long DCPlusPlus.Peer.upload_block_size = 1024 [private] |
Definition at line 727 of file Peer.cs.
Referenced by DCPlusPlus.Peer.StartUploadTransfer(), and DCPlusPlus.Peer.UploadTransferCallback().
byte [] DCPlusPlus.Peer.upload_file_list_data = null [protected] |
string DCPlusPlus.Peer.upload_filename = "" [protected] |
long DCPlusPlus.Peer.upload_length = 0 [protected] |
Definition at line 150 of file Peer.cs.
Referenced by DCPlusPlus.Peer.StartUpload(), DCPlusPlus.Peer.StartUploadTransfer(), and DCPlusPlus.Peer.UploadTransferCallback().
long DCPlusPlus.Peer.upload_offset = 0 [protected] |
string DCPlusPlus.Peer.upload_request_filename = "" [protected] |
Definition at line 158 of file Peer.cs.
Referenced by DCPlusPlus.Peer.StartUpload(), and DCPlusPlus.Peer.StartUploadTransfer().
ConnectionDirection DCPlusPlus.Peer.Direction [get] |
string DCPlusPlus.Peer.PeerNick [get, set] |
Queue.QueueEntry DCPlusPlus.Peer.QueueEntry [get] |
Queue.QueueEntry.Source DCPlusPlus.Peer.Source [get] |
byte [] DCPlusPlus.Peer.UploadFileListData [get, set] |
string DCPlusPlus.Peer.UploadFilename [get, set] |
string DCPlusPlus.Peer.UploadRequestFilename [get] |