Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
dotNET Platform
MQTTnet
提交
d0f1659e
MQTTnet
项目概览
dotNET Platform
/
MQTTnet
10 个月 前同步成功
通知
0
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
MQTTnet
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
d0f1659e
编写于
3月 24, 2019
作者:
C
Christian Kratky
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Remove obsolete methods.
上级
11a5b5a0
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
7 addition
and
53 deletion
+7
-53
Source/MQTTnet/Client/Options/MqttClientOptionsBuilder.cs
Source/MQTTnet/Client/Options/MqttClientOptionsBuilder.cs
+0
-19
Source/MQTTnet/Implementations/MqttTcpChannel.cs
Source/MQTTnet/Implementations/MqttTcpChannel.cs
+0
-29
Source/MQTTnet/Server/MqttClientConnection.cs
Source/MQTTnet/Server/MqttClientConnection.cs
+7
-5
未找到文件。
Source/MQTTnet/Client/Options/MqttClientOptionsBuilder.cs
浏览文件 @
d0f1659e
...
...
@@ -169,25 +169,6 @@ namespace MQTTnet.Client.Options
return
WithTls
(
new
MqttClientOptionsBuilderTlsParameters
{
UseTls
=
true
});
}
[
Obsolete
(
"Use method _WithTls_ which accepts the _MqttClientOptionsBuilderTlsParameters_."
)]
public
MqttClientOptionsBuilder
WithTls
(
bool
allowUntrustedCertificates
=
false
,
bool
ignoreCertificateChainErrors
=
false
,
bool
ignoreCertificateRevocationErrors
=
false
,
params
byte
[][]
certificates
)
{
_tlsParameters
=
new
MqttClientOptionsBuilderTlsParameters
{
UseTls
=
true
,
AllowUntrustedCertificates
=
allowUntrustedCertificates
,
IgnoreCertificateChainErrors
=
ignoreCertificateChainErrors
,
IgnoreCertificateRevocationErrors
=
ignoreCertificateRevocationErrors
,
Certificates
=
certificates
?.
ToList
()
};
return
this
;
}
public
IMqttClientOptions
Build
()
{
if
(
_tcpOptions
==
null
&&
_webSocketOptions
==
null
)
...
...
Source/MQTTnet/Implementations/MqttTcpChannel.cs
浏览文件 @
d0f1659e
...
...
@@ -44,9 +44,6 @@ namespace MQTTnet.Implementations
CreateStream
(
sslStream
);
}
[
Obsolete
(
"There is a new callback at the TLS options. This one will be deleted soon."
)]
public
static
Func
<
X509Certificate
,
X509Chain
,
SslPolicyErrors
,
MqttClientTcpOptions
,
bool
>
CustomCertificateValidationCallback
{
get
;
set
;
}
public
string
Endpoint
=>
_socket
?.
RemoteEndPoint
?.
ToString
();
public
bool
IsSecureConnection
{
get
;
}
...
...
@@ -134,18 +131,11 @@ namespace MQTTnet.Implementations
private
bool
InternalUserCertificateValidationCallback
(
object
sender
,
X509Certificate
x509Certificate
,
X509Chain
chain
,
SslPolicyErrors
sslPolicyErrors
)
{
// Try the instance callback.
if
(
_options
.
TlsOptions
.
CertificateValidationCallback
!=
null
)
{
return
_options
.
TlsOptions
.
CertificateValidationCallback
(
x509Certificate
,
chain
,
sslPolicyErrors
,
_clientOptions
);
}
// Try static callback.
if
(
CustomCertificateValidationCallback
!=
null
)
{
return
CustomCertificateValidationCallback
(
x509Certificate
,
chain
,
sslPolicyErrors
,
_options
);
}
if
(
sslPolicyErrors
==
SslPolicyErrors
.
None
)
{
return
true
;
...
...
@@ -197,25 +187,6 @@ namespace MQTTnet.Implementations
_stream
=
new
NetworkStream
(
_socket
,
true
);
}
}
private
static
void
Cleanup
<
T
>(
ref
T
item
,
Action
<
T
>
handler
)
where
T
:
class
{
var
temp
=
item
;
item
=
null
;
try
{
if
(
temp
!=
null
)
{
handler
(
temp
);
}
}
catch
(
ObjectDisposedException
)
{
}
catch
(
NullReferenceException
)
{
}
}
}
}
#endif
Source/MQTTnet/Server/MqttClientConnection.cs
浏览文件 @
d0f1659e
...
...
@@ -138,7 +138,9 @@ namespace MQTTnet.Server
Session
.
WillMessage
=
_connectPacket
.
WillMessage
;
Task
.
Run
(()
=>
SendPendingPacketsAsync
(),
_cancellationToken
.
Token
);
#pragma warning disable 4014
Task
.
Run
(()
=>
SendPendingPacketsAsync
(
_cancellationToken
.
Token
),
_cancellationToken
.
Token
);
#pragma warning restore 4014
// TODO: Change to single thread in SessionManager. Or use SessionManager and stats from KeepAliveMonitor.
_keepAliveMonitor
.
Start
(
_connectPacket
.
KeepAlivePeriod
,
_cancellationToken
.
Token
);
...
...
@@ -372,22 +374,22 @@ namespace MQTTnet.Server
//await Task.FromResult(0);
}
private
async
Task
SendPendingPacketsAsync
()
private
async
Task
SendPendingPacketsAsync
(
CancellationToken
cancellationToken
)
{
MqttPendingApplicationMessage
queuedApplicationMessage
=
null
;
MqttPublishPacket
publishPacket
=
null
;
try
{
while
(!
_
cancellationToken
.
IsCancellationRequested
)
while
(!
cancellationToken
.
IsCancellationRequested
)
{
queuedApplicationMessage
=
await
Session
.
ApplicationMessagesQueue
.
TakeAsync
(
_cancellationToken
.
Token
).
ConfigureAwait
(
false
);
queuedApplicationMessage
=
await
Session
.
ApplicationMessagesQueue
.
TakeAsync
(
cancellation
Token
).
ConfigureAwait
(
false
);
if
(
queuedApplicationMessage
==
null
)
{
return
;
}
if
(
_
cancellationToken
.
IsCancellationRequested
)
if
(
cancellationToken
.
IsCancellationRequested
)
{
return
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录