summaryrefslogtreecommitdiff
path: root/usr.bin/tmux/server.c
AgeCommit message (Collapse)Author
2009-11-04Switch jobs over to use a bufferevent.Nicholas Marriott
2009-11-04Initial changes to move tmux to libevent.Nicholas Marriott
This moves the client-side loops are pretty much fully over to event-based only (tmux.c and client.c) but server-side (server.c and friends) treats libevent as a sort of clever poll, waking up after every event to run various things. Moving the server stuff over to bufferevents and timers and so on will come later.
2009-11-03Change session and client activity and creation time members to have moreNicholas Marriott
meaningful names. Also, remove the code to try and update the session activity time for the command client when a command message is received as is pointless because it des not have a session.
2009-11-02Reorder slightly to tidy code.Nicholas Marriott
2009-10-27Move the poll registration functions into the server-*.c files.Nicholas Marriott
2009-10-26tabs are better; ok nicmTheo de Raadt
2009-10-26Clear signal flags /before/ taking action and continue afterwards to reduceNicholas Marriott
chance of dropping signals. Pointed out by deraadt@.
2009-10-22Split the server code handling clients, jobs and windows off into separateNicholas Marriott
files from server.c (merging server-msg.c into the client file) and rather than iterating over each set after poll(), allow a callback to be specified when the fd is added and just walk once over the returned pollfds calling each callback where needed. More to come, getting this in so it is tested.
2009-10-13When a session is unattached, reset its activity timer to prevent it lockingNicholas Marriott
instantly when reattached.
2009-10-12Similarly add a tty_cursor_pane function to tidy up most of the calls.Nicholas Marriott
2009-10-12_absolute is redundant, just use tty_region.Nicholas Marriott
2009-10-12Cleanup: use two functions for region setting, one for absolute and one insideNicholas Marriott
pane.
2009-10-11Add a pipe-pane command to allow a pane to be piped to a shell command, forNicholas Marriott
example: pipe-pane 'cat >~/out' No arguments stops outputing and closes the pipe; the -o flag toggles a pipe and on and off (useful for key bindings). Suggested by espie@.
2009-10-11Switch run-shell over to queue the command in the background like #().Nicholas Marriott
2009-10-11Collect status from dead jobs and don't invoke the callback until bothNicholas Marriott
all input (the socket is closed) and status is available.
2009-10-11Clean up by introducing a wrapper struct for mouse clicks rather than passingNicholas Marriott
three u_chars around. As a side-effect this fixes incorrectly rejecting high cursor positions (because it was comparing them as signed char), reported by Tom Doherty.
2009-10-11Braek some bits out of server_fill_client() that aren't really related toNicholas Marriott
polling into their own function.
2009-10-10Put all jobs on a global all_jobs list and use that in server.c instead ofNicholas Marriott
running through all the clients.
2009-10-10Rather than running status-left, status-right and window title #() with popenNicholas Marriott
immediately every redraw, queue them up and run them in the background, starting each once every status-interval. The actual status line uses the output from the last run. This brings several advantages: - tmux itself may be called from inside #() without causing the server to hang; - likewise, sleep or similar doesn't cause the server to block; - commands aren't run excessively often when redrawing; - commands shared by status-left and status-right, or used multiple times, will only be run once. run-shell and if-shell still use system()/popen() but will be changed over to use this too later.
2009-10-10New option, mouse-select-pane. If on, the mouse may be used to select theNicholas Marriott
current pane. Suggested by sthen@ and also by someone else ages ago who I have forgotten.
2009-10-10Add "grouped sessions" which have independent name, options, current window andNicholas Marriott
so on but where the linked windows are synchronized (ie creating, killing windows and so on are mirrored between the sessions). A grouped session may be created by passing -t to new-session. Had this around for a while, tested by a couple of people.
2009-10-10Support for individual session idle time locking. May be enabled by turning offNicholas Marriott
the lock-server option (it is on by default). When this is off, each session locks when it has been idle for the lock-after-time setting. When on, the entire server locks when ALL sessions have been idle for their individual lock-after-time settings. This replaces one global-only option (lock-after-time) with another (lock-server), but the default behaviour is usually preferable so there don't seem to be many alternatives. Diff/idea largely from Thomas Adam, tweaked by me.
2009-10-10Instead of passing a struct pollfd ** around through various functions, buildNicholas Marriott
them into a tree and then convert into a flat poll array before and after poll. This adds a little code but should reduce annoying problems with ordering when adding new things that also need to be polled.
2009-10-05If no target client is specified to commands which accept one, try to guess theNicholas Marriott
current client, in a similar manner to how sessions already work: if the current session can be established and has only one client, use that; otherwise use the most recently created client.
2009-09-24Don't allow locked or suspended clients to limit the size of active clients.Nicholas Marriott
2009-09-23On SIGTERM, just abandon any suspended/locked clients and leave them to it,Nicholas Marriott
otherwise the server will hang around (refusing new connections) until they exit properly.
2009-09-23Remove the internal tmux locking and instead detach each client and run theNicholas Marriott
command specified by a new option "lock-command" (by default "lock -np") in each client. This means each terminal has to be unlocked individually but simplifies the code and allows the system password to be used to unlock. Note that the set-password command is gone, so it will need to be removed from configuration files, and the -U command line flag has been removed. This is the third protocol version change so again it is best to stop the tmux server before upgrading.
2009-09-22Permit multiple prefix keys to be defined, separated by commas, for example:Nicholas Marriott
set -g prefix ^a,^b Any key in the list acts as the prefix. The send-prefix command always sends the first key in the list.
2009-09-20Regularise some fatal messages.Nicholas Marriott
2009-09-18New option, set-titles-string, to allow the window title to be specified (asNicholas Marriott
for status-left/right) if set-titles is on. Also only update the title when the status line is being redrawn.
2009-09-15The default terminal size should be 80x24, not 80x25.Nicholas Marriott
2009-09-14Nuke unused server_client_index function, pointed out by martynas@.Nicholas Marriott
2009-09-12Doh, trim variables unused now.Nicholas Marriott
2009-09-12Tidy some common code for destroying sessions into a new function.Nicholas Marriott
2009-09-10Permit options such as status-bg to be configured using the entire 256 colourNicholas Marriott
palette by setting "colour0" to "colour255".
2009-09-07While the display-panes indicator is on screen, make the number keys select theNicholas Marriott
pane with that index.
2009-09-07Reference count clients and sessions rather than relying on a saved index forNicholas Marriott
cmd-choose-*.
2009-09-07Tiny cleanup.Matthias Kilian
ok nicm@
2009-09-05Only redraw all clients once when the backoff timer expires rather than everyNicholas Marriott
second all the time. Reported by Simon Nicolussi.
2009-09-04Tell the user when sleeping due to password backoff.Nicholas Marriott
2009-09-02When shutting down the server, expect clients to be polite and exit when askedNicholas Marriott
with the right message.
2009-08-31Add a new display-panes command, with two options (display-panes-colour andNicholas Marriott
display-panes-time), which displays a visual indication of the number of each pane.
2009-08-31Don't call tty_free unless the client is a terminal, otherwise tty_init hasn'tNicholas Marriott
been called and it may end up doing close(0). From Kalle Olavi Niemitalo.
2009-08-23When using source-file, run the commands in the context of the source-fileNicholas Marriott
command rather than with no context. This makes things like attach work from a file.
2009-08-18Whoops, getting the comparison the right way round is usually recommended.Nicholas Marriott
2009-08-18options_get_number() is relatively expensive and a check for dead panes happensNicholas Marriott
a lot more often than actually finding one, so instead of getting the option for every check, get it for every dead window found.
2009-08-14Reset attributes as well as scroll region before poll(2) and add a big commentNicholas Marriott
explaining why.
2009-08-11Initialise log_fd to -1, prevents spurious disconnection of the client when itNicholas Marriott
ends up as fd 0 (likely if the server is started with "tmux start"). Also add some extra debugging messages to server.c.
2009-08-11Drop the no_stop argument to tty_close and tty_free in favour of a flag in theNicholas Marriott
tty struct.
2009-08-11Switch tmux to use imsg. This is the last major change to make theNicholas Marriott
client-server protocol more resilient and make the protocol versioning work properly. In future, the only things requiring a protocol version bump will be changes in the message structs, and (when both client and server have this change) mixing different versions should nicely report an error message. As a side effect this also makes the code tidier, fixes a problem with the way errors reported during server startup were handled, and supports fd passing (which will be used in future). Looked over by eric@, thanks. Please note that mixing a client with this change with an older server or vice versa may cause tmux to crash or hang - tmux should be completely exited before upgrading.