Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
61766fa2
V
vscode
项目概览
xxadev
/
vscode
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
vscode
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
61766fa2
编写于
3月 22, 2019
作者:
A
Alex Dima
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Remove logging
上级
bb84f439
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
5 addition
and
43 deletion
+5
-43
src/vs/base/parts/ipc/node/ipc.net.ts
src/vs/base/parts/ipc/node/ipc.net.ts
+5
-43
未找到文件。
src/vs/base/parts/ipc/node/ipc.net.ts
浏览文件 @
61766fa2
...
@@ -8,7 +8,6 @@ import { Event, Emitter } from 'vs/base/common/event';
...
@@ -8,7 +8,6 @@ import { Event, Emitter } from 'vs/base/common/event';
import
{
IMessagePassingProtocol
,
ClientConnectionEvent
,
IPCServer
,
IPCClient
}
from
'
vs/base/parts/ipc/node/ipc
'
;
import
{
IMessagePassingProtocol
,
ClientConnectionEvent
,
IPCServer
,
IPCClient
}
from
'
vs/base/parts/ipc/node/ipc
'
;
import
{
join
}
from
'
vs/base/common/path
'
;
import
{
join
}
from
'
vs/base/common/path
'
;
import
{
tmpdir
}
from
'
os
'
;
import
{
tmpdir
}
from
'
os
'
;
import
*
as
fs
from
'
fs
'
;
import
{
generateUuid
}
from
'
vs/base/common/uuid
'
;
import
{
generateUuid
}
from
'
vs/base/common/uuid
'
;
import
{
IDisposable
}
from
'
vs/base/common/lifecycle
'
;
import
{
IDisposable
}
from
'
vs/base/common/lifecycle
'
;
import
{
VSBuffer
}
from
'
vs/base/common/buffer
'
;
import
{
VSBuffer
}
from
'
vs/base/common/buffer
'
;
...
@@ -42,16 +41,6 @@ export function generateRandomPipeName(): string {
...
@@ -42,16 +41,6 @@ export function generateRandomPipeName(): string {
}
}
}
}
function
log
(
fd
:
number
,
msg
:
string
,
data
?:
VSBuffer
):
void
{
const
date
=
new
Date
();
fs
.
writeSync
(
fd
,
`[
${
date
.
getHours
()}
:
${
date
.
getMinutes
()}
:
${
date
.
getSeconds
()}
.
${
date
.
getMilliseconds
()}
]
${
msg
}
\n`
);
if
(
data
)
{
fs
.
writeSync
(
fd
,
data
);
fs
.
writeSync
(
fd
,
`\n---------------------------------------------------------------------------------------------------------\n`
);
}
fs
.
fdatasyncSync
(
fd
);
}
let
emptyBuffer
:
VSBuffer
|
null
=
null
;
let
emptyBuffer
:
VSBuffer
|
null
=
null
;
function
getEmptyBuffer
():
VSBuffer
{
function
getEmptyBuffer
():
VSBuffer
{
if
(
!
emptyBuffer
)
{
if
(
!
emptyBuffer
)
{
...
@@ -138,16 +127,6 @@ const enum ProtocolMessageType {
...
@@ -138,16 +127,6 @@ const enum ProtocolMessageType {
KeepAlive
=
4
KeepAlive
=
4
}
}
function
ProtocolMessageTypeToString
(
type
:
ProtocolMessageType
):
string
{
switch
(
type
)
{
case
ProtocolMessageType
.
None
:
return
'
None
'
;
case
ProtocolMessageType
.
Regular
:
return
'
Regular
'
;
case
ProtocolMessageType
.
Control
:
return
'
Control
'
;
case
ProtocolMessageType
.
Ack
:
return
'
Ack
'
;
case
ProtocolMessageType
.
KeepAlive
:
return
'
KeepAlive
'
;
}
}
export
const
enum
ProtocolConstants
{
export
const
enum
ProtocolConstants
{
HeaderLength
=
13
,
HeaderLength
=
13
,
/**
/**
...
@@ -277,15 +256,13 @@ class ProtocolWriter {
...
@@ -277,15 +256,13 @@ class ProtocolWriter {
private
_isDisposed
:
boolean
;
private
_isDisposed
:
boolean
;
private
readonly
_socket
:
Socket
;
private
readonly
_socket
:
Socket
;
private
readonly
_logFile
:
number
;
private
_data
:
VSBuffer
[];
private
_data
:
VSBuffer
[];
private
_totalLength
:
number
;
private
_totalLength
:
number
;
public
lastWriteTime
:
number
;
public
lastWriteTime
:
number
;
constructor
(
socket
:
Socket
,
logFile
:
number
)
{
constructor
(
socket
:
Socket
)
{
this
.
_isDisposed
=
false
;
this
.
_isDisposed
=
false
;
this
.
_socket
=
socket
;
this
.
_socket
=
socket
;
this
.
_logFile
=
logFile
;
this
.
_data
=
[];
this
.
_data
=
[];
this
.
_totalLength
=
0
;
this
.
_totalLength
=
0
;
this
.
lastWriteTime
=
0
;
this
.
lastWriteTime
=
0
;
...
@@ -307,9 +284,6 @@ class ProtocolWriter {
...
@@ -307,9 +284,6 @@ class ProtocolWriter {
console
.
warn
(
msg
);
console
.
warn
(
msg
);
return
;
return
;
}
}
if
(
this
.
_logFile
)
{
log
(
this
.
_logFile
,
`send-
${
ProtocolMessageTypeToString
(
msg
.
type
)}
-
${
msg
.
id
}
-
${
msg
.
ack
}
-`
,
msg
.
data
);
}
msg
.
writtenTime
=
Date
.
now
();
msg
.
writtenTime
=
Date
.
now
();
this
.
lastWriteTime
=
Date
.
now
();
this
.
lastWriteTime
=
Date
.
now
();
const
header
=
VSBuffer
.
alloc
(
ProtocolConstants
.
HeaderLength
);
const
header
=
VSBuffer
.
alloc
(
ProtocolConstants
.
HeaderLength
);
...
@@ -392,7 +366,7 @@ export class Protocol implements IDisposable, IMessagePassingProtocol {
...
@@ -392,7 +366,7 @@ export class Protocol implements IDisposable, IMessagePassingProtocol {
constructor
(
socket
:
Socket
)
{
constructor
(
socket
:
Socket
)
{
this
.
_socket
=
socket
;
this
.
_socket
=
socket
;
this
.
_socketWriter
=
new
ProtocolWriter
(
this
.
_socket
,
0
);
this
.
_socketWriter
=
new
ProtocolWriter
(
this
.
_socket
);
this
.
_socketReader
=
new
ProtocolReader
(
this
.
_socket
);
this
.
_socketReader
=
new
ProtocolReader
(
this
.
_socket
);
this
.
_socketReader
.
onMessage
((
msg
)
=>
{
this
.
_socketReader
.
onMessage
((
msg
)
=>
{
...
@@ -605,7 +579,6 @@ class Queue<T> {
...
@@ -605,7 +579,6 @@ class Queue<T> {
*/
*/
export
class
PersistentProtocol
{
export
class
PersistentProtocol
{
private
_logFile
:
number
;
private
_isReconnecting
:
boolean
;
private
_isReconnecting
:
boolean
;
private
_outgoingUnackMsg
:
Queue
<
ProtocolMessage
>
;
private
_outgoingUnackMsg
:
Queue
<
ProtocolMessage
>
;
...
@@ -649,13 +622,8 @@ export class PersistentProtocol {
...
@@ -649,13 +622,8 @@ export class PersistentProtocol {
return
this
.
_outgoingMsgId
-
this
.
_outgoingAckId
;
return
this
.
_outgoingMsgId
-
this
.
_outgoingAckId
;
}
}
constructor
(
socket
:
Socket
,
initialChunk
:
VSBuffer
|
null
=
null
,
logFileName
:
string
|
null
=
null
)
{
constructor
(
socket
:
Socket
,
initialChunk
:
VSBuffer
|
null
=
null
)
{
this
.
_logFile
=
0
;
this
.
_isReconnecting
=
false
;
this
.
_isReconnecting
=
false
;
if
(
logFileName
)
{
console
.
log
(
`PersistentProtocol log file:
${
logFileName
}
`
);
this
.
_logFile
=
fs
.
openSync
(
logFileName
,
'
a
'
);
}
this
.
_outgoingUnackMsg
=
new
Queue
<
ProtocolMessage
>
();
this
.
_outgoingUnackMsg
=
new
Queue
<
ProtocolMessage
>
();
this
.
_outgoingMsgId
=
0
;
this
.
_outgoingMsgId
=
0
;
this
.
_outgoingAckId
=
0
;
this
.
_outgoingAckId
=
0
;
...
@@ -682,7 +650,7 @@ export class PersistentProtocol {
...
@@ -682,7 +650,7 @@ export class PersistentProtocol {
};
};
this
.
_socket
=
socket
;
this
.
_socket
=
socket
;
this
.
_socketWriter
=
new
ProtocolWriter
(
this
.
_socket
,
this
.
_logFile
);
this
.
_socketWriter
=
new
ProtocolWriter
(
this
.
_socket
);
this
.
_socketReader
=
new
ProtocolReader
(
this
.
_socket
);
this
.
_socketReader
=
new
ProtocolReader
(
this
.
_socket
);
this
.
_socketReaderListener
=
this
.
_socketReader
.
onMessage
(
msg
=>
this
.
_receiveMessage
(
msg
));
this
.
_socketReaderListener
=
this
.
_socketReader
.
onMessage
(
msg
=>
this
.
_receiveMessage
(
msg
));
this
.
_socket
.
on
(
'
close
'
,
this
.
_socketCloseListener
);
this
.
_socket
.
on
(
'
close
'
,
this
.
_socketCloseListener
);
...
@@ -713,9 +681,6 @@ export class PersistentProtocol {
...
@@ -713,9 +681,6 @@ export class PersistentProtocol {
clearTimeout
(
this
.
_incomingKeepAliveTimeout
);
clearTimeout
(
this
.
_incomingKeepAliveTimeout
);
this
.
_incomingKeepAliveTimeout
=
null
;
this
.
_incomingKeepAliveTimeout
=
null
;
}
}
if
(
this
.
_logFile
)
{
fs
.
closeSync
(
this
.
_logFile
);
}
this
.
_socketWriter
.
dispose
();
this
.
_socketWriter
.
dispose
();
this
.
_socketReader
.
dispose
();
this
.
_socketReader
.
dispose
();
this
.
_socketReaderListener
.
dispose
();
this
.
_socketReaderListener
.
dispose
();
...
@@ -782,7 +747,7 @@ export class PersistentProtocol {
...
@@ -782,7 +747,7 @@ export class PersistentProtocol {
this
.
_socket
=
socket
;
this
.
_socket
=
socket
;
this
.
_socketWriter
=
new
ProtocolWriter
(
this
.
_socket
,
this
.
_logFile
);
this
.
_socketWriter
=
new
ProtocolWriter
(
this
.
_socket
);
this
.
_socketReader
=
new
ProtocolReader
(
this
.
_socket
);
this
.
_socketReader
=
new
ProtocolReader
(
this
.
_socket
);
this
.
_socketReaderListener
=
this
.
_socketReader
.
onMessage
(
msg
=>
this
.
_receiveMessage
(
msg
));
this
.
_socketReaderListener
=
this
.
_socketReader
.
onMessage
(
msg
=>
this
.
_receiveMessage
(
msg
));
this
.
_socketReader
.
acceptChunk
(
initialDataChunk
);
this
.
_socketReader
.
acceptChunk
(
initialDataChunk
);
...
@@ -806,9 +771,6 @@ export class PersistentProtocol {
...
@@ -806,9 +771,6 @@ export class PersistentProtocol {
}
}
private
_receiveMessage
(
msg
:
ProtocolMessage
):
void
{
private
_receiveMessage
(
msg
:
ProtocolMessage
):
void
{
if
(
this
.
_logFile
)
{
log
(
this
.
_logFile
,
`recv-
${
ProtocolMessageTypeToString
(
msg
.
type
)}
-
${
msg
.
id
}
-
${
msg
.
ack
}
-`
,
msg
.
data
);
}
if
(
msg
.
ack
>
this
.
_outgoingAckId
)
{
if
(
msg
.
ack
>
this
.
_outgoingAckId
)
{
this
.
_outgoingAckId
=
msg
.
ack
;
this
.
_outgoingAckId
=
msg
.
ack
;
do
{
do
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录