Changeset 66
- Timestamp:
- 09/16/06 13:21:59 (2 years ago)
- Files:
-
- trunk/overhaul_handler.js (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/overhaul_handler.js
r61 r66 10 10 11 11 12 function overhaul_handler(clientHostArray, clientPortArray, url , filename, chunks_held, md5_list ){12 function overhaul_handler(clientHostArray, clientPortArray, url , filename, chunks_held, md5_list,numChunk){ 13 13 var self = this; 14 14 15 15 // counter for the raw datas 16 var i;16 var countChunk; 17 17 18 18 //raw data(unmodified) and GROBAL … … 29 29 30 30 //loop until all of the data get 31 for( i=0;i<numChunk;i++){32 if(chunks_held[ i]!=null){33 receivedDataArray[ i]=chunks_held[i];31 for(countChunk=0;countChunk<numChunk;countChunk++){ 32 if(chunks_held[countChunk]!=null){ 33 receivedDataArray[countChunk]=chunks_held[countChunk]; 34 34 break; 35 35 } … … 38 38 var host=null; 39 39 var port=null; 40 var k=040 var thrdDimChunk=0 41 41 42 while((host==null)|| k<2){ //while loop begins42 while((host==null)||thrdDimChunk<2){ //while loop begins 43 43 //get available host from the bottom 44 var j=availableList.size()-1;45 for(; j>=0;j--){46 if(availableList[ j][i]==1){47 host=clientHostArray[ j];48 port=clientPortArray[ j];44 var sndDimChunk=availableList.size()-1; 45 for(;sndDimChunk>=0;sndDimChunk--){ 46 if(availableList[sndDimChunk][countChunk]==1){ 47 host=clientHostArray[sndDimChunk]; 48 port=clientPortArray[sndDimChunk]; 49 49 break; 50 50 } … … 53 53 availableList=overhaul_info(clientHostArray,clientPortArray); 54 54 } 55 k++;55 thrdDimChunk++; 56 56 }//while loop ends 57 57 … … 108 108 109 109 var finalVal = ""; 110 var i;111 for( i=0;receivedDataArray.size();i++){112 finalVal += receivedDataArray[ i];110 var cntRcvdAry; 111 for(cntRcvdAry=0;receivedDataArray.size();cntRcvdAry++){ 112 finalVal += receivedDataArray[cntRcvdAry]; 113 113 } 114 114 window._content.document.write(finalVal); … … 129 129 .createInstance(Components.interfaces.nsIScriptableInputStream); 130 130 sinput.init(inputStream); 131 receivedDataArray[ i]+= sinput.read(count);131 receivedDataArray[countChunk]+= sinput.read(count); 132 132 } 133 133 };
