MCCP Fix Revision 3. Removed an un-needed bool, and a good bit of ext…#1024
MCCP Fix Revision 3. Removed an un-needed bool, and a good bit of ext…#1024vadi2 merged 7 commits intoMudlet:developmentfrom
Conversation
… code for MCCP, also tested farely well. -MH
…ra code that isn't needed for compression which fixes a few other bugs with it. -MH
|
Awesome, thanks so much! Will have a look at testing this. Could you let us know what were the bugs with it, so we can confirm they're gone? |
|
Actually I shouldn't have said bugs, but more like it using the protocol a bit in the wrong way which could lead to bugs happening for certain oddly coded muds with weird compression schemes that try and pass off the wrong version. Mostly got rid of all the bloat and just did it more correctly, after an 18 hour test run of the code it not only seemed stable but also don't actually have to disconnect anymore if you turn force compression off back to on. (If a mud has a compress or +compress command to turn it back on anyways.) Got rid of conflicting code that just wasn't needed and took up cpu time. Another is a bug which may be totally unrelated or just someone else's cache or properties, but when i do a copyover sometimes it would go blank at password and never turn back on, could have also been mud code. But haven't been able to replicate it myself after this fix. |
|
May make a later revision, that also turns compression back on automatically if force off compression is unchecked after being checked and to remove the commented out code. And perhaps fix a few other things I noticed that may behave a little oddly here in a few days or so once this is confirmed to have worked for the masses. |
|
Sorry you've kinda lost me here. I don't know what exactly changed here in terms of functionality, I see that code is changed - how does it change the behaviour? I'm not familiar with MCCP internals and
Is kind of super vague :( Basically, what was the driver for this change so I'm on the same page as you? |
|
Any updates on this? I'd love to have the improvements but I have no idea what's going on here to be able to test the before / after behaviour. |
|
Well to be complete on it.. I've been using the fix for about a week now with no issues at all with popping on or off of compression and copyover's no problem.. have done about 500 copyovers to test and also switching of compression on and off over a few thousand times with timers. had no issues. does this fix need to be redone again? notice conflicting file. (Also if you are really wondering it was mostly an issue of having un-needed code that was messing up the loop a little bit, but this fix gets rid of defunct code and an un-needed boolean that is no longer needed. Nothing to hard core was changed.) |
|
Yeah but as you'd know, every MUD driver is different and has different bugs - might work for you - might not for someone else. I need to be able to test this myself across a range of MUDs to make sure we don't break it for someone else hey :) I'll give it a go and report back! Don't worry about the merge conflict - we broke your PR and we'll fix it. If you're really curious though, read up on git conflict resolution, it's something you'll need to do eventually in a distributed development environment haha. |
|
Yeah i'll read up on those.. i haven't pushed the newer one with the commented code that is cut out, and do appreciate the testing for elsewhere. was just an automatic type of testing i've been doing with it.. my server shuts off compression before a copy over is done, and then resends compress_will after the copyover and mudlet catches right on every time and switches back on. stays off if you force it off, has no problem at all catching on to MCCP v2. So yes testing on a mud that has MCCP v1 would be a good idea as I have dropped complete support for version 1 from my server also on another note the support tag can be added soon as i know people are done with TBuffer.cpp for the other bug. can just enable all support or just what is needed. |
|
seems to need mEncoding in there for build :) |
|
Oops. If you do a git pull, you'll get the new code, mind adding it in? |
|
Tried, do i need to make a new PR for it? |
|
Nope, just commit and push, the PR will auto-update. |
|
Finally got it, had some issues with my fork. |
deathlire
left a comment
There was a problem hiding this comment.
Don't know that got in there, but don't see anything bad with it 👍
|
Didn't you cut |
…ved from ctelnet.h as well -MH
|
Yeah not sure how it slipped back in, but at least that made me also think to get rid of it in ctelnet.h as well. So it's all good to go now once the check passes. |
SlySven
left a comment
There was a problem hiding this comment.
I suspect most of this is good, but I am not sure whether we are/were correctly implementing the Telnet sub-option negotiation process here anyhow...
| // Reset the option state so we can re-enable compression again in the future | ||
| // such as in the case of a copyover -JM | ||
| hisOptionState[static_cast<int>(OPT_COMPRESS)] = false; | ||
| hisOptionState[static_cast<int>(OPT_COMPRESS2)] = false; |
There was a problem hiding this comment.
Are you sure you should be deleting these? if I understand (and I am not sure that I do 🤕 ) the correct procedure ("Q Method" ?) for negotiating Telnet Sub-Options (i.e. RFC1143) it means we should be tracking the option state for all options and this is part of that...
I think we are also broken on some other options as well but the whole Telnet option negotiating thingy is something I still have to get my head around.
There was a problem hiding this comment.
Thing is though when those option states are false they never go back to true, and is unneccesary to keep an eye on them, if hisOptionState[foo] = false .. and then server requests it again it stays false, but you can have those, that is the only reason I just left them commented out and didn't get rid of them. They actually don't fix copyover or anything else, perhaps they did for something a good while ago, not sure. But anyways once it's negotiated it's done for unless you plan to have more buttons for turning off and on compression by sending a WANT for it and such and hope the server listens. Other than that I don't see a reason to keep an eye on something that can be found out by .. if (OPT_COMPRESS || OPT_COMPRESS2) do this or that.. I'm not a C++ expert by any means either, I do mostly just C. But can tinker with c++ and fix things.
There was a problem hiding this comment.
Haven't had a reason for adding buttons for this so we won't be cluttering up the UI! I agree it seems that dead code can go.
There was a problem hiding this comment.
As I understand it the default state for any Telnet sub-option must be false so your:
Thing is though when those option states are false they never go back to true, and is unneccesary to keep an eye on them...
is puzzling to me - but is that is my problem? 😖 Or should we retain just those two lines (and the comment)?
There was a problem hiding this comment.
I think you do need to keep those two hisOptionState up to date because they would be needed for a Telnet Status sub-option report which we DO support (see code for OPT_STATUS i.e. option 5).
There was a problem hiding this comment.
Fair point, we should report it back when asked about it - and we need to keep track of it in order to do that.
| qDebug() << "Listening for new compression sequences"; | ||
| return -1; | ||
| } | ||
| /* TODO: Remove this commented code once it is deemed safe. -MH |
There was a problem hiding this comment.
We can probably rid of it once PR passes testing!
There was a problem hiding this comment.
Only left it there just in case it was something you may need. To work correctly it doesn't need that and knows what's going on. So up to you on that one :)
|
|
||
| // initialize default encoding | ||
| mEncoding = "UTF-8"; | ||
| encodingChanged(mEncoding); |
|
@SlySven could you review this please? |
|
In the interest of time I've applied the change. |
|
This point is moot. No mud server asks our state without sending a request to send one, and I'm not clear on C++ or this function hisOptionState ..but no mud server needs it in the first place, this is all client side. |
|
Where are you going to set them to true? can't see the changes..? a server asks WILL DO or WONT ..they do not care if you have a state of being in that i know of..if not please correct me. |
|
Unless I am reading the code wrong old/new line 688/690 in cTelnet.cpp contains |
|
Yep, the option is back in c3a6185, and I think we've exhausted the limits of useful conversation of this - let's move on. Is this good to go? |
SlySven
left a comment
There was a problem hiding this comment.
OK, glad we got that option tracking stuff sorted (I just hope all the other sub-options are also done correctly - but that will take more study and is not the target of this PR 😈) so ![]()
|
I think we reached a good middle ground - got rid of uneeded code without sactificing functionality. Thanks @deathlire for the improvement to Mudlet, hope to see more 😄 |
…ra code that isn't needed for compression which fixes a few other bugs with it. -MH