From db7b43acd5f30186b9a46a0032bca03c40366d7d Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Fri, 23 Mar 2018 07:36:18 +1100 Subject: Restore client name after converting to client When Kakoune forked the sever to background, the newly converted to client process (the original client/server process) was not preserving its previous client name. --- src/remote.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/remote.cc') diff --git a/src/remote.cc b/src/remote.cc index 12313d83..521663f6 100644 --- a/src/remote.cc +++ b/src/remote.cc @@ -566,7 +566,7 @@ bool check_session(StringView session) return connect(sock, (sockaddr*)&addr, sizeof(addr.sun_path)) != -1; } -RemoteClient::RemoteClient(StringView session, std::unique_ptr&& ui, +RemoteClient::RemoteClient(StringView session, StringView name, std::unique_ptr&& ui, int pid, const EnvVarMap& env_vars, StringView init_command, Optional init_coord) : m_ui(std::move(ui)) @@ -576,6 +576,7 @@ RemoteClient::RemoteClient(StringView session, std::unique_ptr&& { MsgWriter msg{m_send_buffer, MessageType::Connect}; msg.write(pid); + msg.write(name); msg.write(init_command); msg.write(init_coord); msg.write(m_ui->dimensions()); @@ -723,13 +724,14 @@ private: case MessageType::Connect: { auto pid = m_reader.read(); + auto name = m_reader.read(); auto init_cmds = m_reader.read(); auto init_coord = m_reader.read_optional(); auto dimensions = m_reader.read(); auto env_vars = m_reader.read_hash_map(); auto* ui = new RemoteUI{sock, dimensions}; if (auto* client = ClientManager::instance().create_client( - std::unique_ptr(ui), pid, + std::unique_ptr(ui), pid, std::move(name), std::move(env_vars), init_cmds, init_coord, [ui](int status) { ui->exit(status); })) ui->set_client(client); -- cgit v1.2.3