Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Part five: Doorman rewrite #54

Merged
merged 81 commits into from
Aug 2, 2020
Merged

Part five: Doorman rewrite #54

merged 81 commits into from
Aug 2, 2020

Conversation

mattgodbolt
Copy link
Owner

@mattgodbolt mattgodbolt commented Jul 28, 2020

Now ready, based off #83 now to hopefully show the actual differences.

Previous TODOs:

  • Tests
  • Fixing the god-awful input parsing and telnet option handling.
  • Run some fuzzing/bad behaving clients over it
  • Coding convention renames
  • Channel to no longer be a static array (and probably use non-repeating channel IDs to get around some race conditions I've noted). Channels written so construction initialises everything and all the horrid pointers-instead-of-reference and magic numbers in newConnection can go. CC @philjessies for the comment he made about the crimes committed in newConnection
  • Replace log_out (with maybe spdlog or just fmt::print(stderr...))
  • Replace char buffer[4096] and similar with some max-sized payload constant, shared between MUD and doorman. See @snellers comment about MaxIncoming
  • grep for TODO, e.g. the writev stuff.

@mattgodbolt mattgodbolt added the enhancement New feature or request label Jul 28, 2020
src/doorman/Channel.cpp Outdated Show resolved Hide resolved
@mattgodbolt mattgodbolt changed the title Doorman rewrite Part five: Doorman rewrite Aug 1, 2020
@mattgodbolt mattgodbolt marked this pull request as ready for review August 1, 2020 15:53
src/doorman/Doorman.cpp Outdated Show resolved Hide resolved
src/comm.c Show resolved Hide resolved
src/doorman/Channel.cpp Outdated Show resolved Hide resolved
mattgodbolt added a commit that referenced this pull request Aug 2, 2020
* Part one of doorman PR (see #54)
* Introduce a file descriptor C++ wrapper.
* Add a header to define byte
mattgodbolt added a commit that referenced this pull request Aug 2, 2020
Builds on #80

* Introduce a standalone, tested telnet protocol handler.
mattgodbolt added a commit that referenced this pull request Aug 2, 2020
Builds on #81

A general purpose ID allocator. The allocator gives out small integer identifiers, along with a reference-counted reservation that holds them as "in use".

IDs are eagerly recycled once the reference count hits zero.

Useful for Xania and doorman to both have a "vote" for which channels are in-use. Previously we had bugs where there was a race in doorman if someone disconnected while xania was about to send a ton of info while another connection came in. The new connection would be given the channel ID of the recently-closed connection and would thus be delivered all the messages for the old connection.
mattgodbolt added a commit that referenced this pull request Aug 2, 2020
* Part four of doorman PR (see #54)

Builds on #82

Adds a logger, based on spdlog.
Base automatically changed from mg/doorman_log to main August 2, 2020 13:44
 Now uses PACKET_MAX_PAYLOAD_SIZE to prevent ever sending more than we can handle over the xania<->doorman protocol.

Fixes SendPacket to actually check the right things and return the right value.

Per discussion with @snellers I think this handles the xania->doorman side of things. The doorman->xania and buffer handling on the xania side I think should be fixed as part of #46.
@mattgodbolt
Copy link
Owner Author

Thanks all: will merge and be damned after I get back from being out. I'll then babysit an upgrade and make sure all works out ok!

@mattgodbolt mattgodbolt merged commit 0df3453 into main Aug 2, 2020
@mattgodbolt mattgodbolt deleted the mg/doorman branch August 2, 2020 23:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
3 participants