Repository navigation
Issue #241 solved: report rejected TCP addresses in the event log - #242
PRINCEKK122 wants to merge 2 commits into
Conversation
connect_tcp_with_validation_and_save validates before connecting, and on failure it set tcp_addr_validation_error and returned without calling tcp_connect. None of the paths that normally report a connection problem were reached, so the press left nothing in the event log. The only feedback was one line of plain text between the address box and the buttons, which is easy to miss. Log the rejection like every other connection failure, and give an empty field its own message. validate_tcp_addr returned "Invalid IP address" for an empty string, which reads as a typo when the greyed 127.0.0.1:9999 is placeholder text and nothing was typed at all. Tests cover both: an empty field and a malformed one each reach the event log and leave no TCP thread behind.
Sanjana-Siddani
left a comment
There was a problem hiding this comment.
Nice fix! All tests pass, and the separate message for an empty field is much clearer than “Invalid IP address.” Heads-up: this and #234 both add tests in the same spot in update.rs, so whichever merges second will need a quick conflict fix. Approving
…logging # Conflicts: # relay/src/state.rs
|
@Sanjana-Siddani same situation here — approved Oct 24, then #247 landed and the merge commit dismissed it. The conflict was in validate_tcp_addr, which #247 had given a per-field example string; the resolution keeps that parameter and threads it through both error messages. I also updated one test assertion, since #247 reworded 'Invalid IP address' to 'Invalid address'. Could you re-approve? |
Sanjana-Siddani
left a comment
There was a problem hiding this comment.
Thanks for updating with main! Still looks good: the empty-address message works and its test passes. The 2 failing relay tests also fail on main (#251, fixed in #265), so they’re not from this PR. Heads-up: this and #234 still conflict in update.rs, so whichever merges second needs a quick fix. Approving
Closes #241.
Problem
connect_tcp_with_validation_and_save(relay/src/update.rs:13) validates the address before connecting. On failure it settcp_addr_validation_errorand returned without callingtcp_connect, so none of the paths that normally report a connection problem were reached. PressingConnect TCPwith a bad address left nothing in the event log.The only feedback was one line of plain text from
tcp_validation_text(relay/src/view.rs:192), sitting between the address box and the buttons. The event log panel added in #183 exists so connection failures are visible; this was the one connection failure that never reached it.The empty-field case is the expensive one.
validate_tcp_addrreturnedInvalid IP address. Use format: 127.0.0.1:9999for an empty string, which reads as "you typed it wrong" when the greyed127.0.0.1:9999is placeholder text and nothing was typed at all.Change
log_eventalongside the inline hint, so it appears in Recent events like every other connection failure.No address entered. Type one, for example 127.0.0.1:9999.Deliberately narrow: this changes only how a rejection is reported. Which address forms are accepted is #240's question, and the placeholder's wording is #239's.
Testing
cargo testpasses, 10/10. Warning count unchanged frommain.Two tests added:
empty_address_is_reported_in_the_event_log— asserts the entry reachesevent_log, that the inline message is the empty-field one rather than the typo one, and that no TCP thread was spawned.malformed_address_is_reported_in_the_event_log— same for a malformed address. Uses127.0.0.1with no port rather than a host name, so the test stays valid whichever way Relay rejects host names, so a changing iMotions IP can't be entered as a name #240 goes.Found while testing #234: about half an hour went to diagnosing a relay that appeared not to connect, with an empty address field and nothing in the log to work from.