summaryrefslogtreecommitdiff
path: root/src/remote.hh
AgeCommit message (Collapse)Author
2025-07-08Replace std::unique_ptr with a custom implementationMaxime Coste
<memory> is a costly header we can avoid by just implementing UniquePtr ourselves, which is a pretty straightforward in modern C++, this saves around 10% of the compilation time here.
2024-11-12Fail rename-session instead of creating overlong socket pathsJohannes Altmanninger
Commit 9cf8a3ccd (Check for buffer overflow when constructing the socket path., 2022-04-07) made $ kak -s $(printf %0100d) fail but forgot to do the same for $ kak -e "rename-session $(printf %0100d)" which silently succeeds, only to fail at the next $ echo nop | kak -p $(printf %0100d) Fatal error: socket path too long: '/run/user/1000/kakoune/0000...' Let's fail earlier. While at it, don't validate "m_session" redundantly. I'm not sure if we should validate the socket names in "kak -clear"; I guess it doesn't matter.
2023-09-26Add a daemonize-session command and refactor local client handlingMaxime Coste
Make it possible to move the current session to a daemon one after the fact, which is useful to ensure the session state survives client disconnecting, for example when working from ssh.
2021-05-01Rework session directory logicMaxime Coste
Do not use a shared kakoune/ directory for all users to avoid the complexity of having to set the sticky bit on that dir, resolve the session directoy only once by using a static variable and an immediately evaluated lambda. This fixes an annoyance whenver using `su` and having Kakoune refuse to start due to XDG_RUNTIME_DIR still being set.
2020-10-19Allow quiting last client with unsaved buffer in daemon modeMaxime Coste
Because the server will out-live that client's disconnection it is still ok to have modified buffers, the server will complain on `kill`. Fixes #3801
2020-05-10Support piping data to client stdinMaxime Coste
Pass the client stdin fd to the server and open a fifo buffer from it. Fixes #3394
2019-08-20Fix kak -l when $XDG_RUNTIME_DIR is setJason Felice
2019-08-05Use $XDG_RUNTIME_DIRJason Felice
Falls back on old mechanism if `XDG_RUNTIME_DIR` is not set. The ability to specify a session as "<user>/<name>" was removed, since it isn't possible to compute the value of `XDG_RUNTIME_DIR` for another user, we wouldn't have access to it if we could, and it would be awkward to support this feature only when `XDG_RUNTIME_DIR` is unset. Also, `rename-session` did not work when another user's session was specified. Closes #3019
2018-08-24Use $USER if getpwuid failsMatt Peterson
2018-05-23Fix Kakoune client busy looping on SIGHUPMaxime Coste
Pure clients never quitted when they got SIGHUP after recent changes to add is_ok to UserInterface. run_client now tracks the UI state as well and quits if the UI gets killed.
2018-03-23Restore client name after converting to clientMaxime Coste
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.
2017-12-04Replace uses of getpwuid which is incompatible with static linkingMaxime Coste
Introduce a get_user_name function which parses '/etc/passwd' to find the username associated with a user id.
2017-11-12Remote: when converting to client, suspend *after* connectingMaxime Coste
Also, do not quit server while there is a connection being accepted Fixes #1690
2017-10-10Move all non-core string code to string_utils.{hh,cc}Maxime Coste
2017-08-28Expose client pid as $kak_client_pidMaxime Coste
As requested in #1414
2017-08-23Support specifying an exit status on `quit` commandsMaxime Coste
The current client exit status can be specified as an optional parameter, is nothing is given the exit status will be 0. Fixes #1230
2017-01-21Support the +line syntax for clients as well.Maxime Coste
Fix a crash on daemon quit as well.
2016-12-20Ensure we return 0 on exit from graceful disconnectionMaxime Coste
Fixes #1042
2016-12-01Only write to remote socket when we know they are writableMaxime Coste
Buffer data (in an horribly innefficient way for now), and use the event manager to watch for the socket being ready for a write. Fixes #945
2016-11-29Simplify greatly UI input handlingMaxime Coste
This round trip through an input callback expected to call is_key_available and get_key was overcomplicated, just send the keys as they arrive, the client is already buffering due to urgent event mode.
2016-11-29Clean up includes of user_interface.hhMaxime Coste
2016-11-29Small remote code cleanupMaxime Coste
2016-11-28Add more memory domains to certain dataMaxime Coste
2016-10-06Handle all available keys when a RemoteClient input is availableMaxime Coste
We were just treating the next key. Which led to <esc> byte remaining after suspend, that led that <esc> being interpretted as <alt> when the following key got available. Fixes #739
2016-09-04Rework client quitting and handling of remote errorsMaxime Coste
Client quitting no longer immediately unwinds, client is just pushed for deletion until we get back to the main loop, similarly to what happens for buffer and window deletion.
2016-09-04Use proper buffering when reading remote messagesMaxime Coste
Messages now have their size in a header, along with their type and are only executed once fully received. We dont block anymore while trying to read a full message.
2016-07-28Tweak session renaming codeMaxime Coste
2016-07-24Add 'session' command to change remote session nameEnrico Lumetti
2016-06-06Check session valididty on kak -l and support kak -clear for clearing the ↵Maxime Coste
dead ones Fixes #689
2015-10-08Auto fork server when suspending the local clientMaxime Coste
That way, other clients can still be serviced by the server.
2015-08-23Rework resize handlingMaxime Coste
Fixes #383
2015-06-01Port even more code to use format functionMaxime Coste
2015-04-17Small layout changeMaxime Coste
2015-01-12replace all std::vector with VectorMaxime Coste
2014-12-23Remove trailing blank linesMaxime Coste
2014-11-12Cleanup includesMaxime Coste
2014-11-05Simplify RemoteClient creation codeMaxime Coste
2014-10-20Port more code to StringView instead of const String&Maxime Coste
2014-05-07Refactor LineAndColumn coordinatesMaxime Coste
BufferCoord -> ByteCoord DisplayCoord -> CharCoord Moved their definition along with LineAndColumn into coord.hh
2014-04-15RemoteClient process all available messagesMaxime Coste
2014-04-07Add support for querying client environement variablesMaxime Coste
At connection, a remote client sends all its environement to the server, which then provides access to client env through kak_client_env_VAR_NAME variables in the shell.
2014-03-25Server: correctly handle Accepters lifetimeMaxime Coste
When exiting kakoune, ClientAccepters (now Server::Accepter) could stay alive, which left an FDWatcher in the EventManager triggering an assert. Now Server is handling their lifetime.
2014-03-21Correctly handle failing to connect to the given session in client modeMaxime Coste
2014-03-02Add -p <session> option to kak, which forward commands on stdin to sessionMaxime Coste
This allows using directly the kak binary in place of socat for piping commands to a foreing session.
2014-03-02Rename connect_to's pid parameter to sessionMaxime Coste
2014-01-27Remove session socket on error signalMaxime Coste
2013-09-25Remove $kak_socket replaced with $kak_sessionMaxime Coste
use /tmp/kak-$kak_session to get the socket path
2013-09-19Add a -s command line option for specifying session nameMaxime Coste
2013-04-09sort includes directivesMaxime Coste
2013-03-14move remoting code to remote.ccMaxime Coste
ClientAccepter is now Server's implementation detail and all socket logic are isolated in remote.cc