Skip to content

Commit

Permalink
Minor maintenance release.
Browse files Browse the repository at this point in the history
Fixes crash in Web Interface search.
Global server search functionality restored.
Mediainfo.dll 19.04 can be used.
  • Loading branch information
irwir committed May 26, 2019
1 parent ea1c892 commit 5b1884c
Show file tree
Hide file tree
Showing 15 changed files with 230 additions and 226 deletions.
2 changes: 1 addition & 1 deletion EncryptedDatagramSocket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,7 @@ int CEncryptedDatagramSocket::EncryptSendServer(uchar* pbyBuf, int nBufLen, uint
uint8 byRand = (uint8)rand(); // they actually dont really need to be random, but it doesn't hurts either
RC4Crypt((uchar*)&byRand, pbyBuf + CRYPT_HEADER_WITHOUTPADDING + j, 1, &keySendKey);
}
RC4Crypt(pbyBuf, pbyBuf + CRYPT_HEADER_WITHOUTPADDING + byPadLen, nBufLen, &keySendKey);
RC4Crypt(pbyBuf + CRYPT_HEADER_WITHOUTPADDING + byPadLen, pbyBuf + CRYPT_HEADER_WITHOUTPADDING + byPadLen, nBufLen, &keySendKey);

theStats.AddUpDataOverheadCrypt(nCryptHeaderLen);
return nBufLen + nCryptHeaderLen;
Expand Down
2 changes: 1 addition & 1 deletion FileInfoDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ class CMediaInfoDLL
m_pfnMediaInfo_Get = NULL;
m_pfnMediaInfo_Count_Get = NULL;
}
else if (ullVersion < MAKEDLLVERULL(18, 13, 0, 0)) //here ullVersion >= 7.0
else if (ullVersion < MAKEDLLVERULL(19, 5, 0, 0)) //here ullVersion >= 7.0
{
(FARPROC &)m_pfnMediaInfo_New = GetProcAddress(m_hLib, "MediaInfo_New");
(FARPROC &)m_pfnMediaInfo_Delete = GetProcAddress(m_hLib, "MediaInfo_Delete");
Expand Down
5 changes: 4 additions & 1 deletion NetworkInfoDlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,14 +78,17 @@ BOOL CNetworkInfoDlg::OnInitDialog()
m_info.SetParaFormat(pf);
}

cfDef.cbSize = sizeof cfDef;
cfDef.cbSize = (UINT)sizeof cfDef;
if (m_info.GetSelectionCharFormat(cfDef)){
cfBold = cfDef;
cfBold.dwMask |= CFM_BOLD;
cfBold.dwEffects |= CFE_BOLD;
}

CreateNetworkInfo(m_info, cfDef, cfBold, true);
m_info.SetSel(0, 0);
m_info.HideSelection(TRUE, FALSE);
m_info.SetOptions(ECOOP_OR, ECO_SAVESEL);

return TRUE;
}
Expand Down
1 change: 1 addition & 0 deletions PartFileConvert.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,7 @@ int CPartFileConvert::performConvertToeMule(CString folder)
file->GetFileIdentifier().DeleteMD4Hashset();
while (!file->gaplist.IsEmpty())
delete file->gaplist.RemoveHead();
file->ClearTags();

if (file->LoadPartFile(thePrefs.GetTempDir(), file->GetPartMetFileName()) != PLR_LOADSUCCESS) {
//delete file;
Expand Down
21 changes: 8 additions & 13 deletions ServerSocket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -309,21 +309,16 @@ bool CServerSocket::ProcessPacket(const BYTE* packet, uint32 size, uint8 opcode)
pServer->SetTCPFlags(cur_server->GetTCPFlags());
}

uint32 dwServerReportedIP = 0;
if (size >= 20){
dwServerReportedIP = *((uint32*)(packet + 12));
if (::IsLowID(dwServerReportedIP)){
ASSERT( false );
uint32 dwServerReportedIP;
if (size >= 16) {
dwServerReportedIP = PeekUInt32(packet + 12);
if (::IsLowID(dwServerReportedIP)) {
ASSERT(false);
dwServerReportedIP = 0;
}
ASSERT( dwServerReportedIP == la->clientid || ::IsLowID(la->clientid) );
uint32 dwObfuscationTCPPort = *((uint32*)(packet + 16));
if (cur_server != NULL && dwObfuscationTCPPort != 0)
cur_server->SetObfuscationPortTCP((uint16)dwObfuscationTCPPort);
if (pServer != NULL && dwObfuscationTCPPort != 0)
pServer->SetObfuscationPortTCP((uint16)dwObfuscationTCPPort);

}
ASSERT(dwServerReportedIP == la->clientid || ::IsLowID(la->clientid));
} else
dwServerReportedIP = 0;

if (la->clientid == 0)
{
Expand Down
2 changes: 1 addition & 1 deletion ToolTipCtrlX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,7 @@ void CToolTipCtrlX::CustomPaint(LPNMTTCUSTOMDRAW pNMCD)
}
else {
bool bIsBrHeadLine = false;
if (bAutoFormatText && (strLine.Compare(_T("<br>")) == 0 || (bIsBrHeadLine = (strLine.Compare(_T("<br_head>")) == 0)))) {
if (bAutoFormatText && (strLine.Compare(_T("<br>")) == 0 || (bIsBrHeadLine = (strLine.Compare(_T("<br_head>")) == 0)) == true)) {
CPen pen;
pen.CreatePen(0, 1, m_crTooltipTextColor);
CPen *pOP = pdc->SelectObject(&pen);
Expand Down
4 changes: 2 additions & 2 deletions TransferWnd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1422,8 +1422,8 @@ CString CTransferWnd::GetCatTitle(int catid)
, IDS_DOWNLOADING, IDS_ERRORLIKE, IDS_PAUSED, IDS_SEENCOMPL, 0
, IDS_VIDEO, IDS_AUDIO, IDS_SEARCH_ARC, IDS_SEARCH_CDIMG, IDS_SEARCH_DOC
, IDS_SEARCH_PICS, IDS_SEARCH_PRG, 0, IDS_REGEXPRESSION};
if (catid >= 0 && catid < 17)
catid = idscat[catid];

catid = (catid >= 0 && catid < 17) ? idscat[catid] : 0;
return catid ? GetResString((UINT)catid) : CString(_T("?"));
}

Expand Down
13 changes: 6 additions & 7 deletions UploadBandwidthThrottler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -314,17 +314,16 @@ void UploadBandwidthThrottler::Pause(bool paused)
uint32 UploadBandwidthThrottler::GetSlotLimit(uint32 currentUpSpeed)
{
uint32 upPerClient = theApp.uploadqueue->GetTargetClientDataRate(true);

// if throttler doesn't require another slot, go with a slightly more restrictive method
if (currentUpSpeed > 20 * 1024)
if (currentUpSpeed > 20 * 1024) {
upPerClient += currentUpSpeed / 43;

if (upPerClient > UPLOAD_CLIENT_MAXDATARATE)
upPerClient = UPLOAD_CLIENT_MAXDATARATE;
if (upPerClient > UPLOAD_CLIENT_MAXDATARATE)
upPerClient = UPLOAD_CLIENT_MAXDATARATE;
}

//now the final check
if (currentUpSpeed > 12 * 1024)
return max(currentUpSpeed / upPerClient, MIN_UP_CLIENTS_ALLOWED);
return maxi(currentUpSpeed / upPerClient, (uint32)(MIN_UP_CLIENTS_ALLOWED + 3));
if (currentUpSpeed > 7 * 1024)
return MIN_UP_CLIENTS_ALLOWED + 2;
if (currentUpSpeed > 3 * 1024)
Expand All @@ -336,7 +335,7 @@ uint32 UploadBandwidthThrottler::CalculateChangeDelta(uint32 numberOfConsecutive
{
static const uint32 deltas[9] =
{50u, 50u, 128u, 256u, 512u, 512u + 256u, 1024u, 1024u + 256u, 1024u + 512u};
return deltas[min(numberOfConsecutiveChanges, _countof(deltas) - 1)]; //return 1024u+512u for 8 and above
return deltas[min(numberOfConsecutiveChanges, _countof(deltas) - 1)]; //use the last element for 8 and above
}

/**
Expand Down
41 changes: 18 additions & 23 deletions UploadQueue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -434,32 +434,29 @@ bool CUploadQueue::AcceptNewClient(INT_PTR curUploadSlots) const
uint32 CUploadQueue::GetTargetClientDataRate(bool bMinDatarate) const
{
uint32 nOpenSlots = (uint32)GetUploadQueueLength();
// 3 slots or less - 3KiB/s
// 4 slots or more - linear growth by 1 KiB/s steps, cap off at UPLOAD_CLIENT_MAXDATARATE
uint32 nResult;
if (nOpenSlots <= 3)
nResult = 3 * 1024; // 3KB/s for 3 slots or less
else if (nOpenSlots >= 40)
nResult = UPLOAD_CLIENT_MAXDATARATE; //for 40 slots and more
nResult = 3 * 1024;
else
nResult = min(UPLOAD_CLIENT_MAXDATARATE, nOpenSlots * 1280); // linear increase in between, 1280 = 1024*1.25
nResult = min(UPLOAD_CLIENT_MAXDATARATE, nOpenSlots * 1024);

if (bMinDatarate)
nResult = nResult * 3 / 4; // nResult * 0.75f
return nResult;
return bMinDatarate ? nResult * 3 / 4 : nResult;
}

bool CUploadQueue::ForceNewClient(bool allowEmptyWaitingQueue)
{
if (!allowEmptyWaitingQueue && waitinglist.GetSize() <= 0)
return false;

if (::GetTickCount() < m_nLastStartUpload + SEC2MS(1) && datarate < 102400)
if (!allowEmptyWaitingQueue && waitinglist.IsEmpty())
return false;

INT_PTR curUploadSlots = uploadinglist.GetCount();

if (curUploadSlots < MIN_UP_CLIENTS_ALLOWED)
return true;

if (::GetTickCount() < m_nLastStartUpload + SEC2MS(1) && datarate < 102400)
return false;

if (!AcceptNewClient(curUploadSlots) || !theApp.lastCommonRouteFinder->AcceptNewClient()) // UploadSpeedSense can veto a new slot if USS enabled
return false;

Expand All @@ -472,21 +469,20 @@ bool CUploadQueue::ForceNewClient(bool allowEmptyWaitingQueue)
uint32 upPerClient = GetTargetClientDataRate(false);

// if throttler doesn't require another slot, go with a slightly more restrictive method
if (MaxSpeed > 20) // || MaxSpeed == UNLIMITED) - because UNLIMITED > 20
if (MaxSpeed > 20 /*|| MaxSpeed == UNLIMITED */) { //because UNLIMITED > 20
upPerClient += datarate / 43;

if (upPerClient > UPLOAD_CLIENT_MAXDATARATE)
upPerClient = UPLOAD_CLIENT_MAXDATARATE;
if (upPerClient > UPLOAD_CLIENT_MAXDATARATE)
upPerClient = UPLOAD_CLIENT_MAXDATARATE;
}

//now the final check

if (MaxSpeed == UNLIMITED) {
if ((uint32)curUploadSlots < (datarate / upPerClient))
return true;
} else {
uint32 nMaxSlots;
if (MaxSpeed > 12)
nMaxSlots = (MaxSpeed * 1024u) / upPerClient;
nMaxSlots = maxi((MaxSpeed * 1024u) / upPerClient, (uint32)(MIN_UP_CLIENTS_ALLOWED + 3));
else if (MaxSpeed > 7)
nMaxSlots = MIN_UP_CLIENTS_ALLOWED + 2;
else if (MaxSpeed > 3)
Expand All @@ -499,18 +495,17 @@ bool CUploadQueue::ForceNewClient(bool allowEmptyWaitingQueue)
return true;
}
/*
if(m_iHighestNumberOfFullyActivatedSlotsSinceLastCall > uploadinglist.GetSize()) {
if(m_iHighestNumberOfFullyActivatedSlotsSinceLastCall > uploadinglist.GetCount()) {
// uploadThrottler requests another slot. If throttler says it needs another slot, we will allow more slots
// than what we require ourself. Never allow more slots than to give each slot high enough average transfer speed, though (checked above).
//if(thePrefs.GetLogUlDlEvents() && waitinglist.GetSize() > 0)
// AddDebugLogLine(false, _T("UploadQueue: Added new slot since throttler needs it. m_iHighestNumberOfFullyActivatedSlotsSinceLastCall: %i uploadinglist.GetSize(): %i tick: %i"), m_iHighestNumberOfFullyActivatedSlotsSinceLastCall, uploadinglist.GetSize(), ::GetTickCount());
//if(thePrefs.GetLogUlDlEvents() && !waitinglist.IsEmpty())
// AddDebugLogLine(false, _T("UploadQueue: Added new slot since throttler needs it. m_iHighestNumberOfFullyActivatedSlotsSinceLastCall: %i uploadinglist.GetCount(): %i tick: %i"), m_iHighestNumberOfFullyActivatedSlotsSinceLastCall, uploadinglist.GetCount(), ::GetTickCount());
return true;
}
//nope
return false;
*/
return m_iHighestNumberOfFullyActivatedSlotsSinceLastCall > uploadinglist.GetSize();
return m_iHighestNumberOfFullyActivatedSlotsSinceLastCall > uploadinglist.GetCount();
}

CUpDownClient* CUploadQueue::GetWaitingClientByIP_UDP(uint32 dwIP, uint16 nUDPPort, bool bIgnorePortOnUniqueIP, bool* pbMultipleIPs)
Expand Down
4 changes: 2 additions & 2 deletions Version.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@
//
#define VERSION_MJR 0
#define VERSION_MIN 51
#define VERSION_UPDATE 2
#define VERSION_BUILD 2
#define VERSION_UPDATE 3
#define VERSION_BUILD 1

// NOTE: Do not forget to update file: res/eMule.manifest

Expand Down
5 changes: 2 additions & 3 deletions WebServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3925,16 +3925,15 @@ CString CWebServer::_GetSearch(const ThreadData& Data)

CString strResponse = _GetPlainResString(IDS_SW_SEARCHINGINFO);
try {
CSearchDlg *searchdlg = (CSearchDlg *)CWnd::FromHandle(theApp.emuledlg->searchwnd->m_hWnd);
if (pParams->eType != SearchTypeKademlia) {
if (!searchdlg->DoNewEd2kSearch(pParams)) {
if (!theApp.emuledlg->searchwnd->DoNewEd2kSearch(pParams)) {
delete pParams;
pParams = NULL;
strResponse = _GetPlainResString(IDS_ERR_NOTCONNECTED);
} else
Sleep(SEC2MS(2)); // wait for some results to come in (thanks thread)
} else {
if (!searchdlg->DoNewKadSearch(pParams)) {
if (!theApp.emuledlg->searchwnd->DoNewKadSearch(pParams)) {
delete pParams;
pParams = NULL;
strResponse = _GetPlainResString(IDS_ERR_NOTCONNECTEDKAD);
Expand Down
9 changes: 4 additions & 5 deletions emuleDlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -743,13 +743,12 @@ void CALLBACK CemuleDlg::StartupTimer(HWND /*hwnd*/, UINT /*uiMsg*/, UINT_PTR /*
AddLogLine(true, GetResString(IDS_MAIN_READY), (LPCTSTR)theApp.m_strCurVersionLong);

theApp.m_app_state = APP_STATE_RUNNING; //initialization completed
bool bconnect = thePrefs.GetNetworkED2K() || thePrefs.GetNetworkKademlia();
theApp.emuledlg->toolbar->EnableButton(TBBTN_CONNECT, bconnect);
theApp.emuledlg->m_SysMenuOptions.EnableMenuItem(MP_CONNECT, bconnect ? MF_ENABLED : MF_DISABLED);
theApp.emuledlg->serverwnd->GetDlgItem(IDC_ED2KCONNECT)->EnableWindow(thePrefs.GetNetworkED2K());
theApp.emuledlg->toolbar->EnableButton(TBBTN_CONNECT, TRUE);
theApp.emuledlg->m_SysMenuOptions.EnableMenuItem(MP_CONNECT, MF_ENABLED);
theApp.emuledlg->serverwnd->GetDlgItem(IDC_ED2KCONNECT)->EnableWindow();
theApp.emuledlg->kademliawnd->UpdateControlsState(); //application state change is not tracked - force update

if (bconnect && thePrefs.DoAutoConnect())
if (thePrefs.DoAutoConnect())
theApp.emuledlg->OnBnClickedConnect();

#ifdef HAVE_WIN7_SDK_H
Expand Down
2 changes: 1 addition & 1 deletion lang/pt_BR.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
//

// Next default values for new objects
//
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 101
Expand Down
Loading

0 comments on commit 5b1884c

Please sign in to comment.