Skip to content

Commit f9dda48

Browse files
authored
Merge branch 'main' into aiday/internalIssue4180
2 parents 3f4d906 + 784e72b commit f9dda48

File tree

74 files changed

+654
-350
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

74 files changed

+654
-350
lines changed

ThirdPartyNotices.txt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1303,7 +1303,7 @@ SOFTWARE.
13031303

13041304
---------------------------------------------------------
13051305

1306-
jlelong/vscode-latex-basics 1.5.1 - MIT
1306+
jlelong/vscode-latex-basics 1.5.2 - MIT
13071307
https://github.com/jlelong/vscode-latex-basics
13081308

13091309
Copyright (c) vscode-latex-basics authors
@@ -1654,8 +1654,8 @@ THE SOFTWARE.
16541654

16551655
---------------------------------------------------------
16561656

1657-
language-php 0.48.1 - MIT
1658-
https://github.com/atom/language-php
1657+
language-php 0.49.0 - MIT
1658+
https://github.com/KapitanOczywisty/language-php
16591659

16601660
The MIT License (MIT)
16611661

@@ -2184,7 +2184,7 @@ THE SOFTWARE.
21842184

21852185
---------------------------------------------------------
21862186

2187-
microsoft/vscode-css 0.45.1 - MIT License
2187+
microsoft/vscode-css 0.0.0 - MIT License
21882188
https://github.com/microsoft/vscode-css
21892189

21902190
MIT License
@@ -2748,7 +2748,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SO
27482748

27492749
---------------------------------------------------------
27502750

2751-
trond-snekvik/vscode-rst 1.5.1 - MIT
2751+
trond-snekvik/vscode-rst 1.5.2 - MIT
27522752
https://github.com/trond-snekvik/vscode-rst
27532753

27542754
The MIT License (MIT)

build/gulpfile.reh.js

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -309,8 +309,6 @@ function packageTask(type, platform, arch, sourceFolderName, destinationFolderNa
309309
.pipe(replace('@@COMMIT@@', commit))
310310
.pipe(replace('@@APPNAME@@', product.applicationName))
311311
.pipe(rename(`bin/helpers/browser.cmd`)),
312-
gulp.src('resources/server/bin/server-old.cmd', { base: '.' })
313-
.pipe(rename(`server.cmd`)),
314312
gulp.src('resources/server/bin/code-server.cmd', { base: '.' })
315313
.pipe(rename(`bin/${product.serverApplicationName}.cmd`)),
316314
);
@@ -332,13 +330,6 @@ function packageTask(type, platform, arch, sourceFolderName, destinationFolderNa
332330
.pipe(rename(`bin/${product.serverApplicationName}`))
333331
.pipe(util.setExecutableBit())
334332
);
335-
if (type !== 'reh-web') {
336-
result = es.merge(result,
337-
gulp.src('resources/server/bin/server-old.sh', { base: '.' })
338-
.pipe(rename(`server.sh`))
339-
.pipe(util.setExecutableBit()),
340-
);
341-
}
342333
}
343334

344335
return result.pipe(vfs.dest(destination));

build/lib/electron.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build/lib/electron.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ function darwinBundleDocumentTypes(types: { [name: string]: string | string[] },
9191
}
9292

9393
export const config = {
94-
version: product.electronRepository ? '22.5.3' : util.getElectronVersion(),
94+
version: product.electronRepository ? '22.5.4' : util.getElectronVersion(),
9595
productAppName: product.nameLong,
9696
companyName: 'Microsoft Corporation',
9797
copyright: 'Copyright (C) 2023 Microsoft. All rights reserved',
@@ -212,7 +212,7 @@ function getElectron(arch: string): () => NodeJS.ReadWriteStream {
212212
}
213213

214214
async function main(arch = process.arch): Promise<void> {
215-
const version = product.electronRepository ? '22.5.3' : util.getElectronVersion();
215+
const version = product.electronRepository ? '22.5.4' : util.getElectronVersion();
216216
const electronPath = path.join(root, '.build', 'electron');
217217
const versionFile = path.join(electronPath, 'version');
218218
const isUpToDate = fs.existsSync(versionFile) && fs.readFileSync(versionFile, 'utf8') === `${version}`;

cglicenses.json

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -342,5 +342,55 @@
342342
{ // License is MIT/Apache and tool doesn't look in subfolders
343343
"name": "dirs-sys-next",
344344
"fullLicenseTextUri": "https://raw.githubusercontent.com/xdg-rs/dirs/master/dirs-sys/LICENSE-MIT"
345+
},
346+
{
347+
"name": "https-proxy-agent",
348+
"fullLicenseText": [
349+
"(The MIT License)",
350+
"Copyright (c) 2013 Nathan Rajlich <[email protected]>",
351+
"Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:",
352+
"The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.",
353+
"THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE."
354+
]
355+
},
356+
{
357+
"name": "data-uri-to-buffer",
358+
"fullLicenseText": [
359+
"(The MIT License)",
360+
"Copyright (c) 2014 Nathan Rajlich <[email protected]>",
361+
"Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:",
362+
"The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.",
363+
"THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE."
364+
]
365+
},
366+
{
367+
"name": "socks-proxy-agent",
368+
"fullLicenseText": [
369+
"(The MIT License)",
370+
"Copyright (c) 2013 Nathan Rajlich <[email protected]>",
371+
"Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:",
372+
"The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.",
373+
"THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE."
374+
]
375+
},
376+
{
377+
"name": "http-proxy-agent",
378+
"fullLicenseText": [
379+
"(The MIT License)",
380+
"Copyright (c) 2013 Nathan Rajlich <[email protected]>",
381+
"Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:",
382+
"The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.",
383+
"THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE."
384+
]
385+
},
386+
{
387+
"name": "agent-base",
388+
"fullLicenseText": [
389+
"(The MIT License)",
390+
"Copyright (c) 2013 Nathan Rajlich <[email protected]>",
391+
"Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:",
392+
"The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.",
393+
"THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE."
394+
]
345395
}
346396
]

cli/src/commands/tunnels.rs

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ use crate::{
3535
},
3636
util::{
3737
app_lock::AppMutex,
38-
errors::{wrap, AnyError},
38+
errors::{wrap, AnyError, CodeError},
3939
prereqs::PreReqChecker,
4040
},
4141
};
@@ -247,17 +247,25 @@ pub async fn kill(ctx: CommandContext) -> Result<i32, AnyError> {
247247
}
248248

249249
pub async fn status(ctx: CommandContext) -> Result<i32, AnyError> {
250-
let status: protocol::singleton::Status = do_single_rpc_call(
250+
let status = do_single_rpc_call::<_, protocol::singleton::Status>(
251251
&ctx.paths.tunnel_lockfile(),
252252
ctx.log.clone(),
253253
protocol::singleton::METHOD_STATUS,
254254
protocol::EmptyObject {},
255255
)
256-
.await?;
257-
258-
ctx.log.result(serde_json::to_string(&status).unwrap());
256+
.await;
259257

260-
Ok(0)
258+
match status {
259+
Err(CodeError::NoRunningTunnel) => {
260+
ctx.log.result(CodeError::NoRunningTunnel.to_string());
261+
Ok(1)
262+
}
263+
Err(e) => Err(e.into()),
264+
Ok(s) => {
265+
ctx.log.result(serde_json::to_string(&s).unwrap());
266+
Ok(0)
267+
}
268+
}
261269
}
262270

263271
/// Removes unused servers.

cli/src/rpc.rs

Lines changed: 91 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -273,30 +273,21 @@ impl<S: Serialization, C: Send + Sync + 'static> RpcMethodBuilder<S, C> {
273273

274274
/// Builds into a usable, sync rpc dispatcher.
275275
pub fn build(mut self, log: log::Logger) -> RpcDispatcher<S, C> {
276-
let streams: Arc<tokio::sync::Mutex<HashMap<u32, WriteHalf<DuplexStream>>>> =
277-
Arc::new(tokio::sync::Mutex::new(HashMap::new()));
276+
let streams = Streams::default();
278277

279278
let s1 = streams.clone();
280279
self.register_async(METHOD_STREAM_ENDED, move |m: StreamEndedParams, _| {
281280
let s1 = s1.clone();
282281
async move {
283-
if let Some(mut s) = s1.lock().await.remove(&m.stream) {
284-
let _ = s.shutdown().await;
285-
}
282+
s1.remove(m.stream).await;
286283
Ok(())
287284
}
288285
});
289286

290287
let s2 = streams.clone();
291-
self.register_async(METHOD_STREAM_DATA, move |m: StreamDataIncomingParams, _| {
292-
let s2 = s2.clone();
293-
async move {
294-
let mut lock = s2.lock().await;
295-
if let Some(stream) = lock.get_mut(&m.stream) {
296-
let _ = stream.write_all(&m.segment).await;
297-
}
298-
Ok(())
299-
}
288+
self.register_sync(METHOD_STREAM_DATA, move |m: StreamDataIncomingParams, _| {
289+
s2.write(m.stream, m.segment);
290+
Ok(())
300291
});
301292

302293
RpcDispatcher {
@@ -400,7 +391,7 @@ pub struct RpcDispatcher<S, C> {
400391
serializer: Arc<S>,
401392
methods: Arc<HashMap<&'static str, Method>>,
402393
calls: Arc<Mutex<HashMap<u32, DispatchMethod>>>,
403-
streams: Arc<tokio::sync::Mutex<HashMap<u32, WriteHalf<DuplexStream>>>>,
394+
streams: Streams,
404395
}
405396

406397
static MESSAGE_ID_COUNTER: AtomicU32 = AtomicU32::new(0);
@@ -483,10 +474,9 @@ impl<S: Serialization, C: Send + Sync> RpcDispatcher<S, C> {
483474
return;
484475
}
485476

486-
let mut streams_map = self.streams.lock().await;
487477
for (stream_id, duplex) in dto.streams {
488478
let (mut read, write) = tokio::io::split(duplex);
489-
streams_map.insert(stream_id, write);
479+
self.streams.insert(stream_id, write);
490480

491481
let write_tx = write_tx.clone();
492482
let serial = self.serializer.clone();
@@ -538,6 +528,90 @@ impl<S: Serialization, C: Send + Sync> RpcDispatcher<S, C> {
538528
}
539529
}
540530

531+
struct StreamRec {
532+
write: Option<WriteHalf<DuplexStream>>,
533+
q: Vec<Vec<u8>>,
534+
}
535+
536+
#[derive(Clone, Default)]
537+
struct Streams {
538+
map: Arc<std::sync::Mutex<HashMap<u32, StreamRec>>>,
539+
}
540+
541+
impl Streams {
542+
pub async fn remove(&self, id: u32) {
543+
let stream = self.map.lock().unwrap().remove(&id);
544+
if let Some(s) = stream {
545+
// if there's no 'write' right now, it'll shut down in the write_loop
546+
if let Some(mut w) = s.write {
547+
let _ = w.shutdown().await;
548+
}
549+
}
550+
}
551+
552+
pub fn write(&self, id: u32, buf: Vec<u8>) {
553+
let mut map = self.map.lock().unwrap();
554+
if let Some(s) = map.get_mut(&id) {
555+
s.q.push(buf);
556+
557+
if let Some(w) = s.write.take() {
558+
tokio::spawn(write_loop(id, w, self.map.clone()));
559+
}
560+
}
561+
}
562+
563+
pub fn insert(&self, id: u32, stream: WriteHalf<DuplexStream>) {
564+
self.map.lock().unwrap().insert(
565+
id,
566+
StreamRec {
567+
write: Some(stream),
568+
q: Vec::new(),
569+
},
570+
);
571+
}
572+
}
573+
574+
/// Write loop started by `Streams.write`. It takes the WriteHalf, and
575+
/// runs until there's no more items in the 'write queue'. At that point, if the
576+
/// record still exists in the `streams` (i.e. we haven't shut down), it'll
577+
/// return the WriteHalf so that the next `write` call starts
578+
/// the loop again. Otherwise, it'll shut down the WriteHalf.
579+
///
580+
/// This is the equivalent of the same write_loop in the server_multiplexer.
581+
/// I couldn't figure out a nice way to abstract it without introducing
582+
/// performance overhead...
583+
async fn write_loop(
584+
id: u32,
585+
mut w: WriteHalf<DuplexStream>,
586+
streams: Arc<std::sync::Mutex<HashMap<u32, StreamRec>>>,
587+
) {
588+
let mut items_vec = vec![];
589+
loop {
590+
{
591+
let mut lock = streams.lock().unwrap();
592+
let stream_rec = match lock.get_mut(&id) {
593+
Some(b) => b,
594+
None => break,
595+
};
596+
597+
if stream_rec.q.is_empty() {
598+
stream_rec.write = Some(w);
599+
return;
600+
}
601+
602+
std::mem::swap(&mut stream_rec.q, &mut items_vec);
603+
}
604+
605+
for item in items_vec.drain(..) {
606+
if w.write_all(&item).await.is_err() {
607+
break;
608+
}
609+
}
610+
}
611+
612+
let _ = w.shutdown().await; // got here from `break` above, meaning our record got cleared. Close the bridge if so
613+
}
614+
541615
const METHOD_STREAMS_STARTED: &str = "streams_started";
542616
const METHOD_STREAM_DATA: &str = "stream_data";
543617
const METHOD_STREAM_ENDED: &str = "stream_ended";

cli/src/tunnels/server_multiplexer.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ impl ServerMultiplexer {
105105
}
106106
}
107107

108-
/// Write loop started by `handle_server_message`. It take sthe ServerBridge, and
108+
/// Write loop started by `handle_server_message`. It takes the ServerBridge, and
109109
/// runs until there's no more items in the 'write queue'. At that point, if the
110110
/// record still exists in the bridges_lock (i.e. we haven't shut down), it'll
111111
/// return the ServerBridge so that the next handle_server_message call starts

cli/src/util/sync.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,9 @@
44
*--------------------------------------------------------------------------------------------*/
55
use async_trait::async_trait;
66
use std::{marker::PhantomData, sync::Arc};
7-
use tokio::{
8-
sync::{
9-
broadcast, mpsc,
10-
watch::{self, error::RecvError},
11-
},
7+
use tokio::sync::{
8+
broadcast, mpsc,
9+
watch::{self, error::RecvError},
1210
};
1311

1412
#[derive(Clone)]

extensions/css-language-features/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -994,7 +994,7 @@
994994
]
995995
},
996996
"dependencies": {
997-
"vscode-languageclient": "^8.2.0-next.0",
997+
"vscode-languageclient": "^8.2.0-next.1",
998998
"vscode-uri": "^3.0.7"
999999
},
10001000
"devDependencies": {

0 commit comments

Comments
 (0)