port(smarm): track HEAD efbc254 — RFC 014/015 API sync
- gen_server rename (RFC 015, 3e31606): ServerRef/ServerCtx/ServerBuilder
-> GenServerRef/GenServerCtx/GenServerBuilder across conn_actor,
conn_registry, serve, pubsub, channels::session.
- type Timer = () on the three GenServer impls (RFC 015, 57eadb5);
handle_timer/handle_idle/tick_every stay defaulted — opt-in later.
- Watcher and GenServerCtx are now generic over the server type: watcher
fields typed Watcher<Table<M>> / Watcher<Registry<P, K>>; Registry's
struct bounds strengthened to its GenServer impl bounds
(P: Encode + Decode + Send + Sync + 'static, K: SessionKey) so the
Watcher field's G: GenServer bound is satisfiable at the declaration.
- RFC 014 (a866e34) registry: register is (Name<M>, Sender<M>), self-only
— a name is a typed messaging endpoint, not a pid tag. The
introspection-only urus.server / urus.listener.{i} bindings are dropped
rather than faked with unit channels; the whereis integration test is
deleted; a proper messageable-name design is icebox'd in ROADMAP.md.
- Audit vs smarm 6c2b7e9 (queued messages dropped when Receiver drops):
pubsub's prune-on-send-failure retain still holds — send Errs once
receiver_alive is false, so a dropped rx prunes on next broadcast,
exactly what subscriber_count's doc already promised. Freeing stranded
Arc<M> broadcasts is strictly good. No change needed.
- The 7x E0283 in channels/mod.rs were cascade fallout of the generics
changes; dissolved with the port, as discovery predicted.
Suite: 90 lib + 45 integration + 2 doc, green under default, smarm-trace,
phoenix, and all-features. 3 pre-existing clippy lints (conn.rs,
parser.rs, conn_actor.rs; clippy 1.97 strictness) deferred to a follow-up
chore commit to keep this diff pure.
This commit is contained in:
+10
-17
@@ -17,7 +17,7 @@ use crate::conn_registry::{self, Call, Cast, ConnRegistry, Reply};
|
||||
use crate::net::{accept_nonblocking, bind_and_listen, OwnedFd};
|
||||
use crate::plug::Pipeline;
|
||||
|
||||
use smarm::{ChildSpec, OneForOne, Restart, ServerRef, Strategy};
|
||||
use smarm::{ChildSpec, OneForOne, Restart, GenServerRef, Strategy};
|
||||
|
||||
use std::io::{self, ErrorKind};
|
||||
use std::net::{SocketAddr, ToSocketAddrs};
|
||||
@@ -125,7 +125,7 @@ fn listener_loop(
|
||||
listener: Arc<OwnedFd>,
|
||||
pipeline: Pipeline,
|
||||
limits: ConnLimits,
|
||||
registry: ServerRef<ConnRegistry>,
|
||||
registry: GenServerRef<ConnRegistry>,
|
||||
shutdown: Arc<AtomicBool>,
|
||||
) {
|
||||
let fd = listener.as_raw();
|
||||
@@ -327,15 +327,6 @@ pub fn serve_with_shutdown(
|
||||
let sf = shutdown_flag.clone();
|
||||
sup = sup.child(ChildSpec::new(Restart::Transient, move || {
|
||||
println!("urus: listener {} starting", i);
|
||||
// Named for whereis-style introspection. On a restart the
|
||||
// old binding points at a dead pid; smarm's registry
|
||||
// evicts stale bindings lazily, so re-registering the
|
||||
// same name is fine. Ignore the result — a registry
|
||||
// hiccup must not take the listener down.
|
||||
let _ = smarm::register(
|
||||
format!("urus.listener.{i}"),
|
||||
smarm::self_pid(),
|
||||
);
|
||||
listener_loop(lfd.clone(), p.clone(), limits, r.clone(), sf.clone());
|
||||
}));
|
||||
}
|
||||
@@ -343,11 +334,13 @@ pub fn serve_with_shutdown(
|
||||
// faster than that trips the cap and tears the pool down — loud
|
||||
// failure over a zombie server.
|
||||
let sup_h = smarm::spawn(move || sup.run());
|
||||
// Register via the JoinHandle's pid rather than inside the
|
||||
// closure: the binding exists before the supervisor body runs a
|
||||
// single instruction, so an early `whereis("urus.server")` can't
|
||||
// race a None. Result ignored for the same reason as listeners.
|
||||
let _ = smarm::register("urus.server", sup_h.pid());
|
||||
// The old `urus.server` / `urus.listener.{i}` name registrations
|
||||
// are gone with smarm's RFC 014 registry rework: `register` is now
|
||||
// `(Name<M>, Sender<M>)`, self-only — a name is a typed messaging
|
||||
// endpoint, not a pid tag. urus's bindings were introspection-only
|
||||
// with no channel behind them, so they were dropped rather than
|
||||
// faked with a unit channel. A real messageable `urus.server`
|
||||
// name is in the icebox (ROADMAP.md).
|
||||
|
||||
// Block until told to shut down. We poll `try_recv` + `sleep`
|
||||
// rather than parking in `recv`: a smarm `Sender::send` from a
|
||||
@@ -399,7 +392,7 @@ pub fn serve_with_shutdown(
|
||||
}
|
||||
}
|
||||
|
||||
// 5. Our ServerRef drops here. The registry's inbox closes once
|
||||
// 5. Our GenServerRef drops here. The registry's inbox closes once
|
||||
// the last conn's clone drops with it, and the runtime winds
|
||||
// down when the last actor exits.
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user