Commit Graph
213 Commits
Author SHA1 Message Date
Wez Furlong 4f08d010b7 move unix listener to its own module 2020-01-24 19:31:04 -08:00
Wez Furlong 82c824f371 pty: remove conpty support
It's too fiddly to setup in practice, and literally no one has
expressed an interest in using it.

Removing it simplifies some upcoming work.

Closes: https://github.com/wez/wezterm/issues/35
2020-01-20 07:55:51 -08:00
Wez Furlong ec082bec31 split ClientSession out of the main listener module 2020-01-20 07:55:51 -08:00
Wez Furlong 36656585a2 move UmaskSaver to its own file 2020-01-20 07:55:51 -08:00
Wez Furlong 7688d669d7 read_bytes -> std::fs::read 2020-01-20 07:55:51 -08:00
Wez Furlong 22622219c7 refactor: move listener and tls bits into own files 2020-01-20 07:55:51 -08:00
Wez Furlong e823207809 mux: avoid deadlock when remote has grabbed the mouse 2020-01-17 12:13:36 -08:00
Wez Furlong b295575953 tidy up wezterm cli list
There's a panic during shutdown that needs to be run down though
2020-01-16 23:06:25 -08:00
Wez Furlong c3bee703bb asyncify the client rpc methods + fanout 2020-01-16 22:49:01 -08:00
Wez Furlong e814bc4267 mux: Domain::spawn is now async
This was another source of hanging on windows with connecting to a unix
domain.
2020-01-16 16:36:27 -08:00
Wez Furlong 7de282fd07 mux: make Domain::attach an async fn 2020-01-16 15:55:15 -08:00
Wez Furlong aeb91ff238 migrate more things over to the new spawn stuff 2020-01-16 10:31:53 -08:00
Wez Furlong 256b4e6da8 fix pollable_channel to be non-blocking on Windows
Upgrade filedescriptor to 0.7 to use the portable helper for
setting non-blocking mode, and enable non-blocking mode on Windows.
2020-01-15 21:30:14 -08:00
Wez Furlong 101aedd6a5 remove .wait() from finish_attach
While debugging on windows earlier today I saw that we were
blocked on this wait on the main thread.  For whatever reason,
that only blocks in practice on Windows; I suspect that this is
due to a timing issue on windows where the server side takes
longer to respond than it does on posix.
2020-01-15 20:50:54 -08:00
Wez Furlong 4442e8030d mux: fix disconnect when a lot of output is dumped to the terminal
The root cause and secondary effect were a little surprising: the mux
pub/sub notification pipe filled up and because the mux notify routine
uses `retain` with the success of the send as a predicate it meant that
the full pipe resulted in the muxer killing that end of the subscriber
and that in turn made the ClientSession loop fail when it was
dispatching a notify on the other end, which terminated the loop and
disconnected the client.

Now, with this fixed, we have a flow control problem and the terminal
will remain busy with ctrl-c not being effective in the mux session.
2020-01-14 22:51:48 -08:00
Wez Furlong 4b455288dd track the full current dir URL for OSC 7
Matching against the current dir when it includes a host and a
path seems like a handy way to automate selecting appropriate
theme/color/profile settings, so I'd like to make sure that
we have the full URL content available for that.

Refs: https://github.com/wez/wezterm/issues/115
Refs: https://github.com/wez/wezterm/issues/117
2020-01-14 22:06:13 -08:00
Wez Furlong c989485a77 mux: add basic version handshake at domain connect time 2020-01-13 08:10:23 -08:00
Wez Furlong 756774ede2 mux: invalidate rather than drop lines on resize
This avoids a blank flash during resize/redraw operations

refs: https://github.com/wez/wezterm/issues/116
2020-01-12 14:56:49 -08:00
Wez Furlong 3c3e73e374 avoid some number of resize rpc calls
Skip them if the size doesn't appear to have changed

refs: https://github.com/wez/wezterm/issues/116
2020-01-12 14:49:15 -08:00
Wez Furlong 367a44fb96 avoid accidentally blocking on the pollable channel
make sure the socketpair is nonblocking (note: this only works
on unix at this time)

refs: https://github.com/wez/wezterm/issues/116
2020-01-12 14:42:38 -08:00
Jeremy Fitzhardinge cb34ac9cdd Add working dir to mux protocol 2020-01-11 18:25:17 -08:00
Jeremy Fitzhardinge 83641ed46c Spawn new tabs using the current tab's current directory
(If known.)
2020-01-11 18:25:17 -08:00
Jeremy Fitzhardinge 71eb27ccb5 Add get_current_working_dir to Tab 2020-01-11 18:25:17 -08:00
Wez Furlong 44b3c412b6 mux: always send the cursor row 2020-01-10 09:11:44 -08:00
Wez Furlong ba90abf805 mux: reintroduce server side state to gate pushes
Record a notion of the state of the invalidations that we've sent
to the client so that we can skip sending updates if nothing has
changed since the last push.
2020-01-10 08:56:27 -08:00
Wez Furlong 88c3d620bf mux: bounded number of fds for ServerPollable
It was possible to exhaust the number of fds on the server by
opening a vertical vim split and aggressively sliding it left
and right.

This commit allows the produce side to clone an arbitrary number
of senders without using up file descriptors.
2020-01-10 08:56:04 -08:00
Wez Furlong c8635c07f3 mux: avoid over-invalidating in a couple of cases 2020-01-09 08:47:29 -08:00
Wez Furlong 0f5eec0244 mux: I think I found the invalidation issue
Need to treat None as dirty when looking at the line cache in
get_dirty_lines
2020-01-09 08:07:17 -08:00
Wez Furlong 4765ce60e5 mux: avoid overly aggressively dirtying lines
Still not perfect; there's a window invalidation missing from
the mux somewhere on higher latency connections that gets
resolved just by moving the mouse :-/
2020-01-09 06:39:00 -08:00
Wez Furlong 4516036479 reduce debug log level 2020-01-08 23:09:34 -08:00
Wez Furlong 4391ab5f55 mux:improve management of line cache
There was an issue where we'd get stuck with a placeholder empty
line in a couple of rows when running `ls -l /etc` and scrolling
backwards.  The damage was actually done during execution of the
ls command and was because we'd get confused about the state of
some of the line entries.

This diff introduces a proper state enum for them and defines
state transitions more rigorously.
2020-01-08 22:05:58 -08:00
Wez Furlong d76e4ed42d use RangeSet for the result of get_dirty_lines 2020-01-08 08:34:22 -08:00
Wez Furlong cb624173d2 leave it up to get_lines to clear the dirty flag 2020-01-08 07:49:06 -08:00
Wez Furlong 9639d137a7 mux: avoid dirtying a line if it is unchanged on fetch
I noticed the mux was running hot when idle and observed that it was
repeatedly fetching the line with the cursor.

Extract the logic into a helper function that is called from both
of the places that fetch and put lines; noticed that we were not
consistently processing hyperlinks.
2020-01-07 23:01:49 -08:00
Wez Furlong 68d460295a improve some rate control in the mux protocol
The client side will limit how many rows it decides to speculatively
prefetch and defer to the lines requested by the renderer once we
exceed a certain number of fetch requests per second.

On the server side, we weren't actually coalescing individual tab
output events together; this commit restructures the end of the
appropriate loop block to make that effective.
2020-01-07 18:04:22 -08:00
Wez Furlong 41ee87f43c make Domain::attach return a Future
This avoids a hang on startup if you're using an ssh multiplexer
connection and haven't already registered your ssh key and need
to perform password authentication.
2020-01-06 22:41:59 -08:00
Wez Furlong 57ad948af1 mux: add bonus lines to GetTabRenderChangesResponse
The server now uses this to send the line content for
whichever line the cursor is on, which makes typing
latency better.
2020-01-06 08:36:56 -08:00
Wez Furlong b384ee4233 make it possible to re-use the line serialization in other pdus 2020-01-06 08:21:12 -08:00
Wez Furlong 0b3af1b7fe add a pdu size histogram to the stats
It tracks the serialized size of the data; here's some stats from a `--release`
build:

```
STAT                                               p50      p75      p95
Key(executor.spawn_delay)                          9.09µs   11.14µs  29.44µs
Key(gui.paint.opengl)                              7.18ms   7.86ms   28.31ms
Key(pdu.decode.compressed.size)                    161      807      2575
Key(pdu.decode.size)                               34       41       45
Key(pdu.encode.size)                               5        6        12
Key(pdu.size, [pdu = GetLinesResponse])            161      807      2575
Key(pdu.size, [pdu = GetLines])                    9        12       16
Key(pdu.size, [pdu = GetTabRenderChangesResponse]) 41       41       47
Key(pdu.size, [pdu = GetTabRenderChanges])         5        5        5
Key(pdu.size, [pdu = ListTabsResponse])            15       15       15
Key(pdu.size, [pdu = ListTabs])                    3        3        3
Key(pdu.size, [pdu = Resize])                      10       11       11
Key(pdu.size, [pdu = SendKeyDown])                 7        8        8
Key(pdu.size, [pdu = UnitResponse])                0        0        0
Key(rpc, [method = get_lines])                     729.09µs 4.06ms   10.16ms
Key(rpc, [method = get_tab_render_changes])        335.87µs 362.50µs 436.22µs
Key(rpc, [method = key_down])                      183.30µs 205.82µs 284.67µs
Key(rpc, [method = list_tabs])                     244.74µs 244.74µs 244.74µs
Key(rpc, [method = resize])                        557.06µs 1.35ms   1.82ms
Key(shape.harfbuzz)                                10.24µs  19.20µs  35.33µs
```
2020-01-06 08:03:29 -08:00
Wez Furlong f0ea9af97a renumber some pdus to make version mismatch more apparent 2020-01-06 07:54:30 -08:00
Wez Furlong b0c04c4da0 tidy up proxy path computation 2020-01-06 07:51:50 -08:00
Wez Furlong 0c88894a5a don't assume my own local build paths by default(!) 2020-01-06 07:46:37 -08:00
Wez Furlong a9a7a9662e ensure that we update fetch_pending in the error case 2020-01-06 07:42:40 -08:00
Wez Furlong 100084d6e5 remove the OpenURL pdu from the codec
Link clicking is handled locally now, so this is not needed.
2020-01-06 07:33:40 -08:00
Wez Furlong 4687b3bb48 clippy 2020-01-05 15:14:32 -08:00
Wez Furlong 89f2023577 mux: invalidate StableRowIndex 0..rows when switching alt screen
We would leave a copy of the alt screen lines at the top of the
scrollback.

This commit ensures that those lines are marked dirty and that
the dirty bits are propagated to the client to invalidate its cache.
2020-01-05 15:07:00 -08:00
Wez Furlong 9f270c25e7 mux: fix tab title at attach time
We were ignoring the title returned by list tabs and would subsequently
only pick up the title after a later update.

This passes the title in at construction.
2020-01-05 14:44:08 -08:00
Wez Furlong 624c7234e4 Improve serializing hyperlinks in lines for the mux
This is both a little more efficient on the wire and results in
hovering over hyperlinks working as you would expect in the mux.
2020-01-05 14:37:17 -08:00
Wez Furlong dfa2b08c72 move URL highlight processing to the gui layer 2020-01-05 14:37:17 -08:00
Wez Furlong ad91742439 refine log levels of some debug logs 2020-01-05 14:37:17 -08:00