mademast / sail

✉️ A strictly standards compliant SMTP server
ISC License
10 stars 0 forks source link

Can we manipulate sail into a service based framework-thing? #39

Closed gennyble closed 1 year ago

gennyble commented 1 year ago

Like how hyper has a MakeService and Service. We might not need MakeService, but also we might need it? Because connections can have multiple transactions.

Hyper uses tower-service (crates).

It might help clean things up? But, thinking about it now, we need to respond to things other than flat messages. VRFY, things like that. Maybe an event based framework? That's kind of what we are now? I don't know, but I'm not greatly pleased with the structure of sail as is.

gennyble commented 1 year ago

Current though: "No. Well, kind of"

I think what I dislike the most is how information makes it from saild to sail. Sail is the connection handler, right? So the daemon waits for connections and then hands Sail the AsyncRead like Sail::new(client) or something.

gennyble commented 1 year ago

I did not realize that it kind of already is. I should rename Policy to Service maybe. I mostly like the trait, but I think we can improve it. We can probably collapse forward_path_is_local and path_is_valid into check_path and have it return an enum. (or, well, only saild checks forward_path_is_local, so maybe we can drop it altogether. but it would be useful to know still).

I'll drop it until we need it I guess. New trait looks like:

gennyble commented 1 year ago

yelling at myself in github issues check_path is a bad name and should be path_is_valid, probably, which we already have anyway.

Messages for postmaster are not checked against path_is_valid and are accepted outright.

gennyble commented 1 year ago

No, we can't give it an AsyncRead and AsyncWrite. It doesn't care about the io at all right now and that's adorable. Well, I tried.