More work on redirect

This commit is contained in:
2026-06-02 18:34:03 -04:00
parent 6c9f75bfac
commit d951d2ab61
12 changed files with 298 additions and 201 deletions

View File

@@ -45,7 +45,7 @@ public:
// the invariant that there's always an actor. When the first difference
// transmission arrives, this actor may be deleted, or it may just be
// ignored, at the server's discretion.
actor_id_ = world_->create_login_actor();
actor_id_ = world_->connection_create();
// Clear the unack command queue.
unack_.clear();
@@ -70,7 +70,7 @@ public:
channel_.reset();
// Create the standalone actor.
actor_id_ = world_->create_login_actor();
actor_id_ = world_->connection_create();
// Clear the unack command queue.
unack_.clear();
@@ -102,7 +102,7 @@ public:
if (world_->snapshot_empty()) {
world_->snapshot();
for (const Invocation &inv : unack_) {
world_->invoke(inv);
world_->invoke(0, inv);
}
}
}
@@ -117,10 +117,10 @@ public:
void send_invocation(const Invocation &inv) {
if (channel_ == nullptr) {
world_->invoke(inv);
world_->invoke(0, inv);
} else {
world_to_asynchronous();
world_->invoke(inv);
world_->invoke(0, inv);
unack_.push_back(inv);
StreamBuffer *sb = channel_->out();
sb->write_uint8(util::MSG_INVOKE);
@@ -134,12 +134,6 @@ public:
// set_initial_state_connect(util::ss("nocert:", hostname, ":8085"));
}
void change_actor_id(int64_t actor_id) {
util::dprint("Actor ID changing: ", actor_id);
print_channeler_.reset();
actor_id_ = actor_id;
}
void receive_ack_from_server(StreamBuffer *sb) {
// An ack is just a single byte, so there's nothing left to read.
if (unack_.empty()) {
@@ -148,7 +142,7 @@ public:
return;
}
world_to_synchronous();
world_->invoke(unack_.front());
world_->invoke(0, unack_.front());
unack_.pop_front();
}
@@ -157,7 +151,11 @@ public:
try {
DebugCollector dbc("");
int64_t nactor = world_->patch(sb, &dbc);
if (nactor != actor_id_) change_actor_id(nactor);
if (nactor != actor_id_) {
util::dprint("Actor ID changing: ", nactor);
print_channeler_.reset();
actor_id_ = nactor;
}
// dbc.dump(...);
} catch (const StreamException &sexcept) {
abandon_server();