You can subscribe to this list here.
| 2002 |
Jan
|
Feb
|
Mar
|
Apr
(173) |
May
(55) |
Jun
(73) |
Jul
(25) |
Aug
(1) |
Sep
(11) |
Oct
(38) |
Nov
(66) |
Dec
(17) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2003 |
Jan
(23) |
Feb
(2) |
Mar
(23) |
Apr
(35) |
May
(16) |
Jun
(3) |
Jul
(2) |
Aug
(2) |
Sep
(14) |
Oct
(6) |
Nov
(9) |
Dec
(7) |
| 2004 |
Jan
(5) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(2) |
Aug
(17) |
Sep
|
Oct
|
Nov
|
Dec
|
| 2006 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(10) |
Jul
|
Aug
|
Sep
(2) |
Oct
|
Nov
|
Dec
|
| 2007 |
Jan
(5) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: Max Z. <ma...@us...> - 2007-01-09 16:14:22
|
Update of /cvsroot/mutella/mutella/mutella In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv17378/mutella Modified Files: dir.cpp Log Message: removed the annoying output in scandir Index: dir.cpp =================================================================== RCS file: /cvsroot/mutella/mutella/mutella/dir.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** dir.cpp 7 Jan 2007 15:06:31 -0000 1.9 --- dir.cpp 9 Jan 2007 16:14:13 -0000 1.10 *************** *** 125,129 **** // de.Path = path + "/" + de.Name; // TODO: clean path - cout << "entry:" << de.Name << endl; struct stat st; if (0==stat(de.Path.c_str(), &st)) --- 125,128 ---- |
|
From: Max Z. <ma...@us...> - 2007-01-09 16:12:01
|
Update of /cvsroot/mutella/mutella/mutella In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv16183/mutella Modified Files: gnudownload.cpp Log Message: a small bugfix in downloads Index: gnudownload.cpp =================================================================== RCS file: /cvsroot/mutella/mutella/mutella/gnudownload.cpp,v retrieving revision 1.80 retrieving revision 1.81 diff -C2 -d -r1.80 -r1.81 *** gnudownload.cpp 7 Jan 2007 15:06:31 -0000 1.80 --- gnudownload.cpp 9 Jan 2007 16:11:57 -0000 1.81 *************** *** 750,756 **** return true; } ! if (m_nPartSize <= 16384) { ! m_pDownload->OnSetStartPoint(pDownloader, 0); return true; } --- 750,756 ---- return true; } ! if (m_nPartSize <= 4096) { ! m_pDownload->OnSetStartPoint(pDownloader, m_nFragmentOffset); return true; } |
Update of /cvsroot/mutella/mutella/mutella In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv20604 Modified Files: asyncfile.cpp common.cpp dir.cpp dir.h gnudownload.cpp gnushare.cpp gnuupload.cpp Log Message: some success in partial fragment support Index: asyncfile.cpp =================================================================== RCS file: /cvsroot/mutella/mutella/mutella/asyncfile.cpp,v retrieving revision 1.36 retrieving revision 1.37 diff -C2 -d -r1.36 -r1.37 *** asyncfile.cpp 23 Jun 2006 08:48:00 -0000 1.36 --- asyncfile.cpp 7 Jan 2007 15:06:31 -0000 1.37 *************** *** 306,310 **** if (state.hFile < 0 && (pRequest->mode & AFM_CREATEPATH)) { ! // my be we still can fix this little problem if (CheckAndCreatePath(state.sPath)) { --- 306,310 ---- if (state.hFile < 0 && (pRequest->mode & AFM_CREATEPATH)) { ! // may be we still can fix this little problem if (CheckAndCreatePath(state.sPath)) { *************** *** 706,709 **** --- 706,710 ---- ASSERT(szName); ASSERT(strlen(szName)<65536); + cout << "MAsyncFile::Open " << szName << endl; // MAFRequest* pReq = new MAFRequest; Index: common.cpp =================================================================== RCS file: /cvsroot/mutella/mutella/mutella/common.cpp,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -d -r1.37 -r1.38 *** common.cpp 29 Jul 2004 13:05:26 -0000 1.37 --- common.cpp 7 Jan 2007 15:06:31 -0000 1.38 *************** *** 947,950 **** --- 947,952 ---- { Name.make_lower(); + if (Name[0]!='\r'||Name[0]!='\n') + Name="\r\n"+Name; int keyPos = sLowHahdshake.find(Name); if (keyPos >= 0) Index: dir.cpp =================================================================== RCS file: /cvsroot/mutella/mutella/mutella/dir.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** dir.cpp 12 Jun 2002 20:51:20 -0000 1.8 --- dir.cpp 7 Jan 2007 15:06:31 -0000 1.9 *************** *** 98,102 **** } ! bool ScanDir( DirEntryVec& result, const CString &path, const CString &nameFilter, int typeFilter, int sortSpec ) { DIR *dir; --- 98,102 ---- } ! bool ScanDir( DirEntryVec& result, const CString &path, const CString &nameFilter, bool bMultyPattern, int typeFilter ) { DIR *dir; *************** *** 125,128 **** --- 125,129 ---- // de.Path = path + "/" + de.Name; // TODO: clean path + cout << "entry:" << de.Name << endl; struct stat st; if (0==stat(de.Path.c_str(), &st)) *************** *** 146,150 **** { // we should not match directories ! if ( (de.Type & DirEntry::dir) || MultiPatternMatch(de.Name, nameFilter, false)) res.push_back(de); } --- 147,153 ---- { // we should not match directories ! if ( (de.Type & DirEntry::dir) || ! ((!bMultyPattern || MultiPatternMatch(de.Name, nameFilter, false)) && ! (bMultyPattern || SinglePatternMatch(de.Name.c_str(), nameFilter.c_str(), false)))) res.push_back(de); } Index: dir.h =================================================================== RCS file: /cvsroot/mutella/mutella/mutella/dir.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** dir.h 30 Apr 2002 14:53:44 -0000 1.5 --- dir.h 7 Jan 2007 15:06:31 -0000 1.6 *************** *** 86,90 **** bool ScanDir( DirEntryVec& result, const CString &path, ! const CString &nameFilter, int typeFilter = DirEntry::regular, int sortSpec = SORT_NONE); #endif //_DIR_H_INCLUDED_ --- 86,90 ---- bool ScanDir( DirEntryVec& result, const CString &path, ! const CString &nameFilter, bool bMultyPattern = true, int typeFilter = DirEntry::regular); #endif //_DIR_H_INCLUDED_ Index: gnudownload.cpp =================================================================== RCS file: /cvsroot/mutella/mutella/mutella/gnudownload.cpp,v retrieving revision 1.79 retrieving revision 1.80 diff -C2 -d -r1.79 -r1.80 *** gnudownload.cpp 5 Jan 2007 17:48:46 -0000 1.79 --- gnudownload.cpp 7 Jan 2007 15:06:31 -0000 1.80 *************** *** 133,138 **** { DirEntryVec partials; ! CString sPattern = m_sName+".[[*"+DWrdtoStr(m_nSize)+"]]"; ! if (ScanDir(partials, m_sPath, sPattern, DirEntry::regular)) pRequest->file_state.nReturn = 0; else --- 133,139 ---- { DirEntryVec partials; ! CString sPattern = m_sName+".[["+DWrdtoStr(m_nSize)+"*]]"; ! cout << "scandir "<<m_sPath<<" with a pattern "<<sPattern<<endl; ! if (ScanDir(partials, m_sPath, sPattern, false)) pRequest->file_state.nReturn = 0; else *************** *** 141,144 **** --- 142,146 ---- m_vecNames.resize(partials.size()); m_vecSizes.resize(partials.size()); + cout << "scandir returned " << partials.size() << endl; for(int i=0; i<partials.size();++i) { *************** *** 258,262 **** bool RequestStartPoint(MDownloader* pDownloader); void OnDisconnect(MDownloader* pDownloader); ! bool NeedMoreSockets(){return m_pActiveDownloader==NULL;} // int GetSizeCompleted(){return m_nPartSize + m_nFragmentOffset;} --- 260,264 ---- bool RequestStartPoint(MDownloader* pDownloader); void OnDisconnect(MDownloader* pDownloader); ! bool NeedMoreSockets(){return m_nState==DMS_Opened && m_pActiveDownloader==NULL;} // int GetSizeCompleted(){return m_nPartSize + m_nFragmentOffset;} *************** *** 379,383 **** void MDownloadFile::OnSuccessDelayed(DWORD dwSeqReqID, int nReqType, const SAFileState& FileState) { ! //TRACE2("MDownloadFile::OnSuccess; request=", m_pRequest->type_compl); SRequestStatus rs; rs.bSuccess = true; --- 381,385 ---- void MDownloadFile::OnSuccessDelayed(DWORD dwSeqReqID, int nReqType, const SAFileState& FileState) { ! //TRACE2("MDownloadFile::OnSuccess; request=", nReqType); SRequestStatus rs; rs.bSuccess = true; *************** *** 395,399 **** void MDownloadFile::OnErrorDelayed(DWORD dwSeqReqID, int nReqType, const SAFileState& FileState) { ! //TRACE2("MDownloadFile::OnError; request=", m_pRequest->type_compl); SRequestStatus rs; rs.bSuccess = false; --- 397,401 ---- void MDownloadFile::OnErrorDelayed(DWORD dwSeqReqID, int nReqType, const SAFileState& FileState) { ! //TRACE2("MDownloadFile::OnError; request=", nReqType); SRequestStatus rs; rs.bSuccess = false; *************** *** 452,457 **** { case AFR_CUSTOM: ASSERT(m_pScanRequest!=NULL); - ASSERT(m_nState == DMS_Scanning); // TODO: here check whether there is only one fragment and decode the offset. don't forget to update the partial name m_nFragmentOffset = 0; --- 454,460 ---- { case AFR_CUSTOM: + if (m_nState != DMS_Scanning) + break; ASSERT(m_pScanRequest!=NULL); // TODO: here check whether there is only one fragment and decode the offset. don't forget to update the partial name m_nFragmentOffset = 0; *************** *** 464,475 **** TRACE("MDownFileMng::OnFileEvent() extracted '" << sBR << "' as size/pos parameter of " << m_pScanRequest->m_vecNames[0] << endl ); // see if there is a separator? ! int nSepPos=sBR.find('.'); if (nSepPos>0) { // got it! ! m_nFragmentOffset = atol(sBR.substr(0,nSepPos-1).c_str()); ! ASSERT(m_nFileSize==atol(sBR.substr(nSepPos+1).c_str())); ! m_sPartPath = m_pScanRequest->m_vecNames[0]; TRACE("MDownFileMng::OnFileEvent() extracted '" << m_nFragmentOffset << "' as offset parameter of " << m_pScanRequest->m_vecNames[0] << endl ); } } --- 467,479 ---- TRACE("MDownFileMng::OnFileEvent() extracted '" << sBR << "' as size/pos parameter of " << m_pScanRequest->m_vecNames[0] << endl ); // see if there is a separator? ! int nSepPos=sBR.find('+'); if (nSepPos>0) { // got it! ! m_nFragmentOffset = atol(sBR.substr(nSepPos+1).c_str()); TRACE("MDownFileMng::OnFileEvent() extracted '" << m_nFragmentOffset << "' as offset parameter of " << m_pScanRequest->m_vecNames[0] << endl ); + TRACE("m_nFileSize="<<m_nFileSize<<" from name:"<<sBR.substr(0,nSepPos)); + ASSERT(m_nFileSize==atol(sBR.substr(0,nSepPos).c_str())); + m_sPartPath = m_sPartDirPath + "/" + m_pScanRequest->m_vecNames[0]; } } *************** *** 480,486 **** // so file is open -- we are ready to operate m_nPartSize = rs.nFileSize; m_pDownload->OnFileManReady(); // check if we possibly completed the file ! if (rs.nFileSize==m_nFileSize) { // request file move and so on --- 484,492 ---- // so file is open -- we are ready to operate m_nPartSize = rs.nFileSize; + TRACE("OnFileOpen: m_nPartSize="<<m_nPartSize); + m_nState=DMS_Opened; m_pDownload->OnFileManReady(); // check if we possibly completed the file ! if (rs.nFileSize+m_nFragmentOffset==m_nFileSize) { // request file move and so on *************** *** 533,537 **** m_mapPos.erase(itm); // check if we possibly completed the file ! if (rs.nFileSize>=m_nFileSize) { if (rs.nFileSize>m_nFileSize) --- 539,543 ---- m_mapPos.erase(itm); // check if we possibly completed the file ! if (rs.nFileSize+m_nFragmentOffset>=m_nFileSize) { if (rs.nFileSize>m_nFileSize) *************** *** 555,559 **** while (m_listStartRequesters.size()) { ! m_pDownload->OnSetStartPoint(m_listStartRequesters.front(), m_nOverlapPos); m_listStartRequesters.pop_front(); } --- 561,565 ---- while (m_listStartRequesters.size()) { ! m_pDownload->OnSetStartPoint(m_listStartRequesters.front(), m_nOverlapPos+m_nFragmentOffset); m_listStartRequesters.pop_front(); } *************** *** 561,564 **** --- 567,571 ---- case AFR_CLOSE: m_pDownload->OnFileManClosed(); + m_nState = DMS_Closed; break; case AFR_NONE: *************** *** 641,644 **** --- 648,652 ---- // assert(IsOpen) // assert(!BufInSet) + //TRACE("MDownFileMng::StoreDataAt() nPos1=" <<nPos1 <<" m_nFragmentOffset="<<m_nFragmentOffset); int nPos0 = nPos1 - m_nFragmentOffset; ASSERT(nPos0>=0); *************** *** 733,736 **** --- 741,745 ---- bool MDownFileMng::RequestStartPoint(MDownloader* pDownloader) { + ASSERT(m_nState==DMS_Opened); // in the current incarnation just read the verify buffer // if its not read already *************** *** 738,742 **** { ASSERT(m_pOverlapBuff); ! m_pDownload->OnSetStartPoint(pDownloader, m_nOverlapPos); return true; } --- 747,751 ---- { ASSERT(m_pOverlapBuff); ! m_pDownload->OnSetStartPoint(pDownloader, m_nOverlapPos+m_nFragmentOffset); return true; } *************** *** 893,897 **** void MDownloader::ForceDisconnect(int nReason, int nStatus) { ! cout << "ForceDisconnect for " << Ip2Str(m_result.Host) << " m_nStatus=" << m_nStatus << " nReason=" << nReason << " nStatus=" << nStatus << endl ; #warning Update Error Counters here! (and remove it from the other places) // update error counters --- 902,906 ---- void MDownloader::ForceDisconnect(int nReason, int nStatus) { ! TRACE( "ForceDisconnect for " << Ip2Str(m_result.Host) << " m_nStatus=" << m_nStatus << " nReason=" << nReason << " nStatus=" << nStatus ); #warning Update Error Counters here! (and remove it from the other places) // update error counters *************** *** 989,992 **** --- 998,1002 ---- void MDownloader::Initiate() { + TRACE("MDownloader::Initiate"); // call Connect or request push // Attempt to connect *************** *** 1028,1031 **** --- 1038,1042 ---- void MDownloader::Enqueue() { + TRACE("MDownloader::Enqueue"); ASSERT(m_hSocket == INVALID_SOCKET || m_bKeepAlive); // not connected or keep-alive SetStatus(TRANSFER_QUEUED); *************** *** 1136,1139 **** --- 1147,1151 ---- void MDownloader::StoreStoreBuff() { + //TRACE("MDownloader::StoreStoreBuff()"); StoreResult sr = m_pDownload->StoreDataAt(this, m_nFilePos, m_pStoreBuff, m_pStoreBuff->contains()); if (SR_Success != sr) *************** *** 1756,1762 **** //if ((*itd)->GetStatusChangeTime()+m_pPrefs->m_nRetryWait>=nTimeStamp) // break; - case TRANSFER_NEW: //if (!m_pDirector->IsDownloadHostBusy((*itd)->GetHostIP(), (*itd)->GetResult().Name)) ! (*itd)->Enqueue(); } } --- 1768,1774 ---- //if ((*itd)->GetStatusChangeTime()+m_pPrefs->m_nRetryWait>=nTimeStamp) // break; //if (!m_pDirector->IsDownloadHostBusy((*itd)->GetHostIP(), (*itd)->GetResult().Name)) ! case TRANSFER_NEW: ! (*itd)->Enqueue(); } } Index: gnushare.cpp =================================================================== RCS file: /cvsroot/mutella/mutella/mutella/gnushare.cpp,v retrieving revision 1.41 retrieving revision 1.42 diff -C2 -d -r1.41 -r1.42 *** gnushare.cpp 27 May 2003 09:01:29 -0000 1.41 --- gnushare.cpp 7 Jan 2007 15:06:31 -0000 1.42 *************** *** 304,308 **** { DirEntryVec files; ! if (!ScanDir(files, FullPath, m_pShare->m_pDirector->GetPrefs()->m_szShareFilter, DirEntry::regular|DirEntry::dir)) { // TODO: messageID --- 304,308 ---- { DirEntryVec files; ! if (!ScanDir(files, FullPath, m_pShare->m_pDirector->GetPrefs()->m_szShareFilter, true, DirEntry::regular|DirEntry::dir)) { // TODO: messageID Index: gnuupload.cpp =================================================================== RCS file: /cvsroot/mutella/mutella/mutella/gnuupload.cpp,v retrieving revision 1.45 retrieving revision 1.46 diff -C2 -d -r1.45 -r1.46 *** gnuupload.cpp 29 Jul 2004 13:05:26 -0000 1.45 --- gnuupload.cpp 7 Jan 2007 15:06:31 -0000 1.46 *************** *** 159,166 **** m_bBufferReady = false; ! if(m_pPrefs->m_dBandwidthTotal > 0) ! m_dMaxRate = 0; ! else ! m_dMaxRate = -1; m_nSecNum = 0; --- 159,164 ---- m_bBufferReady = false; ! if(m_pPrefs->m_dBandwidthTotal > 0 || m_pPrefs->m_dBandwidthTransfer>0) ! m_dMaxRate = max(m_pPrefs->m_dBandwidthTotal/2,m_pPrefs->m_dBandwidthTransfer); m_nSecNum = 0; *************** *** 618,622 **** --- 616,622 ---- // Range header m_nBytesCompleted = 0; + //cout<<"sHandshake="<<sHandshake<<endl; CString sRange = find_header("Range",sHandshake,sLowHandshake); + //cout<<"sRange="<<sRange<<endl; if(!sRange.empty()) { *************** *** 980,983 **** --- 980,984 ---- m_nBytesCompleted += nBytesSentNow; // limit bandwidth + //TRACE( << "m_dMaxRate=" << m_dMaxRate << " m_dwSecBytes="<<m_dwSecBytes); if (m_dMaxRate>0 && m_dwSecBytes>m_dMaxRate && m_bBelowRateLimit) { |
|
From: Max Z. <ma...@us...> - 2007-01-05 17:48:51
|
Update of /cvsroot/mutella/mutella/mutella In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv16446 Modified Files: controller.cpp gnudirector.cpp gnudirector.h gnudownload.cpp Log Message: first steps in partial fragment support Index: controller.cpp =================================================================== RCS file: /cvsroot/mutella/mutella/mutella/controller.cpp,v retrieving revision 1.62 retrieving revision 1.63 diff -C2 -d -r1.62 -r1.63 *** controller.cpp 19 Aug 2004 09:34:07 -0000 1.62 --- controller.cpp 5 Jan 2007 17:48:46 -0000 1.63 *************** *** 430,434 **** { CString sComplPath; ! m_pDirector->BuildDownloadPaths(name, nSize, NULL, &sComplPath, NULL); if (MoveFile(path, sComplPath)) { --- 430,434 ---- { CString sComplPath; ! m_pDirector->BuildDownloadPaths(name, nSize, NULL, &sComplPath, NULL, NULL); if (MoveFile(path, sComplPath)) { Index: gnudirector.cpp =================================================================== RCS file: /cvsroot/mutella/mutella/mutella/gnudirector.cpp,v retrieving revision 1.110 retrieving revision 1.111 diff -C2 -d -r1.110 -r1.111 *** gnudirector.cpp 8 Sep 2006 11:27:57 -0000 1.110 --- gnudirector.cpp 5 Jan 2007 17:48:46 -0000 1.111 *************** *** 1307,1312 **** pSearch->GetSizeFilterMode() == LIMIT_EXACTLY ) { CString sPartPath; ! BuildDownloadPaths(pSearch->GetFilename(), pSearch->GetSizeFilterValue(), NULL, NULL, &sPartPath); if (!IsDownloading(sPartPath)) { --- 1307,1313 ---- pSearch->GetSizeFilterMode() == LIMIT_EXACTLY ) { + CString sPartDir; CString sPartPath; ! BuildDownloadPaths(pSearch->GetFilename(), pSearch->GetSizeFilterValue(), NULL, NULL, &sPartDir, &sPartPath); if (!IsDownloading(sPartPath)) { *************** *** 1354,1358 **** } ! void MGnuDirector::BuildDownloadPaths(CString sFileName, int nFileSize, CString* psFileName, CString* psFilePath, CString* psPartPath) { ReplaceSubStr(sFileName,"\\", "/"); --- 1355,1359 ---- } ! void MGnuDirector::BuildDownloadPaths(CString sFileName, int nFileSize, CString* psFileName, CString* psFilePath, CString* psPartDirPath, CString* psPartFileName) { ReplaceSubStr(sFileName,"\\", "/"); *************** *** 1375,1384 **** } // Add tail to it so we can support partial downloads ! if (psPartPath) { sFileName += ".[[" + DWrdtoStr(nFileSize) + "]]"; // put the file to the partial directory ! *psPartPath = ExpandPath(m_pPrefs->m_szDownloadPath) + "/part" + "/" + sFileName; ! ReplaceSubStr(*psPartPath, "//", "/"); } } --- 1376,1387 ---- } // Add tail to it so we can support partial downloads ! if (psPartFileName && psPartDirPath) { sFileName += ".[[" + DWrdtoStr(nFileSize) + "]]"; // put the file to the partial directory ! *psPartDirPath = ExpandPath(m_pPrefs->m_szDownloadPath) + "/part"; ! ReplaceSubStr(*psPartDirPath, "//", "/"); ! *psPartFileName = *psPartDirPath + "/" + sFileName; ! ReplaceSubStr(*psPartFileName, "//", "/"); } } Index: gnudirector.h =================================================================== RCS file: /cvsroot/mutella/mutella/mutella/gnudirector.h,v retrieving revision 1.45 retrieving revision 1.46 diff -C2 -d -r1.45 -r1.46 *** gnudirector.h 8 Sep 2006 11:27:57 -0000 1.45 --- gnudirector.h 5 Jan 2007 17:48:46 -0000 1.46 *************** *** 267,271 **** MGnuDownload* LookUpDownload(IP ipHost, CString FileName, int Index); bool OnIncomingPush(const CString& sFileName, int nIndex, SOCKET hPushSock); // should return 'true' if socket was attached ! void BuildDownloadPaths(CString sName, int nFileSize, CString* psFileName, CString* psFilePath, CString* psPartPath); bool IsDownloading(const CString& sPartPath); --- 267,271 ---- MGnuDownload* LookUpDownload(IP ipHost, CString FileName, int Index); bool OnIncomingPush(const CString& sFileName, int nIndex, SOCKET hPushSock); // should return 'true' if socket was attached ! void BuildDownloadPaths(CString sName, int nFileSize, CString* psFileName, CString* psFilePath, CString* psPartDirPath, CString* psPartFileName); bool IsDownloading(const CString& sPartPath); Index: gnudownload.cpp =================================================================== RCS file: /cvsroot/mutella/mutella/mutella/gnudownload.cpp,v retrieving revision 1.78 retrieving revision 1.79 diff -C2 -d -r1.78 -r1.79 *** gnudownload.cpp 8 Sep 2006 11:27:57 -0000 1.78 --- gnudownload.cpp 5 Jan 2007 17:48:46 -0000 1.79 *************** *** 34,37 **** --- 34,39 ---- #include "event.h" + #include "dir.h" + #include "gnudirector.h" #include "gnusearch.h" *************** *** 124,127 **** --- 126,183 ---- }; + class MRequestScanPart : public MCustomAFRequest + { + public: + MRequestScanPart(const CString& path, const CString& name, int nSize) : m_sPath(path), m_sName(name), m_nSize(nSize) {} + virtual bool Do(MAFRequest* pRequest) + { + DirEntryVec partials; + CString sPattern = m_sName+".[[*"+DWrdtoStr(m_nSize)+"]]"; + if (ScanDir(partials, m_sPath, sPattern, DirEntry::regular)) + pRequest->file_state.nReturn = 0; + else + pRequest->file_state.nReturn = 1; + // + m_vecNames.resize(partials.size()); + m_vecSizes.resize(partials.size()); + for(int i=0; i<partials.size();++i) + { + m_vecNames[i] = partials[i].Name; + m_vecSizes[i] = partials[i].Size; + } + // TODO: process the return... + + /*if(pRequest->file_state.nReturn) + { + POST_EVENT( MStringEvent( + ET_ERROR, + ES_IMPORTANT, + CString("filename=`") + m_pathOld + "' error: " + strerror(errno), + MSG_DOWNLOAD_FILE_MOVE_FAILED, + MSGSRC_DOWNLOAD + )); + } + else + { + POST_EVENT( MEvFileMoved( + path, + pRequest->file_state.nSize + )); + }*/ + return pRequest->file_state.nReturn == 0; + } + void Predict(SAFileState& state) + { + // this does not really change the file + } + // "return" value + vector<CString> m_vecNames; + vector<size_t> m_vecSizes; + private: + CString m_sPath; + CString m_sName; + int m_nSize; + }; + class MDownloadBuffer : public MAFBufferTrivial { *************** *** 180,183 **** --- 236,240 ---- enum DownManState{ DMS_New, + DMS_Scanning, DMS_Opening, DMS_Opened, *************** *** 203,207 **** bool NeedMoreSockets(){return m_pActiveDownloader==NULL;} // ! int GetSizeCompleted(){return m_nPartSize;} // const CString& GetName(){return m_sName;} --- 260,264 ---- bool NeedMoreSockets(){return m_pActiveDownloader==NULL;} // ! int GetSizeCompleted(){return m_nPartSize + m_nFragmentOffset;} // const CString& GetName(){return m_sName;} *************** *** 216,220 **** --- 273,279 ---- CString m_sPath; CString m_sPartPath; + CString m_sPartDirPath; int m_nFileSize; + int m_nFragmentOffset; // state int m_nState; *************** *** 233,236 **** --- 292,297 ---- // one file for now MDownloadFile* m_pFile; + // scan request + TSmartPtr<MRequestScanPart> m_pScanRequest; // void SetPaths(const CString& newName, int nFileSize); *************** *** 358,361 **** --- 419,423 ---- ASSERT(m_pFile); m_nFileSize = 0; + m_nFragmentOffset = 0; m_nPartSize = 0; m_nPartSizeQueued = 0; *************** *** 389,392 **** --- 451,480 ---- switch (rs.nRequestType) { + case AFR_CUSTOM: + ASSERT(m_pScanRequest!=NULL); + ASSERT(m_nState == DMS_Scanning); + // TODO: here check whether there is only one fragment and decode the offset. don't forget to update the partial name + m_nFragmentOffset = 0; + if (m_pScanRequest->m_vecNames.size()>0) + { + ASSERT(m_pScanRequest->m_vecNames.size()==1); + // extract the part of the name in brackets + CString sBR = m_pScanRequest->m_vecNames[0].substr(m_pScanRequest->m_vecNames[0].rfind("[[")+2); + sBR.cut(sBR.rfind("]]")); + TRACE("MDownFileMng::OnFileEvent() extracted '" << sBR << "' as size/pos parameter of " << m_pScanRequest->m_vecNames[0] << endl ); + // see if there is a separator? + int nSepPos=sBR.find('.'); + if (nSepPos>0) + { + // got it! + m_nFragmentOffset = atol(sBR.substr(0,nSepPos-1).c_str()); + ASSERT(m_nFileSize==atol(sBR.substr(nSepPos+1).c_str())); + m_sPartPath = m_pScanRequest->m_vecNames[0]; + TRACE("MDownFileMng::OnFileEvent() extracted '" << m_nFragmentOffset << "' as offset parameter of " << m_pScanRequest->m_vecNames[0] << endl ); + } + } + m_nState = DMS_Opening; + VERIFY(m_pFile->Open(m_sPartPath.c_str())); // non-blocking call should never fail + break; case AFR_OPEN: // so file is open -- we are ready to operate *************** *** 441,445 **** } // ! m_pDownload->OnDataWritten(itm->second.pD, itm->second.nRequestedPos, itm->second.nRequestedSize, itm->second.pB); itm->second.pB->Release(); m_mapPos.erase(itm); --- 529,533 ---- } // ! m_pDownload->OnDataWritten(itm->second.pD, itm->second.nRequestedPos+m_nFragmentOffset, itm->second.nRequestedSize, itm->second.pB); itm->second.pB->Release(); m_mapPos.erase(itm); *************** *** 483,487 **** void MDownFileMng::SetPaths(const CString& sName, int nFileSize) { ! m_pDownload->GetDirector()->BuildDownloadPaths(sName,nFileSize,&m_sName,&m_sPath,&m_sPartPath); m_nFileSize = nFileSize; } --- 571,575 ---- void MDownFileMng::SetPaths(const CString& sName, int nFileSize) { ! m_pDownload->GetDirector()->BuildDownloadPaths(sName,nFileSize,&m_sName,&m_sPath,&m_sPartDirPath,&m_sPartPath); m_nFileSize = nFileSize; } *************** *** 493,500 **** // generate partial file name etc SetPaths(sName, nFileSize); // open file ! m_nState == DMS_Opening; // ! VERIFY(m_pFile->Open(m_sPartPath.c_str())); // non-blocking call should never fail } --- 581,594 ---- // generate partial file name etc SetPaths(sName, nFileSize); + m_nState = DMS_Scanning; + // request a directory scan + m_pScanRequest = new MRequestScanPart(m_sPartDirPath,m_sName,m_nFileSize); + ASSERT(m_pScanRequest != NULL); + m_pFile->CustomRequest(m_pScanRequest); + /* // open file ! m_nState = DMS_Opening; // ! VERIFY(m_pFile->Open(m_sPartPath.c_str())); // non-blocking call should never fail*/ } *************** *** 503,507 **** // assert(IsClosed) // Close file ! m_nState == DMS_Closing; // if (m_pFile->IsOpen()) --- 597,601 ---- // assert(IsClosed) // Close file ! m_nState = DMS_Closing; // if (m_pFile->IsOpen()) *************** *** 540,544 **** } ! StoreResult MDownFileMng::StoreDataAt(MDownloader* pDownloader, int nPos0, MDownloadBuffer* pBuff, int nSize0) { if (m_pActiveDownloader && --- 634,638 ---- } ! StoreResult MDownFileMng::StoreDataAt(MDownloader* pDownloader, int nPos1, MDownloadBuffer* pBuff, int nSize0) { if (m_pActiveDownloader && *************** *** 547,550 **** --- 641,646 ---- // assert(IsOpen) // assert(!BufInSet) + int nPos0 = nPos1 - m_nFragmentOffset; + ASSERT(nPos0>=0); int nPos = nPos0; int nSize = nSize0; *************** *** 561,565 **** { // we have to "simulate" callback ! m_pDownload->OnDataWritten(pDownloader, nPos0, nSize0, pBuff); return SR_Success; } --- 657,661 ---- { // we have to "simulate" callback ! m_pDownload->OnDataWritten(pDownloader, nPos1, nSize0, pBuff); return SR_Success; } |
|
From: Max Z. <ma...@us...> - 2007-01-05 10:49:22
|
Update of /cvsroot/mutella/mutella/mutella In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv23949 Modified Files: gnucache.cpp gnucache.h gnunode.cpp Log Message: some works on blacklisting Index: gnucache.cpp =================================================================== RCS file: /cvsroot/mutella/mutella/mutella/gnucache.cpp,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** gnucache.cpp 17 Nov 2002 14:22:24 -0000 1.20 --- gnucache.cpp 5 Jan 2007 10:49:17 -0000 1.21 *************** *** 36,39 **** --- 36,41 ---- #include "common.h" #include "conversions.h" + #include "property.h" + #include "preferences.h" ////////////////////////////////////////////////////////////////////// *************** *** 44,47 **** --- 46,50 ---- { m_pDirector = pCntr; + m_pPrefs = m_pDirector->GetPrefs(); } *************** *** 54,57 **** --- 57,64 ---- if( node.Port > 0 ) { + // blacklist support + if (m_pPrefs->m_bBlackListActive && m_pPrefs->m_ipnetsetBlackList.IsIn(node.Host)) + return; + // MLock lock(m_mutex); if (CheckIfNotRecent(node.Host) && *************** *** 177,180 **** --- 184,191 ---- void MGnuCache::Add(const Node& node) { + // blacklist support + if (m_pPrefs->m_bBlackListActive && m_pPrefs->m_ipnetsetBlackList.IsIn(node.Host)) + return; + // MLock lock(m_mutex); for(list<Node>::iterator itNode = m_listCache.begin(); itNode != m_listCache.end(); itNode++) Index: gnucache.h =================================================================== RCS file: /cvsroot/mutella/mutella/mutella/gnucache.h,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** gnucache.h 4 Nov 2002 10:57:49 -0000 1.9 --- gnucache.h 5 Jan 2007 10:49:17 -0000 1.10 *************** *** 25,28 **** --- 25,29 ---- class MGnuDirector; + struct MGnuPreferences; class MGnuCache *************** *** 55,58 **** --- 56,60 ---- // MGnuDirector* m_pDirector; + MGnuPreferences* m_pPrefs; private: MGnuCache(); // no implementation Index: gnunode.cpp =================================================================== RCS file: /cvsroot/mutella/mutella/mutella/gnunode.cpp,v retrieving revision 1.84 retrieving revision 1.85 diff -C2 -d -r1.84 -r1.85 *** gnunode.cpp 13 Jun 2006 14:42:10 -0000 1.84 --- gnunode.cpp 5 Jan 2007 10:49:17 -0000 1.85 *************** *** 1111,1115 **** if (type == PACKET_PONG && ((packet_Header*)(itPacket->Packet))->TTL <= 1) { ! TRACE2("MGnuNode::SendPacket() : canceling drop for a packet with TTL %d", ((packet_Header*)(itPacket->Packet))->TTL); break; } --- 1111,1115 ---- if (type == PACKET_PONG && ((packet_Header*)(itPacket->Packet))->TTL <= 1) { ! TRACE2("MGnuNode::SendPacket() : canceling drop for a packet with TTL ", ((packet_Header*)(itPacket->Packet))->TTL); break; } |
|
From: Max Z. <ma...@us...> - 2006-09-08 11:30:28
|
Update of /cvsroot/mutella/mutella/share/remote/template/modules In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv5699/share/remote/template/modules Modified Files: connections.html results-detail.html results-ungrouped-body.html Log Message: added few small features to the remote ui Index: connections.html =================================================================== RCS file: /cvsroot/mutella/mutella/share/remote/template/modules/connections.html,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** connections.html 17 Nov 2002 14:01:47 -0000 1.12 --- connections.html 8 Sep 2006 11:30:24 -0000 1.13 *************** *** 15,19 **** <!-- ForEachConnStart --> <tr> ! <td align="left" class="data-#LOOPMOD2#"><a href="message?CMD=close&id=#NODEID#"><img border="0" alt="stop" width="16" height="16" align="absmiddle" src="#REMOTEROOT#/images/stop-16x16.gif"></a> #NODEIP#:#NODEPORT#</td> <td align="center" class="data-#LOOPMOD2#">#NODEMODE#</td> <td align="center" class="data-#LOOPMOD2#">#NODECLI#</td> --- 15,19 ---- <!-- ForEachConnStart --> <tr> ! <td align="left" class="data-#LOOPMOD2#"><a href="message?CMD=close&id=#NODEID#"><img border="0" alt="stop" width="16" height="16" align="absmiddle" src="#REMOTEROOT#/images/stop-16x16.gif"></a> #NODEIP#:#NODEPORT# <a href="#REMOTEROOT#/message?CMD=setadd&BlackList=#NODEIP#">bl</a></td> <td align="center" class="data-#LOOPMOD2#">#NODEMODE#</td> <td align="center" class="data-#LOOPMOD2#">#NODECLI#</td> Index: results-detail.html =================================================================== RCS file: /cvsroot/mutella/mutella/share/remote/template/modules/results-detail.html,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** results-detail.html 7 Mar 2003 21:49:41 -0000 1.2 --- results-detail.html 8 Sep 2006 11:30:24 -0000 1.3 *************** *** 4,8 **** <!-- ForEachResultStart --> <tr valign="middle"> ! <td colspan="2" class="data-small" align="left">#RESHOSTIP#:#RESHOSTPORT#</td> <td class="data-small" align="center" NOBR>#RESVENDOR#</td> <td class="data-small" align="center" NOBR>#RESTIME#</td> --- 4,8 ---- <!-- ForEachResultStart --> <tr valign="middle"> ! <td colspan="2" class="data-small" align="left">#RESHOSTIP#:#RESHOSTPORT# <a href="#REMOTEROOT#/message?CMD=setadd&BlackList=#RESHOSTIP#">bl</a></td> <td class="data-small" align="center" NOBR>#RESVENDOR#</td> <td class="data-small" align="center" NOBR>#RESTIME#</td> Index: results-ungrouped-body.html =================================================================== RCS file: /cvsroot/mutella/mutella/share/remote/template/modules/results-ungrouped-body.html,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** results-ungrouped-body.html 7 Mar 2003 21:49:41 -0000 1.2 --- results-ungrouped-body.html 8 Sep 2006 11:30:24 -0000 1.3 *************** *** 9,13 **** </tr> <tr valign="middle"> ! <td class="data-small-#LOOPMOD2#" align="left">#RESHOSTIP#:#RESHOSTPORT#</td> <td class="data-small-#LOOPMOD2#" align="center" NOBR>#RESVENDOR#</td> <td class="data-small-#LOOPMOD2#" align="center" NOBR>#RESTIME#</td> --- 9,13 ---- </tr> <tr valign="middle"> ! <td class="data-small-#LOOPMOD2#" align="left">#RESHOSTIP#:#RESHOSTPORT# <a href="#REMOTEROOT#/message?CMD=setadd&BlackList=#RESHOSTIP#">bl</a></td> <td class="data-small-#LOOPMOD2#" align="center" NOBR>#RESVENDOR#</td> <td class="data-small-#LOOPMOD2#" align="center" NOBR>#RESTIME#</td> |
Update of /cvsroot/mutella/mutella/mutella In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv4449 Modified Files: basicstruct.h gnudirector.cpp gnudirector.h gnudownload.cpp gnudownload.h gnusock.cpp Log Message: added/debugged some remote queuing support, still too much of the debugging output Index: basicstruct.h =================================================================== RCS file: /cvsroot/mutella/mutella/mutella/basicstruct.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** basicstruct.h 8 Nov 2002 20:18:30 -0000 1.4 --- basicstruct.h 8 Sep 2006 11:27:57 -0000 1.5 *************** *** 65,75 **** bool IsSubnetInSubnet(const IPNET& subnet1, const IPNET& subnet2); - struct HOST // IP : Port pair - { - IP ip; - u_short port; - // constructors - HOST(const IP& _ip, u_short _port) : ip(_ip), port(_port) {} - }; inline bool operator==(const IP& ip1, const IP& ip2){return ip1.S_addr==ip2.S_addr;} --- 65,68 ---- *************** *** 79,83 **** bool operator<(const IPNET& ipn1, const IPNET& ipn2); bool operator>(const IPNET& ipn1, const IPNET& ipn2); ! inline bool operator==(const HOST& h1, const HOST& h2){return h1.ip.S_addr==h2.ip.S_addr && h1.port==h2.port;} #endif /* __basicstruct_h__ */ --- 72,92 ---- bool operator<(const IPNET& ipn1, const IPNET& ipn2); bool operator>(const IPNET& ipn1, const IPNET& ipn2); ! ! struct HOST // IP : Port pair ! { ! IP ip; ! u_short port; ! // constructors ! HOST(const IP& _ip, u_short _port) : ip(_ip), port(_port) {} ! // operators ! inline bool operator<(const HOST& rhs) const { ! if (ip<rhs.ip) return true; ! if (ip==rhs.ip && port<rhs.port) return true; ! return false; ! } ! inline bool operator==(const HOST& rhs) const { ! return (ip.S_addr==rhs.ip.S_addr && port==rhs.port); ! } ! }; #endif /* __basicstruct_h__ */ Index: gnudirector.cpp =================================================================== RCS file: /cvsroot/mutella/mutella/mutella/gnudirector.cpp,v retrieving revision 1.109 retrieving revision 1.110 diff -C2 -d -r1.109 -r1.110 *** gnudirector.cpp 14 Jun 2006 22:52:19 -0000 1.109 --- gnudirector.cpp 8 Sep 2006 11:27:57 -0000 1.110 *************** *** 859,862 **** --- 859,863 ---- nCount += p->CountActiveConnections(&from); } + //cout << "CountActiveDownloads from " << Ip2Str(from.ip) << " retuns " << nCount << endl; return nCount; } *************** *** 1766,1770 **** // download queuing: expire old busy hosts ! for (map <IP, BusyHost>::iterator itBH = m_mapBusyHosts.begin(); itBH != m_mapBusyHosts.end(); ) { if (itBH->second.nNextValidTime <= nTimeStamp) --- 1767,1771 ---- // download queuing: expire old busy hosts ! for (map <HOST, BusyHost>::iterator itBH = m_mapBusyHosts.begin(); itBH != m_mapBusyHosts.end(); ) { if (itBH->second.nNextValidTime <= nTimeStamp) *************** *** 1773,1777 **** { // remove element ! map <IP, BusyHost>::iterator itRemove = itBH; ++itBH; m_mapBusyHosts.erase(itRemove); --- 1774,1778 ---- { // remove element ! map <HOST, BusyHost>::iterator itRemove = itBH; ++itBH; m_mapBusyHosts.erase(itRemove); *************** *** 1780,1783 **** --- 1781,1786 ---- ++itBH; } + // reset the download queue + m_setQueuedDownloads.clear(); // limit m_pPrefs->m_nRetryWait from below if (m_pPrefs->m_nRetryWait < 3) *************** *** 2224,2227 **** --- 2227,2278 ---- // broadcast TIMER message to the world ED().PostEvent(new MIntEvent(ET_MESSAGE, ES_MINIMAL, nTimeStamp, MSG_TIMER)); + + // process the qownload queue + int nDownloadsToInitiate = m_setQueuedDownloads.size(); + if (m_pPrefs->m_nMaxDownloads >0) + nDownloadsToInitiate = m_pPrefs->m_nMaxDownloads - CountActiveDownloads(); + //if (!m_setQueuedDownloads.empty()) cout << "Queued downloads: " << m_setQueuedDownloads.size() << " ; will initiate max of " << nDownloadsToInitiate << endl; + map<HOST, int> mapPerHostLimits; + while (!m_setQueuedDownloads.empty() && nDownloadsToInitiate>0) + { + HOST host = m_setQueuedDownloads.begin()->host; + // check if the per-host limit applies to the host... + map<HOST, int>::iterator itphl = mapPerHostLimits.find(host); + if (itphl == mapPerHostLimits.end()) + { + map <HOST, BusyHost>::iterator itbh = m_mapBusyHosts.find(host); + if (itbh == m_mapBusyHosts.end()) + mapPerHostLimits[host] = m_pPrefs->m_nMaxPerHostDownloads>0 ? m_pPrefs->m_nMaxPerHostDownloads : -1; + else + mapPerHostLimits[host] = itbh->second.nConnLimit>0 ? itbh->second.nConnLimit : (m_pPrefs->m_nMaxPerHostDownloads>0 ? m_pPrefs->m_nMaxPerHostDownloads : -1); + itphl = mapPerHostLimits.find(host); + if (itphl->second>0) + { + itphl->second -= CountActiveDownloads(host, NULL); + if (itphl->second < 0 ) + itphl->second = 0; + if (/*is-busy*/ itbh != m_mapBusyHosts.end() && itbh->second.nNextValidTime!=0) + itphl->second = 0; + } + } + if (itphl->second!=0) + { + //find download, call initiate for the downloader + m_listmutex.lock(); + for(int i = 0; i < m_DownloadList.size(); i++) + { + MGnuDownload *p = m_DownloadList[i]; + if(p == m_setQueuedDownloads.begin()->pDownload) + { + p->InitiateDownloader(m_setQueuedDownloads.begin()->pDownloader); + if (itphl->second>0) --(itphl->second); + --nDownloadsToInitiate; + break; + } + } + m_listmutex.unlock(); + } + m_setQueuedDownloads.erase(m_setQueuedDownloads.begin()); + } } *************** *** 2993,2997 **** } ! void MGnuDirector::OnDownloadHostBusy(const IP& ip, int nNextValidTime) { BusyHost bh; --- 3044,3048 ---- } ! void MGnuDirector::OnDownloadHostBusy(const HOST& host, int nNextValidTime) { BusyHost bh; *************** *** 3000,3011 **** bh.nQueuePosition = -1; bh.nQueueLength = -1; ! if (IsDownloadHostBusy(ip)) ! TRACE2("looks like we are hammering at host ", Ip2Str(ip)); ! m_mapBusyHosts[ip] = bh; } ! void MGnuDirector::OnDownloadHostBusy(const IP& ip, int nNextValidTime, int nQueuePosition, int nQueueLength, const CString& sFileName, const CString& sVendor) { BusyHost bh; --- 3051,3063 ---- bh.nQueuePosition = -1; bh.nQueueLength = -1; + bh.nConnLimit = -1; ! if (IsDownloadHostBusy(host)) ! TRACE2("looks like we are hammering at host ", Ip2Str(host.ip)); ! m_mapBusyHosts[host] = bh; } ! void MGnuDirector::OnDownloadHostBusy(const HOST& host, int nNextValidTime, int nQueuePosition, int nQueueLength, int nConnLimit, const CString& sFileName, const CString& sVendor) { BusyHost bh; *************** *** 3014,3037 **** bh.nQueuePosition = nQueuePosition; bh.nQueueLength = nQueueLength; bh.sFileName = sFileName; bh.sVendor = sVendor; ! if (IsDownloadHostBusy(ip, sFileName)) ! TRACE2("looks like we are hammering at host ", Ip2Str(ip)); ! m_mapBusyHosts[ip] = bh; } ! bool MGnuDirector::IsDownloadHostBusy(const IP& ip) { ! map <IP, BusyHost>::iterator it = m_mapBusyHosts.find(ip); if (it == m_mapBusyHosts.end()) return false; return true; } ! bool MGnuDirector::IsDownloadHostBusy(const IP& ip, const CString& sName) { ! map <IP, BusyHost>::iterator it = m_mapBusyHosts.find(ip); if (it == m_mapBusyHosts.end()) return false; --- 3066,3092 ---- bh.nQueuePosition = nQueuePosition; bh.nQueueLength = nQueueLength; + bh.nConnLimit = nConnLimit; bh.sFileName = sFileName; bh.sVendor = sVendor; ! if (IsDownloadHostBusy(host, sFileName)) ! TRACE2("looks like we are hammering at host ", Ip2Str(host.ip)); ! m_mapBusyHosts[host] = bh; } ! bool MGnuDirector::IsDownloadHostBusy(const HOST& host) { ! map <HOST, BusyHost>::iterator it = m_mapBusyHosts.find(host); if (it == m_mapBusyHosts.end()) return false; + if (it->second.nNextValidTime==0) + return false; return true; } ! bool MGnuDirector::IsDownloadHostBusy(const HOST& host, const CString& sName) { ! map <HOST, BusyHost>::iterator it = m_mapBusyHosts.find(host); if (it == m_mapBusyHosts.end()) return false; *************** *** 3040,3041 **** --- 3095,3102 ---- return true; } + + void MGnuDirector::EnqueDownloadHost(const HOST& host, bool bConnected, int nQueuePosition, DWORD dwBytesRemain, void* pDownload, void* pDownloader) + { + QueuedDownloadHost qdh(host, bConnected, nQueuePosition, dwBytesRemain, pDownload, pDownloader); + m_setQueuedDownloads.insert(qdh); + } Index: gnudirector.h =================================================================== RCS file: /cvsroot/mutella/mutella/mutella/gnudirector.h,v retrieving revision 1.44 retrieving revision 1.45 diff -C2 -d -r1.44 -r1.45 *** gnudirector.h 14 Jun 2006 22:22:47 -0000 1.44 --- gnudirector.h 8 Sep 2006 11:27:57 -0000 1.45 *************** *** 61,68 **** --- 61,92 ---- int nQueuePosition; int nQueueLength; + int nConnLimit; CString sFileName; CString sVendor; }; + struct QueuedDownloadHost { + bool bConnected; + int nQueuePosition; + DWORD dwBytesRemain; + void* pDownload; + void* pDownloader; + HOST host; + // + QueuedDownloadHost(const HOST& h, bool bConn, int nQueuePos, DWORD dwBytesRem, void* pD, void* pDD) : + host(h), bConnected(bConn), nQueuePosition(nQueuePos), dwBytesRemain(dwBytesRem), pDownload(pD), pDownloader(pDD) {} + bool operator<(const QueuedDownloadHost& rhs) const { + if (bConnected && !rhs.bConnected) + return true; + if (!bConnected && rhs.bConnected) + return false; + if (nQueuePosition < rhs.nQueuePosition) + return true; + if (nQueuePosition > rhs.nQueuePosition) + return false; + return (dwBytesRemain < rhs.dwBytesRemain); + } + }; + class MGnuDirector : public MAsyncSocket { *************** *** 112,119 **** bool RemoveTransferByID(DWORD dwID, bool bDelPart); // download queuing ! void OnDownloadHostBusy(const IP& ip, int nNextValidTime); ! void OnDownloadHostBusy(const IP& ip, int nNextValidTime, int nQueuePosition, int nQueueLength, const CString& sFileName, const CString& sVendor); ! bool IsDownloadHostBusy(const IP& ip); ! bool IsDownloadHostBusy(const IP& ip, const CString& sName); // void OnQueryHit(packet_QueryHit* pHit, MGnuNode* pOrigin, bool bOur); --- 136,144 ---- bool RemoveTransferByID(DWORD dwID, bool bDelPart); // download queuing ! void OnDownloadHostBusy(const HOST& host, int nNextValidTime); ! void OnDownloadHostBusy(const HOST& host, int nNextValidTime, int nQueuePosition, int nQueueLength, int nConnLimit, const CString& sFileName, const CString& sVendor); ! bool IsDownloadHostBusy(const HOST& host); ! bool IsDownloadHostBusy(const HOST& host, const CString& sName); ! void EnqueDownloadHost(const HOST& host, bool bConnected, int nQueuePosition, DWORD dwBytesRemain, void* pDownload, void* pDownloader); // void OnQueryHit(packet_QueryHit* pHit, MGnuNode* pOrigin, bool bOur); *************** *** 321,325 **** int m_nLastConnCount; // download queuing ! map <IP, BusyHost> m_mapBusyHosts; public: // Hash tables are thread safe, nothing bad should happen to them --- 346,351 ---- int m_nLastConnCount; // download queuing ! map <HOST, BusyHost> m_mapBusyHosts; ! set<QueuedDownloadHost> m_setQueuedDownloads; public: // Hash tables are thread safe, nothing bad should happen to them Index: gnudownload.cpp =================================================================== RCS file: /cvsroot/mutella/mutella/mutella/gnudownload.cpp,v retrieving revision 1.77 retrieving revision 1.78 diff -C2 -d -r1.77 -r1.78 *** gnudownload.cpp 19 Jun 2006 15:23:30 -0000 1.77 --- gnudownload.cpp 8 Sep 2006 11:27:57 -0000 1.78 *************** *** 711,715 **** case TRANSFER_QUEUED: //check if its time for us to start { ! bool Ready = true; if (pPrefs->m_nMaxDownloads >0 && m_pDirector->CountActiveDownloads() >= pPrefs->m_nMaxDownloads || pPrefs->m_nMaxPerHostDownloads >0 && m_pDirector->CountActiveDownloads(HOST(m_result.Host, m_result.Port), NULL) >= pPrefs->m_nMaxPerHostDownloads) --- 711,719 ---- case TRANSFER_QUEUED: //check if its time for us to start { ! //if (!m_pDirector->IsDownloadHostBusy(GetHostIP())) ! m_pDirector->EnqueDownloadHost(HOST(m_result.Host, m_result.Port), m_hSocket != INVALID_SOCKET, m_nQueuePosition, m_result.Size-m_nFilePos, m_pDownload, this); ! // TODO: come up with a priority mechanism (e.g. first come the ones with the best remote queue position, ! // then the ones with least remaining bytes, etc...) ! /*bool Ready = true; if (pPrefs->m_nMaxDownloads >0 && m_pDirector->CountActiveDownloads() >= pPrefs->m_nMaxDownloads || pPrefs->m_nMaxPerHostDownloads >0 && m_pDirector->CountActiveDownloads(HOST(m_result.Host, m_result.Port), NULL) >= pPrefs->m_nMaxPerHostDownloads) *************** *** 718,722 **** { Initiate(); ! } } break; --- 722,726 ---- { Initiate(); ! }*/ } break; *************** *** 793,796 **** --- 797,801 ---- void MDownloader::ForceDisconnect(int nReason, int nStatus) { + cout << "ForceDisconnect for " << Ip2Str(m_result.Host) << " m_nStatus=" << m_nStatus << " nReason=" << nReason << " nStatus=" << nStatus << endl ; #warning Update Error Counters here! (and remove it from the other places) // update error counters *************** *** 806,811 **** // this will delay retrying on the ip-by-ip basis // IP is not the best ID for pushes, but still should work somehow... ! if (!m_pDirector->IsDownloadHostBusy(GetHostIP())) ! m_pDirector->OnDownloadHostBusy(GetHostIP(), xtime() + m_pDirector->GetPrefs()->m_nRetryWait); // lets check if we have not-yet-stored data in the receive buffer --- 811,816 ---- // this will delay retrying on the ip-by-ip basis // IP is not the best ID for pushes, but still should work somehow... ! if (!m_pDirector->IsDownloadHostBusy(HOST(m_result.Host, m_result.Port))) ! m_pDirector->OnDownloadHostBusy(HOST(m_result.Host, m_result.Port), xtime() + m_pDirector->GetPrefs()->m_nRetryWait); // lets check if we have not-yet-stored data in the receive buffer *************** *** 892,896 **** if(m_hSocket == INVALID_SOCKET) { ! TRACE2("creating a new socket for ", Ip2Str(m_result.Host)); if(!Create(0, SOCK_STREAM, FD_READ|FD_CONNECT|FD_CLOSE)) { --- 897,901 ---- if(m_hSocket == INVALID_SOCKET) { ! TRACE4("status=", m_nStatus," creating a new socket for ", Ip2Str(m_result.Host)); if(!Create(0, SOCK_STREAM, FD_READ|FD_CONNECT|FD_CLOSE)) { *************** *** 1312,1315 **** --- 1317,1321 ---- // parse queuing header int nPollMin = -1; + int nConnLimit = -1; CString sQueue = find_header("x-queue",sHeader,sHeader); if (!sQueue.empty()) *************** *** 1325,1342 **** it = mapValues.find("length"); if (it != mapValues.end()) m_nQueueLength = max(m_nQueueLength, (int) atol(it->second.c_str())); } ! else { TRACE2("X-Queue does not seem to be supported by ", m_result.Vendor); cout << "header:\n" << sHeader << endl; ! } if (nPollMin > 0) { // X-Queue support seem to imply KeepAlive... m_bKeepAlive = true; ! m_pDirector->OnDownloadHostBusy(GetHostIP(), xtime() + nPollMin + 1, m_nQueuePosition, m_nQueueLength, m_result.Name, m_result.Vendor); } else ! m_pDirector->OnDownloadHostBusy(GetHostIP(), xtime() + m_pDirector->GetPrefs()->m_nRetryWait); // do not drop the connection if keep-alive --- 1331,1350 ---- it = mapValues.find("length"); if (it != mapValues.end()) m_nQueueLength = max(m_nQueueLength, (int) atol(it->second.c_str())); + it = mapValues.find("limit"); + if (it != mapValues.end()) nConnLimit = atol(it->second.c_str()); } ! /*else { TRACE2("X-Queue does not seem to be supported by ", m_result.Vendor); cout << "header:\n" << sHeader << endl; ! }*/ if (nPollMin > 0) { // X-Queue support seem to imply KeepAlive... m_bKeepAlive = true; ! m_pDirector->OnDownloadHostBusy(HOST(m_result.Host, m_result.Port), xtime() + nPollMin + 1, m_nQueuePosition, m_nQueueLength, nConnLimit, m_result.Name, m_result.Vendor); } else ! m_pDirector->OnDownloadHostBusy(HOST(m_result.Host, m_result.Port), xtime() + m_pDirector->GetPrefs()->m_nRetryWait); // do not drop the connection if keep-alive *************** *** 1577,1580 **** --- 1585,1600 ---- } + void MGnuDownload::InitiateDownloader(void* pDownloader) + { + MLock lock(m_mutex); + int nCount = 0; + for (vector<MDownloader*>::iterator itd = m_vecDownloaders.begin(); itd != m_vecDownloaders.end(); ++itd) + if (*itd==pDownloader) + { + (*itd)->Initiate(); + break; + } + } + void MGnuDownload::SetRatePerSocket(long nKbytesPerSec) { *************** *** 1641,1645 **** // break; case TRANSFER_NEW: ! if (!m_pDirector->IsDownloadHostBusy((*itd)->GetHostIP(), (*itd)->GetResult().Name)) (*itd)->Enqueue(); } --- 1661,1665 ---- // break; case TRANSFER_NEW: ! //if (!m_pDirector->IsDownloadHostBusy((*itd)->GetHostIP(), (*itd)->GetResult().Name)) (*itd)->Enqueue(); } *************** *** 1972,1976 **** for (vector<MDownloader*>::iterator it = m_vecDownloaders.begin(); it != m_vecDownloaders.end(); ++it) { ! (*it)->Initiate(); // calls "Connect" or requests push } } --- 1992,1996 ---- for (vector<MDownloader*>::iterator it = m_vecDownloaders.begin(); it != m_vecDownloaders.end(); ++it) { ! (*it)->Enqueue(); //Initiate(); // calls "Connect" or requests push } } Index: gnudownload.h =================================================================== RCS file: /cvsroot/mutella/mutella/mutella/gnudownload.h,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** gnudownload.h 19 Aug 2004 09:34:07 -0000 1.21 --- gnudownload.h 8 Sep 2006 11:27:57 -0000 1.22 *************** *** 112,115 **** --- 112,117 ---- // callbacks from MDownloader void OnDisconnect(MDownloader* pDownloader); // called by MDownloader when it disconnects being in TRANSFER_RECEIVING status + // queuing support + void InitiateDownloader(void* pDownloader); protected: void SetStatus(int nNewStatus); Index: gnusock.cpp =================================================================== RCS file: /cvsroot/mutella/mutella/mutella/gnusock.cpp,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** gnusock.cpp 8 Apr 2003 13:50:29 -0000 1.30 --- gnusock.cpp 8 Sep 2006 11:27:57 -0000 1.31 *************** *** 188,191 **** --- 188,198 ---- GetPeerName(sHost, nPort); Str2Ip(sHost, ipHost); + + // blacklist + if (m_pPrefs->m_bBlackListActive && m_pPrefs->m_ipnetsetBlackList.IsIn(ipHost)) + { + ForceDisconnect(); + return; + } ////////////////// // New Connection |
|
From: Max Z. <ma...@us...> - 2006-06-23 08:48:04
|
Update of /cvsroot/mutella/mutella/mutella In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv22760 Modified Files: asyncfile.cpp Log Message: some fiddling around Index: asyncfile.cpp =================================================================== RCS file: /cvsroot/mutella/mutella/mutella/asyncfile.cpp,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -d -r1.35 -r1.36 *** asyncfile.cpp 18 Sep 2003 08:39:10 -0000 1.35 --- asyncfile.cpp 23 Jun 2006 08:48:00 -0000 1.36 *************** *** 267,270 **** --- 267,271 ---- { // the state is wrong -- some of the previous requests failed! + TRACE2("MAFThread: predicted file state is wrong, going to crash... request=", pRequest->type); ASSERT(0); // call on error |
|
From: Max Z. <ma...@us...> - 2006-06-19 15:23:34
|
Update of /cvsroot/mutella/mutella/mutella In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv19606 Modified Files: gnudownload.cpp Log Message: some little modifications Index: gnudownload.cpp =================================================================== RCS file: /cvsroot/mutella/mutella/mutella/gnudownload.cpp,v retrieving revision 1.76 retrieving revision 1.77 diff -C2 -d -r1.76 -r1.77 *** gnudownload.cpp 14 Jun 2006 22:22:47 -0000 1.76 --- gnudownload.cpp 19 Jun 2006 15:23:30 -0000 1.77 *************** *** 891,894 **** --- 891,896 ---- // Attempt to connect if(m_hSocket == INVALID_SOCKET) + { + TRACE2("creating a new socket for ", Ip2Str(m_result.Host)); if(!Create(0, SOCK_STREAM, FD_READ|FD_CONNECT|FD_CLOSE)) { *************** *** 897,921 **** return; } ! SetStatus(TRANSFER_CONNECTING); ! SetLastError(0); ! bool bOkForConnect = m_nConErrors<3 && m_pDirector->IsOkForDirectConnect(m_result.Host); ! if(!bOkForConnect || !Connect(Ip2Str(m_result.Host).c_str(), m_result.Port)) ! { ! if(!bOkForConnect || (GetLastError() != EWOULDBLOCK && GetLastError() != EINPROGRESS && GetLastError() != EAGAIN) ) { ! SetStatus(TRANSFER_PUSH); ! if (!m_pDirector->Route_LocalPush(m_result)) { ! // there wont be a response ! ForceDisconnect(REASON_NO_RESPONSE, m_nPushTimeouts>=20 ? TRANSFER_CLOSED : TRANSFER_FAILED); } - Close(); } } } void MDownloader::Enqueue() { ! ASSERT(m_hSocket == INVALID_SOCKET); // not connected SetStatus(TRANSFER_QUEUED); } --- 899,931 ---- return; } ! SetStatus(TRANSFER_CONNECTING); ! SetLastError(0); ! bool bOkForConnect = m_nConErrors<3 && m_pDirector->IsOkForDirectConnect(m_result.Host); ! if(!bOkForConnect || !Connect(Ip2Str(m_result.Host).c_str(), m_result.Port)) { ! if(!bOkForConnect || (GetLastError() != EWOULDBLOCK && GetLastError() != EINPROGRESS && GetLastError() != EAGAIN) ) { ! SetStatus(TRANSFER_PUSH); ! if (!m_pDirector->Route_LocalPush(m_result)) ! { ! // there wont be a response ! ForceDisconnect(REASON_NO_RESPONSE, m_nPushTimeouts>=20 ? TRANSFER_CLOSED : TRANSFER_FAILED); ! } ! Close(); } } } + else + { + ASSERT(m_bKeepAlive); + TRACE2("simulating a reconnect for ", Ip2Str(m_result.Host)); + // simulating re-connect for the keep-alive mode + OnConnect(0); + } } void MDownloader::Enqueue() { ! ASSERT(m_hSocket == INVALID_SOCKET || m_bKeepAlive); // not connected or keep-alive SetStatus(TRANSFER_QUEUED); } *************** *** 1085,1088 **** --- 1095,1102 ---- case 0: //ASSERT(m_mutex.locked()); + if (m_bKeepAlive && TRANSFER_RECEIVING != m_nStatus) + { + TRACE1("Connection closed by the remote peer while in XQueued state"); + } ForceDisconnect(REASON_NO_DATA, TRANSFER_FAILED); return; *************** *** 1189,1192 **** --- 1203,1208 ---- if (sConnection.find("keep-alive") >= 0) m_bKeepAlive = true; + else + m_bKeepAlive = false; if (m_bKeepAlive) TRACE2("KeepAlive is supported by ", m_result.Vendor); *************** *** 1299,1303 **** if (!sQueue.empty()) { ! TRACE2("X-Queue is supported by ", m_result.Vendor); map<CString, CString> mapValues; map<CString, CString>::iterator it; --- 1315,1319 ---- if (!sQueue.empty()) { ! TRACE4("X-Queue is supported by ", m_result.Vendor, " Headers: ", sQueue); map<CString, CString> mapValues; map<CString, CString>::iterator it; *************** *** 1308,1312 **** if (it != mapValues.end()) m_nQueuePosition = atol(it->second.c_str()); it = mapValues.find("length"); ! if (it != mapValues.end()) m_nQueueLength = atol(it->second.c_str()); } else --- 1324,1328 ---- if (it != mapValues.end()) m_nQueuePosition = atol(it->second.c_str()); it = mapValues.find("length"); ! if (it != mapValues.end()) m_nQueueLength = max(m_nQueueLength, (int) atol(it->second.c_str())); } else *************** *** 1316,1323 **** } if (nPollMin > 0) ! m_pDirector->OnDownloadHostBusy(GetHostIP(), xtime() + nPollMin, m_nQueuePosition, m_nQueueLength, m_result.Name, m_result.Vendor); ! // TODO: do not drop the connection if keep-alive ! ForceDisconnect(REASON_SERVER_BUSY, TRANSFER_FAILED); } else --- 1332,1354 ---- } if (nPollMin > 0) ! { ! // X-Queue support seem to imply KeepAlive... ! m_bKeepAlive = true; ! m_pDirector->OnDownloadHostBusy(GetHostIP(), xtime() + nPollMin + 1, m_nQueuePosition, m_nQueueLength, m_result.Name, m_result.Vendor); ! } ! else ! m_pDirector->OnDownloadHostBusy(GetHostIP(), xtime() + m_pDirector->GetPrefs()->m_nRetryWait); ! // do not drop the connection if keep-alive ! if (!m_bKeepAlive) ! { ! TRACE2("No Keep-Alive support, disconnecting from host ", Ip2Str(m_result.Host)); ! ForceDisconnect(REASON_SERVER_BUSY, TRANSFER_FAILED); ! } ! else ! { ! m_nDisconnectReason = REASON_SERVER_BUSY; ! SetStatus(TRANSFER_COOLDOWN); ! } } else *************** *** 1326,1330 **** } } ! // We are not in a connected or receiving state else { --- 1357,1361 ---- } } ! // We are not in the connected or receiving state else { |
|
From: Max Z. <ma...@us...> - 2006-06-14 22:55:38
|
Update of /cvsroot/mutella/mutella/mutella In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv13688/mutella Modified Files: uiremote.cpp Log Message: added a very preliminary queuing support Index: uiremote.cpp =================================================================== RCS file: /cvsroot/mutella/mutella/mutella/uiremote.cpp,v retrieving revision 1.82 retrieving revision 1.83 diff -C2 -d -r1.82 -r1.83 *** uiremote.cpp 14 Jun 2006 22:22:48 -0000 1.82 --- uiremote.cpp 14 Jun 2006 22:55:35 -0000 1.83 *************** *** 2236,2241 **** mapTagValues[TAG_ITEMDISCREASON] = (REASON_UNDEFINED != pCnxt->pDownloadItem->nDisconnectReason) ? SGnuDownload::GetErrorString(pCnxt->pDownloadItem->nDisconnectReason) : ""; mapTagValues[TAG_ITEMSTATUS] = SGnuDownload::GetStatusString(pCnxt->pDownloadItem->nStatus); ! mapTagValues[TAG_DOWNLQUELEN] = DWrdtoStr(pCnxt->pDownloadItem->nQueueLength); ! mapTagValues[TAG_DOWNLQUEPOS] = DWrdtoStr(pCnxt->pDownloadItem->nQueuePosition); break; case TR_ForEachSearch: --- 2236,2241 ---- mapTagValues[TAG_ITEMDISCREASON] = (REASON_UNDEFINED != pCnxt->pDownloadItem->nDisconnectReason) ? SGnuDownload::GetErrorString(pCnxt->pDownloadItem->nDisconnectReason) : ""; mapTagValues[TAG_ITEMSTATUS] = SGnuDownload::GetStatusString(pCnxt->pDownloadItem->nStatus); ! mapTagValues[TAG_DOWNLQUELEN] = pCnxt->pDownloadItem->nQueueLength>=0 ? DWrdtoStr(pCnxt->pDownloadItem->nQueueLength) : "-"; ! mapTagValues[TAG_DOWNLQUEPOS] = pCnxt->pDownloadItem->nQueuePosition>=0 ? DWrdtoStr(pCnxt->pDownloadItem->nQueuePosition) : "-"; break; case TR_ForEachSearch: |
|
From: Max Z. <ma...@us...> - 2006-06-14 22:52:31
|
Update of /cvsroot/mutella/mutella/mutella In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv12383/mutella Modified Files: gnudirector.cpp Log Message: added a very preliminary queuing support Index: gnudirector.cpp =================================================================== RCS file: /cvsroot/mutella/mutella/mutella/gnudirector.cpp,v retrieving revision 1.108 retrieving revision 1.109 diff -C2 -d -r1.108 -r1.109 *** gnudirector.cpp 14 Jun 2006 22:22:47 -0000 1.108 --- gnudirector.cpp 14 Jun 2006 22:52:19 -0000 1.109 *************** *** 3017,3021 **** bh.sVendor = sVendor; ! if (IsDownloadHostBusy(ip)) TRACE2("looks like we are hammering at host ", Ip2Str(ip)); --- 3017,3021 ---- bh.sVendor = sVendor; ! if (IsDownloadHostBusy(ip, sFileName)) TRACE2("looks like we are hammering at host ", Ip2Str(ip)); |
|
From: Max Z. <ma...@us...> - 2006-06-14 22:23:03
|
Update of /cvsroot/mutella/mutella/mutella In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv32570/mutella Modified Files: gnudirector.cpp gnudirector.h gnudownload.cpp structures.h uiremote.cpp Log Message: added a very preliminary queuing support Index: gnudirector.cpp =================================================================== RCS file: /cvsroot/mutella/mutella/mutella/gnudirector.cpp,v retrieving revision 1.107 retrieving revision 1.108 diff -C2 -d -r1.107 -r1.108 *** gnudirector.cpp 26 Aug 2004 11:04:33 -0000 1.107 --- gnudirector.cpp 14 Jun 2006 22:22:47 -0000 1.108 *************** *** 1766,1775 **** // download queuing: expire old busy hosts ! for (map <IP, int>::iterator itBH = m_mapBusyHosts.begin(); itBH != m_mapBusyHosts.end(); ) { ! if (itBH->second <= nTimeStamp) { // remove element ! map <IP, int>::iterator itRemove = itBH; ++itBH; m_mapBusyHosts.erase(itRemove); --- 1766,1777 ---- // download queuing: expire old busy hosts ! for (map <IP, BusyHost>::iterator itBH = m_mapBusyHosts.begin(); itBH != m_mapBusyHosts.end(); ) { ! if (itBH->second.nNextValidTime <= nTimeStamp) ! itBH->second.nNextValidTime = 0; ! if (itBH->second.nRemoveTime <= nTimeStamp) { // remove element ! map <IP, BusyHost>::iterator itRemove = itBH; ++itBH; m_mapBusyHosts.erase(itRemove); *************** *** 2993,3002 **** void MGnuDirector::OnDownloadHostBusy(const IP& ip, int nNextValidTime) { ! m_mapBusyHosts[ip] = nNextValidTime; } bool MGnuDirector::IsDownloadHostBusy(const IP& ip) { ! return m_mapBusyHosts.find(ip) != m_mapBusyHosts.end(); } --- 2995,3041 ---- void MGnuDirector::OnDownloadHostBusy(const IP& ip, int nNextValidTime) { ! BusyHost bh; ! bh.nNextValidTime = nNextValidTime; ! bh.nRemoveTime = nNextValidTime + 15; ! bh.nQueuePosition = -1; ! bh.nQueueLength = -1; ! ! if (IsDownloadHostBusy(ip)) ! TRACE2("looks like we are hammering at host ", Ip2Str(ip)); ! ! m_mapBusyHosts[ip] = bh; ! } ! ! void MGnuDirector::OnDownloadHostBusy(const IP& ip, int nNextValidTime, int nQueuePosition, int nQueueLength, const CString& sFileName, const CString& sVendor) ! { ! BusyHost bh; ! bh.nNextValidTime = nNextValidTime; ! bh.nRemoveTime = nNextValidTime + 15; ! bh.nQueuePosition = nQueuePosition; ! bh.nQueueLength = nQueueLength; ! bh.sFileName = sFileName; ! bh.sVendor = sVendor; ! ! if (IsDownloadHostBusy(ip)) ! TRACE2("looks like we are hammering at host ", Ip2Str(ip)); ! ! m_mapBusyHosts[ip] = bh; } bool MGnuDirector::IsDownloadHostBusy(const IP& ip) { ! map <IP, BusyHost>::iterator it = m_mapBusyHosts.find(ip); ! if (it == m_mapBusyHosts.end()) ! return false; ! return true; } + bool MGnuDirector::IsDownloadHostBusy(const IP& ip, const CString& sName) + { + map <IP, BusyHost>::iterator it = m_mapBusyHosts.find(ip); + if (it == m_mapBusyHosts.end()) + return false; + if (it->second.nNextValidTime==0 && sName==it->second.sFileName) + return false; + return true; + } Index: gnudirector.h =================================================================== RCS file: /cvsroot/mutella/mutella/mutella/gnudirector.h,v retrieving revision 1.43 retrieving revision 1.44 diff -C2 -d -r1.43 -r1.44 *** gnudirector.h 9 Aug 2004 11:00:46 -0000 1.43 --- gnudirector.h 14 Jun 2006 22:22:47 -0000 1.44 *************** *** 56,59 **** --- 56,68 ---- }; + struct BusyHost { + int nNextValidTime; + int nRemoveTime; + int nQueuePosition; + int nQueueLength; + CString sFileName; + CString sVendor; + }; + class MGnuDirector : public MAsyncSocket { *************** *** 104,108 **** --- 113,119 ---- // download queuing void OnDownloadHostBusy(const IP& ip, int nNextValidTime); + void OnDownloadHostBusy(const IP& ip, int nNextValidTime, int nQueuePosition, int nQueueLength, const CString& sFileName, const CString& sVendor); bool IsDownloadHostBusy(const IP& ip); + bool IsDownloadHostBusy(const IP& ip, const CString& sName); // void OnQueryHit(packet_QueryHit* pHit, MGnuNode* pOrigin, bool bOur); *************** *** 310,314 **** int m_nLastConnCount; // download queuing ! map <IP, int> m_mapBusyHosts; public: // Hash tables are thread safe, nothing bad should happen to them --- 321,325 ---- int m_nLastConnCount; // download queuing ! map <IP, BusyHost> m_mapBusyHosts; public: // Hash tables are thread safe, nothing bad should happen to them Index: gnudownload.cpp =================================================================== RCS file: /cvsroot/mutella/mutella/mutella/gnudownload.cpp,v retrieving revision 1.75 retrieving revision 1.76 diff -C2 -d -r1.75 -r1.76 *** gnudownload.cpp 23 Aug 2004 11:56:23 -0000 1.75 --- gnudownload.cpp 14 Jun 2006 22:22:47 -0000 1.76 *************** *** 272,275 **** --- 272,279 ---- bool m_bServerIsUp; bool m_bForceUriRes; + bool m_bKeepAlive; + // queue + int m_nQueuePosition; + int m_nQueueLength; // int m_nFilePos; *************** *** 673,676 **** --- 677,683 ---- m_bServerIsUp = false; m_bForceUriRes = false; + m_bKeepAlive = false; + m_nQueuePosition = -1; + m_nQueueLength = -1; // m_nMaxReceiveRate = 0; *************** *** 799,803 **** // this will delay retrying on the ip-by-ip basis // IP is not the best ID for pushes, but still should work somehow... ! m_pDirector->OnDownloadHostBusy(GetHostIP(), xtime() + m_pDirector->GetPrefs()->m_nRetryWait); // lets check if we have not-yet-stored data in the receive buffer --- 806,811 ---- // this will delay retrying on the ip-by-ip basis // IP is not the best ID for pushes, but still should work somehow... ! if (!m_pDirector->IsDownloadHostBusy(GetHostIP())) ! m_pDirector->OnDownloadHostBusy(GetHostIP(), xtime() + m_pDirector->GetPrefs()->m_nRetryWait); // lets check if we have not-yet-stored data in the receive buffer *************** *** 1177,1181 **** CString sCode = sLine.substr(sLine.find(' ', nPos+4)+1); int nCode = atol(sCode.c_str()); ! // check codes // Success code if(200 <= nCode && nCode < 300) --- 1185,1195 ---- CString sCode = sLine.substr(sLine.find(' ', nPos+4)+1); int nCode = atol(sCode.c_str()); ! // Connection: KeepAlive header ! CString sConnection = find_header("connection",sHeader,sHeader); ! if (sConnection.find("keep-alive") >= 0) ! m_bKeepAlive = true; ! if (m_bKeepAlive) ! TRACE2("KeepAlive is supported by ", m_result.Vendor); ! // check result codes // Success code if(200 <= nCode && nCode < 300) *************** *** 1268,1271 **** --- 1282,1286 ---- else if(400 <= nCode && nCode < 500) { + // TODO: do not drop the connection if keep-alive if (m_bForceUriRes || !m_result.Sha1.isValid()) ForceDisconnect(REASON_FILE_NOT_FOUND, TRANSFER_CLOSED); *************** *** 1279,1285 **** else if(500 <= nCode && nCode < 600) { ForceDisconnect(REASON_SERVER_BUSY, TRANSFER_FAILED); - // TODO: parse queuing header - //m_pDirector->OnDownloadHostBusy(GetHostIP(), xtime() + m_pPrefs->m_nRetryWait); // IP is not the best ID for pushes.. } else --- 1294,1323 ---- else if(500 <= nCode && nCode < 600) { + // parse queuing header + int nPollMin = -1; + CString sQueue = find_header("x-queue",sHeader,sHeader); + if (!sQueue.empty()) + { + TRACE2("X-Queue is supported by ", m_result.Vendor); + map<CString, CString> mapValues; + map<CString, CString>::iterator it; + parse_params(sQueue, ",", "=", mapValues); + it = mapValues.find("pollmin"); + if (it != mapValues.end()) nPollMin = atol(it->second.c_str()); + it = mapValues.find("position"); + if (it != mapValues.end()) m_nQueuePosition = atol(it->second.c_str()); + it = mapValues.find("length"); + if (it != mapValues.end()) m_nQueueLength = atol(it->second.c_str()); + } + else + { + TRACE2("X-Queue does not seem to be supported by ", m_result.Vendor); + cout << "header:\n" << sHeader << endl; + } + if (nPollMin > 0) + m_pDirector->OnDownloadHostBusy(GetHostIP(), xtime() + nPollMin, m_nQueuePosition, m_nQueueLength, m_result.Name, m_result.Vendor); + + // TODO: do not drop the connection if keep-alive ForceDisconnect(REASON_SERVER_BUSY, TRANSFER_FAILED); } else *************** *** 1317,1320 **** --- 1355,1360 ---- sGetFormat = CString("GET /uri-res/N2R?urn:sha1:%s HTTP/1.1\r\n") + "User-Agent: Mutella-" + VERSION + "\r\n" + + "Connection: KeepAlive\r\n" + "X-Queue: 0.1\r\n" "Range: bytes=%d-\r\n" + "X-Gnutella-Content-URN: urn:sha1:%s\r\n\r\n"; *************** *** 1325,1328 **** --- 1365,1370 ---- sGetFormat = CString("GET /get/%ld/%s HTTP/1.0\r\n") + "User-Agent: Mutella-" + VERSION + "\r\n" + + "Connection: KeepAlive\r\n" + "X-Queue: 0.1\r\n" "Range: bytes=%d-\r\n\r\n"; sGetRequest.format(sGetFormat.c_str(), m_result.FileIndex, m_result.Name.c_str(), m_nFilePos); *************** *** 1353,1356 **** --- 1395,1400 ---- item.dwRate = m_dwRate; item.bServerIsUp = m_bServerIsUp; + item.nQueuePosition = m_nQueuePosition; + item.nQueueLength = m_nQueueLength; item.nConErrors = m_nConErrors; item.nPushTimeouts = m_nPushTimeouts; *************** *** 1566,1570 **** // break; case TRANSFER_NEW: ! if (!m_pDirector->IsDownloadHostBusy((*itd)->GetHostIP())) (*itd)->Enqueue(); } --- 1610,1614 ---- // break; case TRANSFER_NEW: ! if (!m_pDirector->IsDownloadHostBusy((*itd)->GetHostIP(), (*itd)->GetResult().Name)) (*itd)->Enqueue(); } Index: structures.h =================================================================== RCS file: /cvsroot/mutella/mutella/mutella/structures.h,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** structures.h 19 Aug 2004 09:34:07 -0000 1.24 --- structures.h 14 Jun 2006 22:22:48 -0000 1.25 *************** *** 272,275 **** --- 272,278 ---- int nConErrors; // counter of consequitive connection errors int nPushTimeouts; // counter of consequitive push timeouts + // + int nQueuePosition; + int nQueueLength; }; typedef vector<SGnuDownloadItem> DownloadItemVec; Index: uiremote.cpp =================================================================== RCS file: /cvsroot/mutella/mutella/mutella/uiremote.cpp,v retrieving revision 1.81 retrieving revision 1.82 diff -C2 -d -r1.81 -r1.82 *** uiremote.cpp 8 Jun 2006 12:57:51 -0000 1.81 --- uiremote.cpp 14 Jun 2006 22:22:48 -0000 1.82 *************** *** 1236,1239 **** --- 1236,1241 ---- #define TAG_DOWNLSTATUS "#DOWNLSTATUS#" #define TAG_DOWNLEXTSTATUS "#DOWNLEXTSTATUS#" + #define TAG_DOWNLQUELEN "#ITEMQUELEN#" + #define TAG_DOWNLQUEPOS "#ITEMQUEPOS#" #define TAG_ITEMIP "#ITEMIP#" #define TAG_ITEMPORT "#ITEMPORT#" *************** *** 1370,1374 **** {TAG_DOWNLETA, TR_ForEachDownload}, {TAG_DOWNLSTATUS, TR_ForEachDownload}, ! {TAG_DOWNLEXTSTATUS,TR_ForEachDownload}, {TAG_ITEMIP, TR_ForEachDownloadItem}, {TAG_ITEMPORT, TR_ForEachDownloadItem}, --- 1372,1376 ---- {TAG_DOWNLETA, TR_ForEachDownload}, {TAG_DOWNLSTATUS, TR_ForEachDownload}, ! {TAG_DOWNLEXTSTATUS, TR_ForEachDownload}, {TAG_ITEMIP, TR_ForEachDownloadItem}, {TAG_ITEMPORT, TR_ForEachDownloadItem}, *************** *** 1379,1382 **** --- 1381,1386 ---- {TAG_ITEMDISCREASON,TR_ForEachDownloadItem}, {TAG_ITEMSTATUS, TR_ForEachDownloadItem}, + {TAG_DOWNLQUELEN, TR_ForEachDownloadItem}, + {TAG_DOWNLQUEPOS, TR_ForEachDownloadItem}, {TAG_SEARID, TR_ForEachSearch}, {TAG_SEARNAME, TR_ForEachSearch}, *************** *** 2232,2235 **** --- 2236,2241 ---- mapTagValues[TAG_ITEMDISCREASON] = (REASON_UNDEFINED != pCnxt->pDownloadItem->nDisconnectReason) ? SGnuDownload::GetErrorString(pCnxt->pDownloadItem->nDisconnectReason) : ""; mapTagValues[TAG_ITEMSTATUS] = SGnuDownload::GetStatusString(pCnxt->pDownloadItem->nStatus); + mapTagValues[TAG_DOWNLQUELEN] = DWrdtoStr(pCnxt->pDownloadItem->nQueueLength); + mapTagValues[TAG_DOWNLQUEPOS] = DWrdtoStr(pCnxt->pDownloadItem->nQueuePosition); break; case TR_ForEachSearch: |
|
From: Max Z. <ma...@us...> - 2006-06-14 22:22:55
|
Update of /cvsroot/mutella/mutella/share/remote/template/modules In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv32570/share/remote/template/modules Modified Files: downloads.html Log Message: added a very preliminary queuing support Index: downloads.html =================================================================== RCS file: /cvsroot/mutella/mutella/share/remote/template/modules/downloads.html,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** downloads.html 17 Nov 2002 14:01:47 -0000 1.8 --- downloads.html 14 Jun 2006 22:22:48 -0000 1.9 *************** *** 23,27 **** <td class="data-small" align="center">#ITEMSTATUS#</td> <td class="data-small" align="center">#ITEMRATE#/s</td> ! <td class="data-small" align="center">ConnErr:#ITEMCONNERR# PushTO:#ITEMPUSHTO#</td> <td class="data-small" align="center">#ITEMDISCREASON#</td> </tr> --- 23,27 ---- <td class="data-small" align="center">#ITEMSTATUS#</td> <td class="data-small" align="center">#ITEMRATE#/s</td> ! <td class="data-small" align="center">ConnErr:#ITEMCONNERR# PushTO:#ITEMPUSHTO# Que:#ITEMQUEPOS#/#ITEMQUELEN#</td> <td class="data-small" align="center">#ITEMDISCREASON#</td> </tr> |
|
From: Max Z. <ma...@us...> - 2006-06-14 07:58:16
|
Update of /cvsroot/mutella/mutella/mutella In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv20049 Modified Files: gnulogcentre.cpp Log Message: fixed a bug in the log centre Index: gnulogcentre.cpp =================================================================== RCS file: /cvsroot/mutella/mutella/mutella/gnulogcentre.cpp,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** gnulogcentre.cpp 10 Dec 2003 12:39:53 -0000 1.11 --- gnulogcentre.cpp 14 Jun 2006 07:58:11 -0000 1.12 *************** *** 125,128 **** --- 125,130 ---- } + #define LC_MAX_LINE 4096 + void MGnuLogCentre::logEvent(MEvent* pEvent, const CString& sFile, int nMaxTime, int nTrimTime) { *************** *** 143,148 **** } fseek(pFile, 0, SEEK_SET); ! char szLine[1024]; ! if (fgets(szLine, 1024, pFile)) { time_t line_time = ParseAbsTimeFull(szLine); --- 145,150 ---- } fseek(pFile, 0, SEEK_SET); ! char szLine[LC_MAX_LINE]; ! if (fgets(szLine, LC_MAX_LINE, pFile)) { time_t line_time = ParseAbsTimeFull(szLine); *************** *** 171,176 **** while(nDiff > nTrimTime) { ! if (!fgets(szLine, 1024, pFile)) break; time_t line_time = ParseAbsTimeFull(szLine); if (line_time == (time_t)-1) --- 173,180 ---- while(nDiff > nTrimTime) { ! if (!fgets(szLine, LC_MAX_LINE, pFile)) break; + if (szLine[0]=='\0' || !isdigit(szLine[0])) + continue; time_t line_time = ParseAbsTimeFull(szLine); if (line_time == (time_t)-1) *************** *** 181,185 **** { fputs(szLine, pFileN); ! } while(fgets(szLine, 1024, pFile)); fclose(pFile); --- 185,189 ---- { fputs(szLine, pFileN); ! } while(fgets(szLine, LC_MAX_LINE, pFile)); fclose(pFile); |
|
From: Max Z. <ma...@us...> - 2006-06-13 20:28:44
|
Update of /cvsroot/mutella/mutella/mutella In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv10385/mutella Modified Files: gnushare.h Log Message: fixed a compile bug appearing with gcc4 Index: gnushare.h =================================================================== RCS file: /cvsroot/mutella/mutella/mutella/gnushare.h,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** gnushare.h 15 Nov 2002 20:22:57 -0000 1.12 --- gnushare.h 13 Jun 2006 20:28:38 -0000 1.13 *************** *** 27,30 **** --- 27,31 ---- class MGnuDirector; + class MShareThread; class MGnuShare |
|
From: Max Z. <ma...@us...> - 2006-06-13 14:42:14
|
Update of /cvsroot/mutella/mutella/mutella In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv28184 Modified Files: gnunode.cpp gnunode.h preferences.cpp preferences.h Log Message: added a tricky option to improve connection time Index: gnunode.cpp =================================================================== RCS file: /cvsroot/mutella/mutella/mutella/gnunode.cpp,v retrieving revision 1.83 retrieving revision 1.84 diff -C2 -d -r1.83 -r1.84 *** gnunode.cpp 13 Aug 2004 11:47:31 -0000 1.83 --- gnunode.cpp 13 Jun 2006 14:42:10 -0000 1.84 *************** *** 91,94 **** --- 91,96 ---- m_UltraPongSent = false; + m_bByeReceived = false; + //if(m_pPrefs->m_LanMode) // m_HostName = m_pCore->ResolveIP( StrtoIP(m_ipHost)); *************** *** 204,207 **** --- 206,221 ---- else*/ if (!m_bInbound || m_pHostStore->IsHalfEmpty()) m_pHostStore->Add(m_ipHost, m_nPort); + + if (!m_bByeReceived) + { + CString sMsg; + sMsg.format("Vendor: %s No BYE message received", m_sRemoteClient.c_str()); + POST_EVENT( MStringEvent( + ET_MESSAGE, ES_NONE, + sMsg, + MSG_CONNECTION_BYE, + MSGSRC_NODE + )); + } } *************** *** 240,247 **** if(true) { - CString sMuteVersion = VERSION; - Handshake = "GNUTELLA CONNECT/0.6\r\n"; ! Handshake += "User-Agent: Mutella-" + sMuteVersion + "\r\n"; // Ultrapeer Header --- 254,263 ---- if(true) { Handshake = "GNUTELLA CONNECT/0.6\r\n"; ! if (m_pPrefs->m_bUseGnucTrick) ! Handshake += CString("User-Agent: Mutella-") + VERSION + " (not using GnucDNA)\r\n"; ! else ! Handshake += CString("User-Agent: Mutella-") + VERSION + "\r\n"; ! // Ultrapeer Header *************** *** 941,946 **** { Handshake = "GNUTELLA/0.6 200 OK\r\n"; ! Handshake += CString("User-Agent: Mutella-") + VERSION + "\r\n"; ! // Remote IP header UINT nTrash; --- 957,964 ---- { Handshake = "GNUTELLA/0.6 200 OK\r\n"; ! if (m_pPrefs->m_bUseGnucTrick) ! Handshake += CString("User-Agent: Mutella-") + VERSION + " (not using GnucDNA)\r\n"; ! else ! Handshake += CString("User-Agent: Mutella-") + VERSION + "\r\n"; // Remote IP header UINT nTrash; *************** *** 1648,1651 **** --- 1666,1671 ---- )); + m_bByeReceived = true; + ForceDisconnect(); } Index: gnunode.h =================================================================== RCS file: /cvsroot/mutella/mutella/mutella/gnunode.h,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** gnunode.h 2 Dec 2003 21:59:49 -0000 1.26 --- gnunode.h 13 Jun 2006 14:42:10 -0000 1.27 *************** *** 209,212 **** --- 209,214 ---- bool m_UltraPongSent; + bool m_bByeReceived; + bool IsRecentQuery(GUID Guid); vector<RecentQuery> m_RecentQueryList; Index: preferences.cpp =================================================================== RCS file: /cvsroot/mutella/mutella/mutella/preferences.cpp,v retrieving revision 1.44 retrieving revision 1.45 diff -C2 -d -r1.44 -r1.45 *** preferences.cpp 9 Aug 2004 13:48:17 -0000 1.44 --- preferences.cpp 13 Jun 2006 14:42:10 -0000 1.45 *************** *** 137,140 **** --- 137,143 ---- pP->SetPropertyDescription("Maximum mumber of leaves allowed to connect to our ULTRAPEER", "Set it in accordance with your bandwidth"); + pP = m_pContainer->AddProperty("UseGnucTrick", &m_bUseGnucTrick, false); + pP->SetPropertyDescription("Undocumented trick option, don't use it if unsure", + "Undocumented trick option, don't use it if unsure"); // Initial Gnu Web Caches Index: preferences.h =================================================================== RCS file: /cvsroot/mutella/mutella/mutella/preferences.h,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** preferences.h 9 Aug 2004 13:48:17 -0000 1.30 --- preferences.h 13 Jun 2006 14:42:10 -0000 1.31 *************** *** 68,71 **** --- 68,72 ---- bool m_bForceSuperNodeMode; int m_nMaxLeaves; + bool m_bUseGnucTrick; // Connect Servers |
|
From: Max Z. <ma...@us...> - 2006-06-08 12:57:59
|
Update of /cvsroot/mutella/mutella/mutella In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv24310 Modified Files: messages.cpp sha1thread.cpp sha1thread.h uiremote.cpp Log Message: added download links to the freshly shared files to the http-ui log Index: messages.cpp =================================================================== RCS file: /cvsroot/mutella/mutella/mutella/messages.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** messages.cpp 25 Sep 2002 08:35:07 -0000 1.9 --- messages.cpp 8 Jun 2006 12:57:51 -0000 1.10 *************** *** 42,45 **** --- 42,46 ---- case MSG_FAILED_TO_LISTEN: return "Failed to switch socket to the listen mode"; case MSG_FAILED_TO_CREATE_LISTEN_SOCKET: return "Failed to create a listening socket"; + case MSG_SHA1_READY: return "Sha1 hash is ready"; } CString s; Index: sha1thread.cpp =================================================================== RCS file: /cvsroot/mutella/mutella/mutella/sha1thread.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** sha1thread.cpp 8 Jul 2003 12:57:18 -0000 1.10 --- sha1thread.cpp 8 Jun 2006 12:57:51 -0000 1.11 *************** *** 241,245 **** } Sha1CacheEntry ce; ! ce.sName = pE->m_sRelPath; ce.nSize = sStat.st_size; ce.nModifyTime = sStat.st_mtime; --- 241,245 ---- } Sha1CacheEntry ce; ! // ce.sName = pE->m_sRelPath; ce.nSize = sStat.st_size; ce.nModifyTime = sStat.st_mtime; *************** *** 300,303 **** --- 300,304 ---- szSha1, pE->m_sPath, + pE->m_sRelPath, pE->m_nShareIndex )); *************** *** 325,328 **** --- 326,330 ---- itSha1->sSha1.c_str(), pE->m_sPath, + pE->m_sRelPath, pE->m_nShareIndex )); Index: sha1thread.h =================================================================== RCS file: /cvsroot/mutella/mutella/mutella/sha1thread.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** sha1thread.h 8 Nov 2002 20:18:30 -0000 1.2 --- sha1thread.h 8 Jun 2006 12:57:51 -0000 1.3 *************** *** 74,89 **** class MHashReady : public MEvent{ public: ! MHashReady(const char* szSha1, const CString& sPath, int nShareIndex) : MEvent(ET_MESSAGE, ES_NONE, MSG_SHA1_READY), m_sSha1(szSha1), m_sPath(sPath), m_nShareIndex(nShareIndex) {} virtual CString Format(){ ! return "Hash ready for '" + m_sPath + "'"; } virtual int GetMemUsage() {return sizeof(MHashReady);} // CString m_sPath; CString m_sSha1; int m_nShareIndex; --- 74,97 ---- class MHashReady : public MEvent{ public: ! MHashReady(const char* szSha1, const CString& sPath, const CString& sRelPath, int nShareIndex) : MEvent(ET_MESSAGE, ES_NONE, MSG_SHA1_READY), m_sSha1(szSha1), m_sPath(sPath), + m_sRelPath(sRelPath), m_nShareIndex(nShareIndex) {} virtual CString Format(){ ! // workaround for the HTTP UI... return "Hash ready for '" + m_sPath + "'"; ! CString sTmpPath = m_sRelPath; ! ReplaceSubStr(sTmpPath, "<", "<"); ! ReplaceSubStr(sTmpPath, ">" ,">"); ! ReplaceSubStr(sTmpPath, "&", "&"); ! ReplaceSubStr(sTmpPath, "\"", """); ! return "file: <a href=\"/get/" + DWrdtoStr(m_nShareIndex) + "/" + sTmpPath + "\">" + sTmpPath + "</a>"; } virtual int GetMemUsage() {return sizeof(MHashReady);} // CString m_sPath; + CString m_sRelPath; CString m_sSha1; int m_nShareIndex; Index: uiremote.cpp =================================================================== RCS file: /cvsroot/mutella/mutella/mutella/uiremote.cpp,v retrieving revision 1.80 retrieving revision 1.81 diff -C2 -d -r1.80 -r1.81 *** uiremote.cpp 20 Aug 2004 13:16:10 -0000 1.80 --- uiremote.cpp 8 Jun 2006 12:57:51 -0000 1.81 *************** *** 40,43 **** --- 40,45 ---- #include "property.h" + #include "sha1thread.h" // we'll add links to the library files to the log... it's a workaround to a missing 'lib' command + #include <unistd.h> #include <sys/mman.h> *************** *** 228,232 **** virtual bool IsOfInterest(MEvent* p){ ASSERT(p); ! return p->GetSeverity()>=ES_JUSTINCASE; } }; --- 230,234 ---- virtual bool IsOfInterest(MEvent* p){ ASSERT(p); ! return (p->GetSeverity()>=ES_JUSTINCASE || p->GetID()==MSG_SHA1_READY); } }; |
|
From: Max Z. <ma...@us...> - 2004-08-26 14:13:52
|
Update of /cvsroot/mutella/mutella In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12074 Modified Files: CHANGES ChangeLog configure.in mutella.spec Log Message: 0.4.5 released! Index: CHANGES =================================================================== RCS file: /cvsroot/mutella/mutella/CHANGES,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** CHANGES 18 Jan 2003 13:35:14 -0000 1.7 --- CHANGES 26 Aug 2004 14:13:43 -0000 1.8 *************** *** 1,2 **** --- 1,20 ---- + 0.3.5 + - Stability regained - no crashes anymore + - Consistent tracking of all the file we have ever touched + - Support for gcc 3.4.x + - Documentation updates + - "WhiteList" support to guarantee upload slots to given IPs or nets + - Access to settings via HTTP UI + - Sorting of searches and results in HTTP UI + - Download rate limiting + - Naitive daemon mode (no neew for screen anymore) + - Command line support + - Local Unix socket text-mode UI added (best accessed with mutella_sio program) + - Some options have been renamed + - Re-search problem fixed. Should please the GDF. + - Initial GGEP support + - Support for BYE message + - Memory allocation updated to produce less fragmentation + - Various bugfixes 0.4.3 - Compile-time endian checks using autoconf macro Index: ChangeLog =================================================================== RCS file: /cvsroot/mutella/mutella/ChangeLog,v retrieving revision 1.114 retrieving revision 1.115 diff -C2 -d -r1.114 -r1.115 *** ChangeLog 27 Sep 2003 12:30:14 -0000 1.114 --- ChangeLog 26 Aug 2004 14:13:43 -0000 1.115 *************** *** 1,2 **** --- 1,18 ---- + v0.3.5 + 20.08.2004 MZ: gcc 3.4 fixes, some other minor things + 19.08.2004 MZ: More consistent tracking of the marked files, their progress, etc + 12.08.2004 MZ: Fixed problem with unprintable chars in terminal, fixed pipe issue + with system command + 09.08.2004 MZ: Gwebcache bug fixed + MZ: Added a property to disable redirect following in gwebcache support + 29.07.2004 MZ: Uploads parse URLs more correctly + 19.01.2004 MZ: Upload range header fix + 10.01.2004 MZ: Initial GGEP support + 02.12.2003 MZ: Support for the BYE message + 28.11.2003 MZ: Cookies now support the path attribute, temlate changed respectively + 21.10.2003 MZ: Stuck connections reported by Michael should be fixed now + 14.10.2003 MZ: Crash in gnudirector fixed + 29.09.2004 MZ: Support for "MakredFiles": we keep track of all files we have + ever touched. 27.09.2003 MZ: README updated. Util added to the build tree. 17.09.2003 MZ: Finally finished the documentation of mutella's options. *************** *** 4,9 **** has been implemented at last :-) 26.08.2003 MZ: Added a feature "WhiteList" to guarantee upload slots to ! given IPs or nets ! 07.05.2003 MZ: TString memory allocation updated (made less economical, but hopefully causing less fragmentation) --- 20,24 ---- has been implemented at last :-) 26.08.2003 MZ: Added a feature "WhiteList" to guarantee upload slots to ! given IPs or nets 07.05.2003 MZ: TString memory allocation updated (made less economical, but hopefully causing less fragmentation) Index: configure.in =================================================================== RCS file: /cvsroot/mutella/mutella/configure.in,v retrieving revision 1.64 retrieving revision 1.65 diff -C2 -d -r1.64 -r1.65 *** configure.in 23 Aug 2004 11:56:23 -0000 1.64 --- configure.in 26 Aug 2004 14:13:43 -0000 1.65 *************** *** 11,15 **** AC_ARG_PROGRAM ! AM_INIT_AUTOMAKE(mutella,0.4.5rc2) AC_PREFIX_DEFAULT(/usr/local) --- 11,15 ---- AC_ARG_PROGRAM ! AM_INIT_AUTOMAKE(mutella,0.4.5) AC_PREFIX_DEFAULT(/usr/local) Index: mutella.spec =================================================================== RCS file: /cvsroot/mutella/mutella/mutella.spec,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** mutella.spec 20 Aug 2004 13:16:10 -0000 1.11 --- mutella.spec 26 Aug 2004 14:13:43 -0000 1.12 *************** *** 2,6 **** %define name mutella ! %define ver 0.4.5rc15rc15rc15rc15rc1 %define rel 1 --- 2,6 ---- %define name mutella ! %define ver 0.4.5 %define rel 1 |
|
From: Max Z. <ma...@us...> - 2004-08-26 11:04:46
|
Update of /cvsroot/mutella/mutella/mutella In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7425/mutella Modified Files: gnudirector.cpp Log Message: fix for forced ultrapeer mode Index: gnudirector.cpp =================================================================== RCS file: /cvsroot/mutella/mutella/mutella/gnudirector.cpp,v retrieving revision 1.106 retrieving revision 1.107 diff -C2 -d -r1.106 -r1.107 *** gnudirector.cpp 20 Aug 2004 14:59:02 -0000 1.106 --- gnudirector.cpp 26 Aug 2004 11:04:33 -0000 1.107 *************** *** 2891,2895 **** { // this function analyses the situation and changes the node capability if appropriate ! if (m_nHostMode == CM_ULTRAPEER || m_nHostMode == CM_ULTRALEAF) return; // Cant be behind firewall --- 2891,2895 ---- { // this function analyses the situation and changes the node capability if appropriate ! if (m_nHostMode == CM_ULTRAPEER || (!bForce && m_nHostMode == CM_ULTRALEAF)) return; // Cant be behind firewall |
|
From: Max Z. <ma...@us...> - 2004-08-23 11:56:41
|
Update of /cvsroot/mutella/mutella/mutella In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24346/mutella Modified Files: gnudownload.cpp Log Message: status fix for the failed downloads Index: gnudownload.cpp =================================================================== RCS file: /cvsroot/mutella/mutella/mutella/gnudownload.cpp,v retrieving revision 1.74 retrieving revision 1.75 diff -C2 -d -r1.74 -r1.75 *** gnudownload.cpp 20 Aug 2004 13:16:10 -0000 1.74 --- gnudownload.cpp 23 Aug 2004 11:56:23 -0000 1.75 *************** *** 1542,1545 **** --- 1542,1548 ---- SetStatus(TRANSFER_CLOSING); m_pFileMng->RequestClose(); + // unregister in the known files DB + ASSERT(m_pDirector->GetMarkedFiles()); + m_pDirector->GetMarkedFiles()->RemoveFile(m_dwFileLength, m_nFileHandle, MFT_InDownload); return; } |
|
From: Max Z. <ma...@us...> - 2004-08-23 11:56:41
|
Update of /cvsroot/mutella/mutella In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24346 Modified Files: configure.in Log Message: status fix for the failed downloads Index: configure.in =================================================================== RCS file: /cvsroot/mutella/mutella/configure.in,v retrieving revision 1.63 retrieving revision 1.64 diff -C2 -d -r1.63 -r1.64 *** configure.in 20 Aug 2004 13:16:09 -0000 1.63 --- configure.in 23 Aug 2004 11:56:23 -0000 1.64 *************** *** 11,15 **** AC_ARG_PROGRAM ! AM_INIT_AUTOMAKE(mutella,0.4.5rc1) AC_PREFIX_DEFAULT(/usr/local) --- 11,15 ---- AC_ARG_PROGRAM ! AM_INIT_AUTOMAKE(mutella,0.4.5rc2) AC_PREFIX_DEFAULT(/usr/local) |
|
From: Max Z. <ma...@us...> - 2004-08-20 14:59:16
|
Update of /cvsroot/mutella/mutella/mutella In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18745/mutella Modified Files: gnudirector.cpp Log Message: fid in download Index: gnudirector.cpp =================================================================== RCS file: /cvsroot/mutella/mutella/mutella/gnudirector.cpp,v retrieving revision 1.105 retrieving revision 1.106 diff -C2 -d -r1.105 -r1.106 *** gnudirector.cpp 19 Aug 2004 09:34:07 -0000 1.105 --- gnudirector.cpp 20 Aug 2004 14:59:02 -0000 1.106 *************** *** 965,970 **** MGnuDownload* pD = new MGnuDownload(this, results, results[nShortestNameIndex].Name, nFileHandle); ASSERT(pD); - // add to download queue - AddAndStartDownload(pD); // add the file to the known files DB CString sCommonSearch = MakeSearchOfFilename(results[nShortestNameIndex].Name); --- 965,968 ---- *************** *** 976,979 **** --- 974,979 ---- m_pKnownFiles->AddFile(MFT_Attempted, results[i].Size, results[i].Sha1, sCommonSearch, nFileHandle); } + // add to download queue + AddAndStartDownload(pD); return true; } |
|
From: Max Z. <ma...@us...> - 2004-08-20 13:16:20
|
Update of /cvsroot/mutella/mutella/mutella In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32646/mutella Modified Files: defines.h gnudownload.cpp tstring.cpp tstring.h uiremote.cpp uitextmode.cpp Log Message: gcc 3.4 fixes, some other minor things Index: defines.h =================================================================== RCS file: /cvsroot/mutella/mutella/mutella/defines.h,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** defines.h 9 Dec 2003 13:05:27 -0000 1.13 --- defines.h 20 Aug 2004 13:16:10 -0000 1.14 *************** *** 29,37 **** #endif ! #define BOOL bool ! #define BYTE u_char ! #define UINT u_int ! #define WORD u_short ! #define DWORD u_long typedef char * LPSTR; --- 29,37 ---- #endif ! typedef bool BOOL; ! typedef unsigned char BYTE; ! typedef unsigned int UINT; ! typedef unsigned short WORD; ! typedef unsigned long DWORD; typedef char * LPSTR; *************** *** 46,50 **** typedef void* LPVOID; ! #define HANDLE DWORD typedef HANDLE* LPHANDLE; --- 46,50 ---- typedef void* LPVOID; ! typedef DWORD HANDLE; typedef HANDLE* LPHANDLE; Index: gnudownload.cpp =================================================================== RCS file: /cvsroot/mutella/mutella/mutella/gnudownload.cpp,v retrieving revision 1.73 retrieving revision 1.74 diff -C2 -d -r1.73 -r1.74 *** gnudownload.cpp 19 Aug 2004 09:34:07 -0000 1.73 --- gnudownload.cpp 20 Aug 2004 13:16:10 -0000 1.74 *************** *** 1997,2001 **** lock.unlock(); ASSERT(m_pDirector->GetMarkedFiles()); ! m_pDirector->GetMarkedFiles()->RemoveFile(m_dwFileLength, m_nFileHandle, MFT_Attempted); } --- 1997,2001 ---- lock.unlock(); ASSERT(m_pDirector->GetMarkedFiles()); ! m_pDirector->GetMarkedFiles()->RemoveFile(m_dwFileLength, m_nFileHandle, MFT_Attempted|MFT_InDownload); } Index: tstring.cpp =================================================================== RCS file: /cvsroot/mutella/mutella/mutella/tstring.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** tstring.cpp 8 May 2003 08:45:44 -0000 1.7 --- tstring.cpp 20 Aug 2004 13:16:10 -0000 1.8 *************** *** 27,30 **** --- 27,31 ---- #endif //TSTRING_DEBUG + #include "defines.h" #include "tstring.h" #include "string.h" Index: tstring.h =================================================================== RCS file: /cvsroot/mutella/mutella/mutella/tstring.h,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** tstring.h 8 May 2003 08:45:44 -0000 1.17 --- tstring.h 20 Aug 2004 13:16:10 -0000 1.18 *************** *** 45,48 **** --- 45,89 ---- #endif // TSTRING_DEBUG + template<class T> class TString; + + template <class T> bool operator== (const TString<T>& lhs, const TString<T>& rhs); + template <class T> bool operator== (const TString<T>& lhs, typename TString<T>::LPCT pszRhs); + template <class T> bool operator== (typename TString<T>::LPCT pszLhs, const TString<T>& rhs); + template <class T> bool operator== (const TString<T>& lhs,T cRhs); + template <class T> bool operator== (T cLhs,const TString<T>& rhs); + template <class T> bool operator!= (const TString<T>& lhs, const TString<T>& rhs); + template <class T> bool operator!= (const TString<T>& lhs, typename TString<T>::LPCT pszRhs); + template <class T> bool operator!= (typename TString<T>::LPCT pszLhs, const TString<T>& rhs); + template <class T> bool operator!= (const TString<T>& lhs,T cRhs); + template <class T> bool operator!= (T cLhs,const TString<T>& rhs); + template <class T> bool operator> (const TString<T>& lhs, const TString<T>& rhs); + template <class T> bool operator> (const TString<T>& lhs, typename TString<T>::LPCT pszRhs); + template <class T> bool operator> (typename TString<T>::LPCT pszLhs, const TString<T>& rhs); + template <class T> bool operator> (const TString<T>& lhs,T cRhs); + template <class T> bool operator> (T cLhs,const TString<T>& rhs); + template <class T> bool operator< (const TString<T>& lhs, const TString<T>& rhs); + template <class T> bool operator< (const TString<T>& lhs, typename TString<T>::LPCT pszRhs); + template <class T> bool operator< (typename TString<T>::LPCT pszLhs, const TString<T>& rhs); + template <class T> bool operator< (const TString<T>& lhs,T cRhs); + template <class T> bool operator< (T cLhs,const TString<T>& rhs); + template <class T> bool operator>= (const TString<T>& lhs, const TString<T>& rhs); + template <class T> bool operator>= (const TString<T>& lhs, typename TString<T>::LPCT pszRhs); + template <class T> bool operator>= (typename TString<T>::LPCT pszLhs, const TString<T>& rhs); + template <class T> bool operator>= (const TString<T>& lhs,T cRhs); + template <class T> bool operator>= (T cLhs,const TString<T>& rhs); + template <class T> bool operator<= (const TString<T>& lhs, const TString<T>& rhs); + template <class T> bool operator<= (const TString<T>& lhs, typename TString<T>::LPCT pszRhs); + template <class T> bool operator<= (typename TString<T>::LPCT pszLhs, const TString<T>& rhs); + template <class T> bool operator<= (const TString<T>& lhs,T cRhs); + template <class T> bool operator<= (T cLhs,const TString<T>& rhs); + template <class T> TString<T> operator+ (const TString<T>& lhs, const TString<T>& rhs); + template <class T> TString<T> operator+ (const TString<T>& lhs,typename TString<T>::LPCT pszRhs); + template <class T> TString<T> operator+ (typename TString<T>::LPCT pszLhs, const TString<T>& rhs); + template <class T> TString<T> operator+ (const TString<T>& lhs, T cRhs); + template <class T> TString<T> operator+ (T cLhs, const TString<T>& rhs); + template <class T> std::ostream& operator<< (std::ostream& os, const TString<T>& st); + template <class T> std::istream& operator>> (std::istream& is, const TString<T>& st); + + template<class T> class TString{ *************** *** 677,681 **** bool operator>(const TString<T>& lhs, T cRhs) { if (!lhs.m_pBuffer) return true; return lhs.m_pBuffer[0] < cRhs; } template<class T> ! bool operator>(T CLhs, const TString<T>& rhs) { if (!rhs.m_pBuffer) return false; return cLhs < rhs.m_pBuffer[0]; } template<class T> --- 718,722 ---- bool operator>(const TString<T>& lhs, T cRhs) { if (!lhs.m_pBuffer) return true; return lhs.m_pBuffer[0] < cRhs; } template<class T> ! bool operator>(T cLhs, const TString<T>& rhs) { if (!rhs.m_pBuffer) return false; return cLhs < rhs.m_pBuffer[0]; } template<class T> *************** *** 688,692 **** bool operator<(const TString<T>& lhs, T cRhs) { if (!lhs.m_pBuffer) return false; return lhs.m_pBuffer[0] > cRhs; } template<class T> ! bool operator<(T CLhs, const TString<T>& rhs) { if (!rhs.m_pBuffer) return true; return cLhs > rhs.m_pBuffer[0]; } template<class T> --- 729,733 ---- bool operator<(const TString<T>& lhs, T cRhs) { if (!lhs.m_pBuffer) return false; return lhs.m_pBuffer[0] > cRhs; } template<class T> ! bool operator<(T cLhs, const TString<T>& rhs) { if (!rhs.m_pBuffer) return true; return cLhs > rhs.m_pBuffer[0]; } template<class T> *************** *** 699,703 **** bool operator>=(const TString<T>& lhs, T cRhs) { if (!lhs.m_pBuffer) return true; return lhs.m_pBuffer[0] <= cRhs; } template<class T> ! bool operator>=(T CLhs, const TString<T>& rhs) { if (!rhs.m_pBuffer) return false; return cLhs <= rhs.m_pBuffer[0]; } template<class T> --- 740,744 ---- bool operator>=(const TString<T>& lhs, T cRhs) { if (!lhs.m_pBuffer) return true; return lhs.m_pBuffer[0] <= cRhs; } template<class T> ! bool operator>=(T cLhs, const TString<T>& rhs) { if (!rhs.m_pBuffer) return false; return cLhs <= rhs.m_pBuffer[0]; } template<class T> *************** *** 710,714 **** bool operator<=(const TString<T>& lhs, T cRhs) { if (!lhs.m_pBuffer) return false; return lhs.m_pBuffer[0] >= cRhs; } template<class T> ! bool operator<=(T CLhs, const TString<T>& rhs) { if (!rhs.m_pBuffer) return true; return cLhs >= rhs.m_pBuffer[0]; } template<class T> --- 751,755 ---- bool operator<=(const TString<T>& lhs, T cRhs) { if (!lhs.m_pBuffer) return false; return lhs.m_pBuffer[0] >= cRhs; } template<class T> ! bool operator<=(T cLhs, const TString<T>& rhs) { if (!rhs.m_pBuffer) return true; return cLhs >= rhs.m_pBuffer[0]; } template<class T> *************** *** 769,772 **** --- 810,814 ---- std::istream& operator>>(std::istream& is, const TString<T>& st){ ASSERT(0);// not implemented properly + st.reserve(1024); return is >> st.m_pBuffer; } Index: uiremote.cpp =================================================================== RCS file: /cvsroot/mutella/mutella/mutella/uiremote.cpp,v retrieving revision 1.79 retrieving revision 1.80 diff -C2 -d -r1.79 -r1.80 *** uiremote.cpp 19 Aug 2004 09:34:07 -0000 1.79 --- uiremote.cpp 20 Aug 2004 13:16:10 -0000 1.80 *************** *** 144,147 **** --- 144,148 ---- char m_szRemoteDefSort[128]; int m_nMaxResInGroup; + char m_szRemoteUICharset[32]; }; *************** *** 234,240 **** { public: ! MUIRSocket(int nCode, const char* pBuf, int nBufLen) : m_nBufLen(nBufLen), m_nBytesSent(0), m_bError(false) { --- 235,242 ---- { public: ! MUIRSocket(int nCode, const char* pBuf, int nBufLen, const CString& sCharset) : m_nBufLen(nBufLen), m_nBytesSent(0), + m_sCharset(sCharset), m_bError(false) { *************** *** 246,250 **** m_sHeader = "HTTP/1.0 " + DWrdtoStr(nCode) + "\r\nServer: Mutella\r\n"; if (nBufLen>6 && 0==strncasecmp(pBuf,"<HTML>",6)) ! m_sHeader += "Content-type:text/html\r\n"; else if (nBufLen>6 && 0==strncasecmp(pBuf,"<style",6)) m_sHeader += "Content-type:text/css\r\n"; --- 248,256 ---- m_sHeader = "HTTP/1.0 " + DWrdtoStr(nCode) + "\r\nServer: Mutella\r\n"; if (nBufLen>6 && 0==strncasecmp(pBuf,"<HTML>",6)) ! { ! m_sHeader += "Content-type:text/html; charset="; ! m_sHeader += m_sCharset; ! m_sHeader += "\r\n"; ! } else if (nBufLen>6 && 0==strncasecmp(pBuf,"<style",6)) m_sHeader += "Content-type:text/css\r\n"; *************** *** 339,342 **** --- 345,349 ---- // CString m_sHeader; + CString m_sCharset; }; *************** *** 403,406 **** --- 410,416 ---- "Limits the number of individual results shown, when the groped-with-detail " "view mode is selected"); + pP = pPC->AddProperty("RemoteUICharset", m_szRemoteUICharset, 32, "ISO-8859-1"); + pP->SetPropertyDescription("Charset for the HTML UI", + "Select standard HTML character set for the remote UI based on your personal language preference. Default is 'Western' (ISO-8859-1)"); pPC->SetCurrentSection(NULL); return true; *************** *** 588,592 **** if (!bLoginOK) { ! MUIRSocket* pSock = new MUIRSocket(401, HTTP401, strlen(HTTP401)); ASSERT(pSock); // TODO: lock mutex --- 598,602 ---- if (!bLoginOK) { ! MUIRSocket* pSock = new MUIRSocket(401, HTTP401, strlen(HTTP401), m_szRemoteUICharset); ASSERT(pSock); // TODO: lock mutex *************** *** 770,774 **** if (0!=stat(sDiskPath.c_str(), &st) || !(S_ISREG(st.st_mode))) { ! pSock = new MUIRSocket(404, HTTP404, strlen(HTTP404)); ASSERT(pSock); // TODO: lock mutex --- 780,784 ---- if (0!=stat(sDiskPath.c_str(), &st) || !(S_ISREG(st.st_mode))) { ! pSock = new MUIRSocket(404, HTTP404, strlen(HTTP404), m_szRemoteUICharset); ASSERT(pSock); // TODO: lock mutex *************** *** 796,800 **** { //send modified buffer ! pSock = new MUIRSocket(200, sPocessedBuf.c_str(), sPocessedBuf.length()); ASSERT(pSock); } --- 806,810 ---- { //send modified buffer ! pSock = new MUIRSocket(200, sPocessedBuf.c_str(), sPocessedBuf.length(), m_szRemoteUICharset); ASSERT(pSock); } *************** *** 802,806 **** { // send unmodified file ! pSock = new MUIRSocket(200, pFileBuf, nFileSize); ASSERT(pSock); } --- 812,816 ---- { // send unmodified file ! pSock = new MUIRSocket(200, pFileBuf, nFileSize, m_szRemoteUICharset); ASSERT(pSock); } *************** *** 808,812 **** else { ! pSock = new MUIRSocket(404, HTTP404, strlen(HTTP404)); ASSERT(pSock); // TODO: lock mutex --- 818,822 ---- else { ! pSock = new MUIRSocket(404, HTTP404, strlen(HTTP404), m_szRemoteUICharset); ASSERT(pSock); // TODO: lock mutex *************** *** 1926,1946 **** else if (MFT_LibraryStored & nFlags) s = "LibOld"; ! if (MFT_Attempted & nFlags) { if (s.length()) s += "+"; ! s += "Att"; } ! if (MFT_Partial & nFlags) { if (s.length()) s += "+"; ! s += "Part"; } ! if (MFT_InDownload & nFlags) { if (s.length()) s += "+"; ! s += "Downl"; } if (MFT_User & nFlags) --- 1936,1956 ---- else if (MFT_LibraryStored & nFlags) s = "LibOld"; ! if (MFT_InDownload & nFlags) { if (s.length()) s += "+"; ! s += "Dwnl"; } ! else if (MFT_Attempted & nFlags) { if (s.length()) s += "+"; ! s += "Att"; } ! if (MFT_Partial & nFlags) { if (s.length()) s += "+"; ! s += "Part"; } if (MFT_User & nFlags) Index: uitextmode.cpp =================================================================== RCS file: /cvsroot/mutella/mutella/mutella/uitextmode.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** uitextmode.cpp 19 Aug 2004 09:34:07 -0000 1.10 --- uitextmode.cpp 20 Aug 2004 13:16:10 -0000 1.11 *************** *** 705,725 **** else if (MFT_LibraryStored & nFlags) s = "LibOld"; ! if (MFT_Attempted & nFlags) { if (s.length()) s += "+"; ! s += "Att"; } ! if (MFT_Partial & nFlags) { if (s.length()) s += "+"; ! s += "Part"; } ! if (MFT_InDownload & nFlags) { if (s.length()) s += "+"; ! s += "Downl"; } if (MFT_User & nFlags) --- 705,725 ---- else if (MFT_LibraryStored & nFlags) s = "LibOld"; ! if (MFT_InDownload & nFlags) { if (s.length()) s += "+"; ! s += "Dwnl"; } ! else if (MFT_Attempted & nFlags) { if (s.length()) s += "+"; ! s += "Att"; } ! if (MFT_Partial & nFlags) { if (s.length()) s += "+"; ! s += "Part"; } if (MFT_User & nFlags) |
|
From: Max Z. <ma...@us...> - 2004-08-20 13:16:18
|
Update of /cvsroot/mutella/mutella In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32646 Modified Files: configure.in mutella.spec Log Message: gcc 3.4 fixes, some other minor things Index: configure.in =================================================================== RCS file: /cvsroot/mutella/mutella/configure.in,v retrieving revision 1.62 retrieving revision 1.63 diff -C2 -d -r1.62 -r1.63 *** configure.in 27 Sep 2003 12:30:14 -0000 1.62 --- configure.in 20 Aug 2004 13:16:09 -0000 1.63 *************** *** 11,15 **** AC_ARG_PROGRAM ! AM_INIT_AUTOMAKE(mutella,0.4.4a) AC_PREFIX_DEFAULT(/usr/local) --- 11,15 ---- AC_ARG_PROGRAM ! AM_INIT_AUTOMAKE(mutella,0.4.5rc1) AC_PREFIX_DEFAULT(/usr/local) Index: mutella.spec =================================================================== RCS file: /cvsroot/mutella/mutella/mutella.spec,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** mutella.spec 27 Sep 2003 14:43:04 -0000 1.10 --- mutella.spec 20 Aug 2004 13:16:10 -0000 1.11 *************** *** 2,6 **** %define name mutella ! %define ver 0.4.4a %define rel 1 --- 2,6 ---- %define name mutella ! %define ver 0.4.5rc15rc15rc15rc15rc1 %define rel 1 |
|
From: Max Z. <ma...@us...> - 2004-08-19 09:34:22
|
Update of /cvsroot/mutella/mutella/mutella In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28091/mutella Modified Files: asyncsocket.cpp controller.cpp gnudirector.cpp gnudownload.cpp gnudownload.h gnumarkedfiles.cpp gnumarkedfiles.h gnusearch.cpp gnusearch.h structures.h uiremote.cpp uitextmode.cpp Log Message: more consistent tracking of the marked files, their progress, etc Index: asyncsocket.cpp =================================================================== RCS file: /cvsroot/mutella/mutella/mutella/asyncsocket.cpp,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -d -r1.37 -r1.38 *** asyncsocket.cpp 12 Aug 2004 14:57:51 -0000 1.37 --- asyncsocket.cpp 19 Aug 2004 09:34:07 -0000 1.38 *************** *** 484,491 **** int nAddressFormat /*=PF_INET*/) { ! #ifdef _DEBUG ! if (lEvent & FD_WRITE) ! TRACE2("WARNING: calling 'socket' with FD_WRITE on for ",typeid(*this).name()); ! #endif ASSERT(m_hSocket == INVALID_SOCKET); --- 484,491 ---- int nAddressFormat /*=PF_INET*/) { ! //#ifdef _DEBUG ! // if (lEvent & FD_WRITE) ! // TRACE2("WARNING: calling 'socket' with FD_WRITE on for ",typeid(*this).name()); ! //#endif ASSERT(m_hSocket == INVALID_SOCKET); Index: controller.cpp =================================================================== RCS file: /cvsroot/mutella/mutella/mutella/controller.cpp,v retrieving revision 1.61 retrieving revision 1.62 diff -C2 -d -r1.61 -r1.62 *** controller.cpp 9 Aug 2004 11:00:45 -0000 1.61 --- controller.cpp 19 Aug 2004 09:34:07 -0000 1.62 *************** *** 454,457 **** --- 454,458 ---- pSearch->SetAutoget(true); pSearch->SetFilename(name); + //pSearch->SetFileHandle(nFileHandle); pSearch->SetType(ST_ALTERNATIVE); } *************** *** 488,495 **** --- 489,499 ---- int Autoget = 0; // + long Handle = 0; + // int n; PARSE_PARAM(SizeFilterMode); PARSE_PARAM(SizeFilterValue); PARSE_PARAM(Autoget); + PARSE_PARAM(Handle); // parse filename. if it's there we are dealing with a "partial" search int nType = ST_USER; *************** *** 524,527 **** --- 528,533 ---- if (!sFilename.empty()) pSearch->SetFilename(sFilename); + if (Handle) + pSearch->SetFileHandle(Handle); // sha1 SHA1Hash sha1; *************** *** 620,625 **** --- 626,635 ---- // save filename for automatic searches if (pSearch->IsAutomatic()) + { + if (pSearch->m_FileHandle) + fprintf(f,"Handle:%d ",pSearch->m_FileHandle); if (pSearch->m_Filename.size()) fprintf(f,"Filename:%s ", pSearch->m_Filename.c_str()); + } fprintf(f,"\n"); // empty line Index: gnudirector.cpp =================================================================== RCS file: /cvsroot/mutella/mutella/mutella/gnudirector.cpp,v retrieving revision 1.104 retrieving revision 1.105 diff -C2 -d -r1.104 -r1.105 *** gnudirector.cpp 9 Aug 2004 12:36:56 -0000 1.104 --- gnudirector.cpp 19 Aug 2004 09:34:07 -0000 1.105 *************** *** 960,964 **** nShortestNameIndex = i; } ! MGnuDownload* pD = new MGnuDownload(this, results, results[nShortestNameIndex].Name); ASSERT(pD); // add to download queue --- 960,967 ---- nShortestNameIndex = i; } ! // get free file handle ! long nFileHandle = m_pKnownFiles->GetFreeFileHandle(results[0].Size); ! // create the download object ! MGnuDownload* pD = new MGnuDownload(this, results, results[nShortestNameIndex].Name, nFileHandle); ASSERT(pD); // add to download queue *************** *** 969,975 **** { CString s = MakeSearchOfFilename(results[i].Name); ! m_pKnownFiles->AddFile(MFT_Attempted, results[i].Size, results[i].Sha1, s); if (s != sCommonSearch) ! m_pKnownFiles->AddFile(MFT_Attempted, results[i].Size, results[i].Sha1, sCommonSearch); } return true; --- 972,978 ---- { CString s = MakeSearchOfFilename(results[i].Name); ! m_pKnownFiles->AddFile(MFT_Attempted, results[i].Size, results[i].Sha1, s, nFileHandle); if (s != sCommonSearch) ! m_pKnownFiles->AddFile(MFT_Attempted, results[i].Size, results[i].Sha1, sCommonSearch, nFileHandle); } return true; *************** *** 2040,2044 **** if (!bAlready) { ! MGnuDownload* pD = new MGnuDownload(this, rv, pS->GetFilename()); ASSERT(pD); if (pS->GetSizeFilterMode() == LIMIT_EXACTLY) --- 2043,2047 ---- if (!bAlready) { ! MGnuDownload* pD = new MGnuDownload(this, rv, pS->GetFilename(), pS->GetFileHandle()); ASSERT(pD); if (pS->GetSizeFilterMode() == LIMIT_EXACTLY) Index: gnudownload.cpp =================================================================== RCS file: /cvsroot/mutella/mutella/mutella/gnudownload.cpp,v retrieving revision 1.72 retrieving revision 1.73 diff -C2 -d -r1.72 -r1.73 *** gnudownload.cpp 26 Aug 2003 12:22:03 -0000 1.72 --- gnudownload.cpp 19 Aug 2004 09:34:07 -0000 1.73 *************** *** 37,40 **** --- 37,41 ---- #include "gnusearch.h" #include "gnudownload.h" + #include "gnumarkedfiles.h" #include "asyncfile.h" *************** *** 1367,1371 **** // MGnuDownload implementation ! MGnuDownload::MGnuDownload(MGnuDirector* pDir, const ResultVec& results, const CString& sFilename) : m_mutex(true) { m_pDirector = pDir; --- 1368,1372 ---- // MGnuDownload implementation ! MGnuDownload::MGnuDownload(MGnuDirector* pDir, const ResultVec& results, const CString& sFilename, long nFileHandle) : m_mutex(true) { m_pDirector = pDir; *************** *** 1411,1414 **** --- 1412,1417 ---- } // + m_nFileHandle = nFileHandle; + // m_bExactSha1Match = false; // *************** *** 1437,1440 **** --- 1440,1447 ---- SetStatus(TRANSFER_OPENING); m_pFileMng->RequestOpen(m_sName, m_dwFileLength); + + lock.unlock(); + ASSERT(m_pDirector->GetMarkedFiles()); + m_pDirector->GetMarkedFiles()->AddFileFlag(m_dwFileLength, m_nFileHandle, MFT_InDownload); } *************** *** 1452,1455 **** --- 1459,1466 ---- // m_pDirector->RemoveSearchByID(m_dwSearchID); m_bDelSearch = bDeleteSearch; + + lock.unlock(); + ASSERT(m_pDirector->GetMarkedFiles()); + m_pDirector->GetMarkedFiles()->RemoveFile(m_dwFileLength, m_nFileHandle, MFT_InDownload); } *************** *** 1751,1754 **** --- 1762,1766 ---- { pSearch->SetFilename(m_pFileMng->GetName()); + pSearch->SetFileHandle(m_nFileHandle); m_dwSearchID = pSearch->GetID(); } *************** *** 1906,1910 **** m_setSha1.find(sha1) == m_setSha1.end() ) { ! // TODO: modify the file name or somehow make this set persistent m_setSha1.insert(sha1); // modfy the auto-search --- 1918,1922 ---- m_setSha1.find(sha1) == m_setSha1.end() ) { ! // the set is de facto persistent via search m_setSha1.insert(sha1); // modfy the auto-search *************** *** 1915,1918 **** --- 1927,1933 ---- pSearch->AddSha1Hash(sha1); } + // register this SHA1 in the known files database + m_pDirector->GetMarkedFiles()->AddFile(MFT_Attempted, m_dwFileLength, sha1, pSearch ? pSearch->GetSearchString() : "", m_nFileHandle); + m_pDirector->GetMarkedFiles()->AddFileFlag(m_dwFileLength, m_nFileHandle, MFT_InDownload); } pDownloader->OnDataWritten(dwPos, dwSize, pB); *************** *** 1979,1982 **** --- 1994,2001 ---- MSGSRC_DOWNLOAD )); + + lock.unlock(); + ASSERT(m_pDirector->GetMarkedFiles()); + m_pDirector->GetMarkedFiles()->RemoveFile(m_dwFileLength, m_nFileHandle, MFT_Attempted); } Index: gnudownload.h =================================================================== RCS file: /cvsroot/mutella/mutella/mutella/gnudownload.h,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** gnudownload.h 26 Aug 2003 12:22:03 -0000 1.20 --- gnudownload.h 19 Aug 2004 09:34:07 -0000 1.21 *************** *** 60,64 **** { public: ! MGnuDownload(MGnuDirector*, const ResultVec& results, const CString& sFilename); virtual ~MGnuDownload(); MGnuDirector* GetDirector(){return m_pDirector;} --- 60,64 ---- { public: ! MGnuDownload(MGnuDirector*, const ResultVec& results, const CString& sFilename, long nFileHandle); virtual ~MGnuDownload(); MGnuDirector* GetDirector(){return m_pDirector;} *************** *** 126,129 **** --- 126,131 ---- set<SHA1Hash> m_setSha1; bool m_bExactSha1Match; + // KnownFile database support + long m_nFileHandle; // DWORD m_dwSearchID; Index: gnumarkedfiles.cpp =================================================================== RCS file: /cvsroot/mutella/mutella/mutella/gnumarkedfiles.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** gnumarkedfiles.cpp 29 Sep 2003 16:39:17 -0000 1.3 --- gnumarkedfiles.cpp 19 Aug 2004 09:34:07 -0000 1.4 *************** *** 31,35 **** } ! bool MGnuMarkedFiles::AddFile(MarkedFileType type, long nSize, const SHA1Hash& sha1, const CString& sSearch) { MLock lock(m_mutex); --- 31,35 ---- } ! bool MGnuMarkedFiles::AddFile(MarkedFileType type, long nSize, const SHA1Hash& sha1, const CString& sSearch, long nHandle /*=0*/) { MLock lock(m_mutex); *************** *** 44,47 **** --- 44,48 ---- mf.setSearch.insert(sSearch); mf.nSize = nSize; + mf.nHandle = nHandle; mf.nType = type; mf.nUpdateTime = xtime(); *************** *** 68,71 **** --- 69,82 ---- mf.setSearch.insert(sSearch); int nOldType = mf.nType; + // handle handles here + if (nHandle != 0 && nHandle != mf.nHandle) + { + #ifdef _DEBUG + cout << "MGnuMarkedFiles::AddFile() : handle conflict \n"; + cout << " nHandle = " << nHandle << " mf.nHandle = " << mf.nHandle << endl; + cout << " type = " << type << " mf.nType = " << mf.nType << endl; + #endif + mf.nHandle = nHandle; + } // promote types here if (type == MFT_LibraryActual && (mf.nType & MFT_LibraryActual)) *************** *** 79,88 **** mf.nType |= MFT_LibraryActual; } - else if (type == MFT_Downloaded && ((mf.nType & MFT_Attempted) || (mf.nType & MFT_Partial))) - { - mf.nType &= ~MFT_Attempted; - mf.nType &= ~MFT_Partial; - mf.nType |= MFT_Downloaded; - } else if (type == MFT_Partial && (mf.nType & MFT_Attempted)) { --- 90,93 ---- *************** *** 109,112 **** --- 114,118 ---- mf.setSearch.insert(sSearch); mf.nSize = nSize; + mf.nHandle = nHandle; mf.nType = type; mf.nUpdateTime = xtime(); *************** *** 171,175 **** char* t; SMarkedFile mf; ! bool bSha1, bSize, bType, bTime; bSha1 = bSize = bType = bTime = false; while (!feof(f) && !ferror(f)) --- 177,181 ---- char* t; SMarkedFile mf; ! bool bSha1, bHandle, bSize, bType, bTime; bSha1 = bSize = bType = bTime = false; while (!feof(f) && !ferror(f)) *************** *** 189,192 **** --- 195,203 ---- bSha1 = mf.sha1.fromStr( StripWhite(t+5)); } + else if (0 == strncmp(t, "Handle:", 7)) + { + mf.nHandle = atol( StripWhite(t+7) ); + bHandle = (mf.nHandle > 0); + } else if (0 == strncmp(t, "Size:", 5)) { *************** *** 208,216 **** bType = true; } - if (strstr(t, "Completed")) - { - mf.nType |= MFT_Downloaded; - bType = true; - } if (strstr(t, "User")) { --- 219,222 ---- *************** *** 236,239 **** --- 242,248 ---- if (bTime && bType && bSize && ( bSha1 || mf.setSearch.size())) { + // check handle + if (!bHandle) + mf.nHandle = 0; // clean the bogus combinations if (mf.nType & MFT_LibraryStored) *************** *** 302,305 **** --- 311,316 ---- // sha1 fprintf(f,"Sha1: %s\n", itV->sha1.toStr().c_str()); + // handle + fprintf(f,"Handle: %d\n", itV->nHandle); // size fprintf(f,"Size: %d\n", itV->nSize); *************** *** 310,315 **** if ( itV->nType & (MFT_Attempted|MFT_Partial) ) fprintf(f," Attempted"); - if ( itV->nType & MFT_Downloaded ) - fprintf(f," Completed"); if ( itV->nType & MFT_User ) fprintf(f," User"); --- 321,324 ---- *************** *** 323,326 **** --- 332,367 ---- } + long MGnuMarkedFiles::GetFreeFileHandle (long nSize) + { + MLock lock(m_mutex); + // check file size + tMap::iterator it = m_mapFiles.find(nSize); + if (it == m_mapFiles.end()) + return 1; // nothing to remove + return it->second.GetFreeHandle(); + } + + bool MGnuMarkedFiles::AddFileFlag(long nSize, long nHandle, long nType) + { + MLock lock(m_mutex); + // check file size + tMap::iterator it = m_mapFiles.find(nSize); + if (it == m_mapFiles.end()) + return false; + it->second.AddFlag(nHandle, nType); + return true; + } + + void MGnuMarkedFiles::RemoveFile(long nSize, long nHandle, long nType) + { + MLock lock(m_mutex); + // check file size + tMap::iterator it = m_mapFiles.find(nSize); + if (it == m_mapFiles.end()) + return; + it->second.Remove(nHandle, nType); + if (!it->second.Size()) + m_mapFiles.erase(it); + } ///////////////////////////////////////////////////////////////////// *************** *** 340,343 **** --- 381,389 ---- } // + if (mf.nHandle > 0) + { + mapHandle_To_MFInd[mf.nHandle].insert(nIndex); + } + // if (mf.setSearch.empty()) return; *************** *** 368,371 **** --- 414,429 ---- } + long MFileSizeClass::GetFreeHandle() + { + int nHandle=1; + for (map< long, set<long> >::iterator it=mapHandle_To_MFInd.begin(); it!=mapHandle_To_MFInd.end(); ++it) + { + if (it->first>nHandle) + return nHandle; + ++nHandle; + } + return nHandle; + } + void MFileSizeClass::UpdateMaps() { *************** *** 390,393 **** --- 448,452 ---- nNextWIndex = 0; mapIndexSet_To_MFInd.clear(); + mapHandle_To_MFInd.clear(); // build everything for (long i=0; i<vectorMF.size(); ++i) *************** *** 476,477 **** --- 535,583 ---- } + void MFileSizeClass::AddFlag(long nHandle, long nType) + { + if (nHandle == 0 || nType == 0) + return; + + map< long, set<long> >::iterator it = mapHandle_To_MFInd.find(nHandle); + if (it == mapHandle_To_MFInd.end()) + return; + + for(set<long>::iterator its=it->second.begin(); its!=it->second.end(); ++its) + { + ASSERT(*its >= 0); + ASSERT(*its < vectorMF.size()); + tMFVec::iterator itv = vectorMF.begin() + *its; + itv->nType = (itv->nType | nType) & MFT_All; + } + } + + void MFileSizeClass::Remove(long nHandle, long nType) + { + if (nHandle == 0 || nType == 0) + return; + + bool bNeedUpdate = false; + map< long, set<long> >::iterator it = mapHandle_To_MFInd.find(nHandle); + if (it == mapHandle_To_MFInd.end()) + return; + + for(set<long>::reverse_iterator its=it->second.rbegin(); its!=it->second.rend(); ++its) + { + ASSERT(*its >= 0); + ASSERT(*its < vectorMF.size()); + tMFVec::iterator itv = vectorMF.begin() + *its; + itv->nType = (itv->nType & ~nType) & MFT_All; + if (!itv->nType) + { + bNeedUpdate = true; + // we are using reverse iterator here, so it's safe to remove elements + vectorMF.erase(itv); + } + } + + if (bNeedUpdate) + RebuildMaps(); + } + + Index: gnumarkedfiles.h =================================================================== RCS file: /cvsroot/mutella/mutella/mutella/gnumarkedfiles.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** gnumarkedfiles.h 17 Apr 2003 09:08:36 -0000 1.2 --- gnumarkedfiles.h 19 Aug 2004 09:34:07 -0000 1.3 *************** *** 17,22 **** MFT_Attempted = 8, MFT_Partial = 16, ! MFT_Downloaded = 32, MFT_User = 128, // matching result flags MFR_Flags = 0xF000000, --- 17,24 ---- MFT_Attempted = 8, MFT_Partial = 16, ! MFT_InDownload = 32, MFT_User = 128, + // type mask + MFT_All = 0xfff, // matching result flags MFR_Flags = 0xF000000, *************** *** 33,36 **** --- 35,39 ---- set<CString> setSearch; // set of space-separated search terms to match SHA1Hash sha1; // SHA1 hash + long nHandle; // integer handle for fast access (not unique) long nSize; // file size long nType; // see enum MarkedFileType *************** *** 48,51 **** --- 51,59 ---- void RebuildMaps(); // called after element removal or multiple element addition long Match(const SHA1Hash& sha1, const CString& sSearch, long* pnMFIndex = NULL); + + void Remove(long nHandle, long nType); + void AddFlag(long nHandle, long nType); + + inline int Size() { return vectorMF.size(); } protected: *************** *** 58,63 **** --- 66,74 ---- map< set<long>, list<long> > mapIndexSet_To_MFInd; // maps sets of word indexes to indexes in vectorMF + + map< long, set<long> > mapHandle_To_MFInd; // maps handles to indexes in vectorMF void UpdateMapsForSingleElement(long nIndex, const SMarkedFile& mf); + long GetFreeHandle(); }; *************** *** 67,75 **** MGnuMarkedFiles(); ~MGnuMarkedFiles(); ! bool AddFile(MarkedFileType type, long nSize, const SHA1Hash& sha1, const CString& sSearch); bool RemoveFile(long nSize, const SHA1Hash& sha1, const CString& sSearch, bool removeAll = false); long MatchFile(long nSize, const SHA1Hash& sha1, const CString& sSearch); bool LoadList(const CString& sPath); bool StoreList(const CString& sPath); protected: tMap m_mapFiles; // Maps sizes to file entries. --- 78,90 ---- MGnuMarkedFiles(); ~MGnuMarkedFiles(); ! bool AddFile(MarkedFileType type, long nSize, const SHA1Hash& sha1, const CString& sSearch, long nHandle = 0); bool RemoveFile(long nSize, const SHA1Hash& sha1, const CString& sSearch, bool removeAll = false); long MatchFile(long nSize, const SHA1Hash& sha1, const CString& sSearch); bool LoadList(const CString& sPath); bool StoreList(const CString& sPath); + + long GetFreeFileHandle(long nSize); + bool AddFileFlag(long nSize, long nHandle, long nType); + void RemoveFile(long nSize, long nHandle, long nType); protected: tMap m_mapFiles; // Maps sizes to file entries. Index: gnusearch.cpp =================================================================== RCS file: /cvsroot/mutella/mutella/mutella/gnusearch.cpp,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** gnusearch.cpp 17 Sep 2003 13:57:26 -0000 1.31 --- gnusearch.cpp 19 Aug 2004 09:34:07 -0000 1.32 *************** *** 67,70 **** --- 67,72 ---- m_bUpdated = false; m_bAutoget = false; + + m_nFileHandle = 0; m_dwChangeTime = xtime(); Index: gnusearch.h =================================================================== RCS file: /cvsroot/mutella/mutella/mutella/gnusearch.h,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** gnusearch.h 8 Mar 2003 17:27:00 -0000 1.17 --- gnusearch.h 19 Aug 2004 09:34:07 -0000 1.18 *************** *** 42,45 **** --- 42,47 ---- void SetSearchStringAndFilename(const CString& s, const CString& sFilename); void SetFilename(const CString& sFilename); + void SetFileHandle(long nHandle) {m_FileHandle = nHandle;} + long GetFileHandle() { return m_FileHandle; } CString GetSearchString(); *************** *** 113,116 **** --- 115,121 ---- // updated flag bool m_bUpdated; + + // file handle + long m_nFileHandle; // grouping mode switch Index: structures.h =================================================================== RCS file: /cvsroot/mutella/mutella/mutella/structures.h,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** structures.h 10 Jan 2004 18:28:48 -0000 1.23 --- structures.h 19 Aug 2004 09:34:07 -0000 1.24 *************** *** 346,349 **** --- 346,350 ---- bool m_bAutoget; CString m_Filename; // ??? if we really need it here ? + long m_FileHandle; // size filters int m_SizeFilterMode; Index: uiremote.cpp =================================================================== RCS file: /cvsroot/mutella/mutella/mutella/uiremote.cpp,v retrieving revision 1.78 retrieving revision 1.79 diff -C2 -d -r1.78 -r1.79 *** uiremote.cpp 29 Jul 2004 13:05:26 -0000 1.78 --- uiremote.cpp 19 Aug 2004 09:34:07 -0000 1.79 *************** *** 1938,1942 **** s += "Part"; } ! if (MFT_Downloaded & nFlags) { if (s.length()) --- 1938,1942 ---- s += "Part"; } ! if (MFT_InDownload & nFlags) { if (s.length()) Index: uitextmode.cpp =================================================================== RCS file: /cvsroot/mutella/mutella/mutella/uitextmode.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** uitextmode.cpp 12 Aug 2004 14:57:52 -0000 1.9 --- uitextmode.cpp 19 Aug 2004 09:34:07 -0000 1.10 *************** *** 638,643 **** { for (int i=0; i<str.length(); ++i) ! if (str[i]<32 || ! str[i]>127 && str[i]<160 ) str[i]='#'; return str; --- 638,643 ---- { for (int i=0; i<str.length(); ++i) ! if (BYTE(str[i])<32 || ! BYTE(str[i])>127 && BYTE(str[i])<160 ) str[i]='#'; return str; *************** *** 717,721 **** s += "Part"; } ! if (MFT_Downloaded & nFlags) { if (s.length()) --- 717,721 ---- s += "Part"; } ! if (MFT_InDownload & nFlags) { if (s.length()) |