EC: expose search result rating to remote clients - #452
Merged
Conversation
CEC_SearchFile_Tag now forwards the aggregated user rating from CSearchFile to EC clients. Previously this field was only available in the native GUI (which reads CSearchFile objects directly from memory); remote GUIs and EC-based tools could not see it. Only rating is exposed — comments are not populated for search results in aMule (m_strComment is never set in SearchFile.cpp; only m_iUserRating is aggregated from FT_FILERATING tags across sources). Encoder: add EC_TAG_KNOWNFILE_RATING to CEC_SearchFile_Tag when the search result has a rating (reuses the existing tag ID already used by CEC_SharedFile_Tag). Decoder: CSearchFile constructor in amule-remote-gui.cpp reads the new tag and populates m_iUserRating. Header: add GetRating() accessor to CEC_SearchFile_Tag (same pattern as CEC_SharedFile_Tag).
got3nks
added a commit
to got3nks/amule-ec-node
that referenced
this pull request
Apr 17, 2026
Requires aMule PR #452 (amule-project/amule#452) to be applied. Older builds omit the tag and result.rating stays undefined.
ngosang
pushed a commit
to ngosang/amule
that referenced
this pull request
Jul 12, 2026
amule-project#444) (amule-project#452) When the EC connection to the remote core dropped after startup (e.g. the machine slept or a VPN/SSH tunnel restarted and the socket died), amulegui showed "aMule has terminated probably" and exited, forcing a full restart + resync. It now reconnects in the background instead. Reconnect mechanics: - CLibSocket::ResetForReconnect() swaps a fresh asio impl onto the SAME CRemoteConnect, so the socket can be re-opened after a loss without recreating the object (every remote container pins its CRemoteConnect). CECSocket::ResetProtocolState() rewinds the packet-reassembly state machine so a mid-packet read left over from the drop can't misparse the reconnected session's first bytes. - On a post-startup loss the UI is frozen behind a modal reconnect dialog (attempt counter + countdown to the next try + "Abort and exit"); attempts run every 5 s with a 15 s per-attempt watchdog, until the connection is restored or the user aborts. - amuleweb / amulecmd keep their fail-fast _exit(1) on loss (the new paths are all gated on the GUI's m_notifier). Two fixes the reused socket needs to hand off cleanly: - Clear m_ErrorCode on a successful connect: the swap can leave a stale EBADF from an aborted read on the impl, and SocketRealError() would then make CECSocket::WritePacket refuse to send the login. - Swallow a LibSocketLost that arrives while a dial is still pending (EC_CONNECT_SENT): it's a stale event queued for the previous connection before the impl was swapped, and would otherwise abort the in-flight reconnect. A genuinely failed dial is caught by the connect-timeout watchdog instead. Resync is reconcile-in-place, not wipe+rebuild, so scroll and selection survive: - Polling resumes and the fresh full snapshot updates rows in place / adds new / prunes gone. A partial-update server won't re-emit FILE_REMOVED for files deleted while disconnected, so CKnownFilesRem forces a one-shot prune-by-absence on the first post-reconnect update (m_reconnectReconcile). The server / client / friend lists already prune every poll, so they self-heal with no special case. - The daemon keeps its RLE gap/part/req-status encoders per connection, so a reconnect restarts them from an empty baseline. The reused CKnownFile / CPartFile decoders (m_PartFileEncoderData, m_partStatus) are reset to match, or the first differential update would XOR against a stale buffer and paint garbage (all-red progress bars, wrong availability shading). - Large libraries stay responsive: the reconnect poll wraps the download + shared list ctrls in BeginBatchUpdate()/EndBatchUpdate() (one repaint + one sort, per-item sort suppressed) so a 10k+ resync doesn't hitch. No daemon or EC wire-protocol changes: reconnect works against a stock amuled.
ngosang
pushed a commit
to ngosang/amule
that referenced
this pull request
Jul 13, 2026
amule-project#444) (amule-project#465) Follow-up to amule-project#452, from two issues reported after a successful reconnect. 1. Empty download queue + shared file lists (restart required) The EC request FIFO (CRemoteConnect::m_req_fifo) assumes the core answers every request in FCFS order. A socket dropped mid-poll leaves the requests that were on the air unanswered, so their handlers linger in the FIFO. After the reconnect each reply pops the wrong (stale) handler: a stats reply routed to CKnownFilesRem drives its one-shot post-reconnect reconcile against an empty file set, and the absence-prune wipes the whole library. It is intermittent (depends how many requests were in flight at the drop) and only a full restart clears it, since a fresh process starts with an empty FIFO. - CRemoteConnect::DiscardRequestQueue() flushes the FIFO and zeroes the in-flight counter on reconnect, rewinding each orphaned handler's request state (CECPacketHandlerBase::AbortPendingRequest, overridden by CRemoteContainer to reset its request SM to IDLE) so a container whose reply died still re-requests instead of wedging. - Defensive guard in CKnownFilesRem::ProcessUpdate: if the first post-reconnect reply carries no files while the list is still populated, skip the absence-prune and keep the one-shot armed for the next poll. 2. Ellipsis mojibake on Windows The reconnect status strings embedded a literal U+2026. On the untranslated (English) path the narrow msgid is decoded with the C locale (CP1252 on Windows), rendering as garbage in both the dialog and the log. Replaced the ellipsis with "..." in every source msgid, and -- to keep existing translations valid -- in every catalog msgid/msgstr as well (regen leaves no new fuzzy entries). Client-side only: no daemon or EC wire-protocol change, so the updated aMuleGUI works against a stock amuled.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
CEC_SearchFile_Tagnow forwards the aggregated user rating fromCSearchFileto EC clients. Previously this field was only available in the native GUI (which readsCSearchFileobjects directly from memory); remote GUIs and EC-based tools could not see it.Search results already carry ratings from ED2K sources and KAD publishers via
FT_FILERATINGtags, and aMule already aggregates them across sources intom_iUserRating(SearchFile.cpp:76-77,SearchFile.cpp:246-302). The native GUI renders them directly (SearchListCtrl.cpp:873-874). This patch simply bridges the gap in the EC protocol so remote clients can access the same data.Only rating is exposed — comments are not populated for search results in aMule (
m_strCommentis never set inSearchFile.cpp; onlym_iUserRatingis aggregated fromFT_FILERATINGtags).Changes
ECSpecialCoreTags.cpp): addEC_TAG_KNOWNFILE_RATINGtoCEC_SearchFile_Tagwhen the search result has a rating (reuses the existing tag ID already used byCEC_SharedFile_Tag)amule-remote-gui.cpp):CSearchFileconstructor reads the new tag and populatesm_iUserRatingECSpecialTags.h): addGetRating()accessor toCEC_SearchFile_Tag(same pattern asCEC_SharedFile_Tag)Backward compatibility
EC_TAG_KNOWNFILE_RATINGalready exists