Skip to content

Commit

Permalink
Bugs fixed:
Browse files Browse the repository at this point in the history
- crash when loading emulecollections
- UPnP crash in Windows XP
- Web Interface regression in Search
- e-mail notifications were broken due to bugs in ATL
- regression in Scheduler's options
- crash when deleting a part file while it was hashing

Allow mediainfo.dll 18.12
  • Loading branch information
irwir committed Feb 26, 2019
1 parent 3e6d36a commit ea1c892
Show file tree
Hide file tree
Showing 68 changed files with 333 additions and 2,076 deletions.
45 changes: 20 additions & 25 deletions AsyncSocketEx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -274,9 +274,6 @@ class CAsyncSocketExHelperWindow
// Ignore further FD_READ events after FD_CLOSE has been received
if (pSocket->m_SocketData.onCloseCalled)
break;
#endif //NOSOCKETSTATES

#ifndef NOSOCKETSTATES
if (nErrorCode)
pSocket->SetState(aborted);
#endif //NOSOCKETSTATES
Expand Down Expand Up @@ -379,7 +376,7 @@ class CAsyncSocketExHelperWindow
pSocket->OnClose(nErrorCode);
break;
}
} else { //Dispatch notification to the lowest layer
} else { //Dispatch notification to the lower layer
if (nEvent == FD_READ) {
// Ignore further FD_READ events after FD_CLOSE has been received
if (pSocket->m_SocketData.onCloseCalled)
Expand Down Expand Up @@ -498,12 +495,10 @@ class CAsyncSocketExHelperWindow
pSocket->OnConnect(nErrorCode);

#ifndef NOSOCKETSTATES
if (!nErrorCode) {
if (((pSocket->m_nPendingEvents&FD_READ) && pSocket->GetState() == connected) && (pSocket->m_lEvent & FD_READ))
pSocket->OnReceive(0);
if (((pSocket->m_nPendingEvents&FD_FORCEREAD) && pSocket->GetState() == connected) && (pSocket->m_lEvent & FD_READ))
pSocket->OnReceive(0);
if (((pSocket->m_nPendingEvents&FD_WRITE) && pSocket->GetState() == connected) && (pSocket->m_lEvent & FD_WRITE))
if (!nErrorCode && pSocket->GetState() == connected) {
if (pSocket->m_nPendingEvents & (FD_READ | FD_FORCEREAD) && pSocket->m_lEvent & FD_READ)
pSocket->OnReceive(0);
if (pSocket->m_nPendingEvents & FD_WRITE && pSocket->m_lEvent & FD_WRITE)
pSocket->OnSend(0);
}
pSocket->m_nPendingEvents = 0;
Expand Down Expand Up @@ -750,7 +745,7 @@ bool CAsyncSocketEx::Create(UINT nSocketPort /*=0*/, int nSocketType /*=SOCK_STR

if (reusable && nSocketPort != 0) {
BOOL value = TRUE;
SetSockOpt(SO_REUSEADDR, reinterpret_cast<const void *>(&value), sizeof value);
SetSockOpt(SO_REUSEADDR, reinterpret_cast<const void*>(&value), sizeof value);
}

if (!Bind(nSocketPort, sSocketAddress)) {
Expand Down Expand Up @@ -1006,23 +1001,22 @@ bool CAsyncSocketEx::Connect(const CString &sHostAddress, UINT nHostPort)

bool ret = false;
for (m_SocketData.nextAddr = m_SocketData.addrInfo; m_SocketData.nextAddr; m_SocketData.nextAddr = m_SocketData.nextAddr->ai_next) {
bool newSocket = (m_SocketData.nFamily != AF_UNSPEC);
bool newSocket = (m_SocketData.nFamily == AF_UNSPEC);
if (newSocket)
m_SocketData.hSocket = socket(m_SocketData.nextAddr->ai_family, m_SocketData.nextAddr->ai_socktype, m_SocketData.nextAddr->ai_protocol);

if (m_SocketData.hSocket == INVALID_SOCKET)
continue;

m_SocketData.nFamily = (ADDRESS_FAMILY)m_SocketData.nextAddr->ai_family;
AttachHandle();
if (newSocket) {
m_SocketData.nFamily = (ADDRESS_FAMILY)m_SocketData.nextAddr->ai_family;
AttachHandle();
}

if (AsyncSelect(m_lEvent))
if (!m_pFirstLayer || !WSAAsyncSelect(m_SocketData.hSocket, GetHelperWindowHandle(), m_SocketData.nSocketIndex + WM_SOCKETEX_NOTIFY, FD_SIX_EVENTS))
if (Bind(m_nSocketPort, m_sSocketAddress)) {
ret = Connect(m_SocketData.nextAddr->ai_addr, (int)m_SocketData.nextAddr->ai_addrlen);
if (ret || GetLastError() == WSAEWOULDBLOCK)
break;
}
if (AsyncSelect(m_lEvent) && (!newSocket || Bind(m_nSocketPort, m_sSocketAddress))) {
ret = Connect(m_SocketData.nextAddr->ai_addr, (int)m_SocketData.nextAddr->ai_addrlen);
if (ret || GetLastError() == WSAEWOULDBLOCK)
break;
}

if (newSocket) {
m_SocketData.nFamily = AF_UNSPEC;
Expand Down Expand Up @@ -1265,9 +1259,10 @@ void CAsyncSocketEx::RemoveAllLayers()

int CAsyncSocketEx::OnLayerCallback(std::list<t_callbackMsg> &callbacks)
{
for (std::list<t_callbackMsg>::const_iterator iter = callbacks.begin(); iter != callbacks.end(); ++iter)
delete[] iter->str;
callbacks.clear();
while (callbacks.begin() != callbacks.end()) {
delete[] callbacks.begin()->str;
callbacks.pop_front();
}
return 0;
}

Expand Down
14 changes: 9 additions & 5 deletions ClientUDPSocket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -515,7 +515,8 @@ SocketSentBytes CClientUDPSocket::SendControlData(uint32 maxNumberOfBytesToSend,
nLen = EncryptSendClient(sendbuffer, nLen, cur_packet->pachTargetClientHashORKadID, cur_packet->bKad, cur_packet->nReceiverVerifyKey, (cur_packet->bKad ? Kademlia::CPrefs::GetUDPVerifyKey(cur_packet->dwIP) : 0u));
//DEBUG_ONLY( AddDebugLogLine(DLP_VERYLOW, false, _T("Sent obfuscated UDP packet to clientIP: %s, Kad: %s, ReceiverKey: %u"), (LPCTSTR)ipstr(cur_packet->dwIP), cur_packet->bKad ? _T("Yes") : _T("No"), cur_packet->nReceiverVerifyKey) );
}
if (SendTo(sendbuffer, nLen, cur_packet->dwIP, cur_packet->nPort) >= 0) {
cLen = SendTo(sendbuffer, nLen, cur_packet->dwIP, cur_packet->nPort);
if (cLen >= 0) {
sentBytes += nLen; // ZZ:UploadBandWithThrottler (UDP)
delete cur_packet->packet;
delete cur_packet;
Expand All @@ -538,19 +539,22 @@ SocketSentBytes CClientUDPSocket::SendControlData(uint32 maxNumberOfBytesToSend,
// <-- ZZ:UploadBandWithThrottler (UDP)
}

int CClientUDPSocket::SendTo(uchar* lpBuf, int nBufLen, uint32 dwIP, uint16 nPort)
int CClientUDPSocket::SendTo(uchar *lpBuf, int nBufLen, uint32 dwIP, uint16 nPort)
{
// NOTE: *** This function is invoked from a *different* thread!
//Currently called only locally; sendLocker must be locked by the caller
int result = CAsyncSocket::SendTo(lpBuf, nBufLen, nPort, ipstr(dwIP));
if (result == SOCKET_ERROR) {
DWORD dwError = GetLastError();
if (dwError == WSAEWOULDBLOCK)
DWORD dwError = (DWORD)CAsyncSocket::GetLastError();
if (dwError == WSAEWOULDBLOCK) {
m_bWouldBlock = true;
return -1; //blocked
}
if (thePrefs.GetVerbose())
DebugLogError(_T("Error: Client UDP socket, failed to send data to %s:%u: %s"), (LPCTSTR)ipstr(dwIP), nPort, (LPCTSTR)GetErrorMessage(dwError, 1));
return 0; //error
}
return result;
return result; //success
}

bool CClientUDPSocket::SendPacket(Packet *packet, uint32 dwIP, uint16 nPort, bool bEncrypt, const uchar* pachTargetClientHashORKadID, bool bKad, uint32 nReceiverVerifyKey)
Expand Down
2 changes: 1 addition & 1 deletion CollectionFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,6 @@ bool CCollectionFile::InitFromLink(const CString& sLink)
delete pLink;
return false;
}
delete pLink;

taglist.Add(new CTag(FT_FILEHASH, pFileLink->GetHashKey()));
m_FileIdentifier.SetMD4Hash(pFileLink->GetHashKey());
Expand All @@ -140,6 +139,7 @@ bool CCollectionFile::InitFromLink(const CString& sLink)
m_FileIdentifier.SetAICHHash(pFileLink->GetAICHHash());
}

delete pLink;
return true;
}

Expand Down
2 changes: 1 addition & 1 deletion CreditsThread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,7 @@ void CCreditsThread::InitText()

m_arCredits.Add(_T("03:00:eMule"));
m_arCredits.Add(_T("02:01:Version ") + theApp.m_strCurVersionLong);
m_arCredits.Add(_T("01:06:Copyright (C) 2002-2018 Merkur"));
m_arCredits.Add(_T("01:06:Copyright (C) 2002-2019 Merkur"));
m_arCredits.Add(_T("S:50"));
m_arCredits.Add(_T("02:04:Developers"));
m_arCredits.Add(_T("S:5"));
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, 6, 0, 0)) //here ullVersion >= 7.0
else if (ullVersion < MAKEDLLVERULL(18, 13, 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
Loading

0 comments on commit ea1c892

Please sign in to comment.