Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
srefgeqfeqrfg
arduino-esp32
提交
febcda00
A
arduino-esp32
项目概览
srefgeqfeqrfg
/
arduino-esp32
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
A
arduino-esp32
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
febcda00
编写于
4月 14, 2018
作者:
C
copercini
提交者:
Me No Dev
4月 14, 2018
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add WiFiClientSecure::peek(); (#1310)
上级
69f72eca
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
29 addition
and
9 deletion
+29
-9
libraries/WiFiClientSecure/src/WiFiClientSecure.cpp
libraries/WiFiClientSecure/src/WiFiClientSecure.cpp
+27
-5
libraries/WiFiClientSecure/src/WiFiClientSecure.h
libraries/WiFiClientSecure/src/WiFiClientSecure.h
+2
-4
未找到文件。
libraries/WiFiClientSecure/src/WiFiClientSecure.cpp
浏览文件 @
febcda00
...
...
@@ -39,7 +39,7 @@ WiFiClientSecure::WiFiClientSecure()
_CA_cert
=
NULL
;
_cert
=
NULL
;
_private_key
=
NULL
;
next
=
NULL
;
next
=
NULL
;
}
...
...
@@ -58,13 +58,13 @@ WiFiClientSecure::WiFiClientSecure(int sock)
_CA_cert
=
NULL
;
_cert
=
NULL
;
_private_key
=
NULL
;
next
=
NULL
;
next
=
NULL
;
}
WiFiClientSecure
::~
WiFiClientSecure
()
{
stop
();
delete
sslclient
;
delete
sslclient
;
}
WiFiClientSecure
&
WiFiClientSecure
::
operator
=
(
const
WiFiClientSecure
&
other
)
...
...
@@ -113,6 +113,14 @@ int WiFiClientSecure::connect(const char *host, uint16_t port, const char *_CA_c
return
1
;
}
int
WiFiClientSecure
::
peek
(){
if
(
_peek
>=
0
){
return
_peek
;
}
_peek
=
read
();
return
_peek
;
}
size_t
WiFiClientSecure
::
write
(
uint8_t
data
)
{
return
write
(
&
data
,
1
);
...
...
@@ -120,7 +128,14 @@ size_t WiFiClientSecure::write(uint8_t data)
int
WiFiClientSecure
::
read
()
{
uint8_t
data
=
0
;
uint8_t
data
=
-
1
;
if
(
_peek
>=
0
){
data
=
_peek
;
_peek
=
-
1
;
return
data
;
}
int
res
=
read
(
&
data
,
1
);
if
(
res
<
0
)
{
return
res
;
...
...
@@ -143,6 +158,13 @@ size_t WiFiClientSecure::write(const uint8_t *buf, size_t size)
int
WiFiClientSecure
::
read
(
uint8_t
*
buf
,
size_t
size
)
{
if
(
_peek
>=
0
){
uint8_t
data
=
-
1
;
data
=
_peek
;
_peek
=
-
1
;
return
data
;
}
if
(
!
available
())
{
return
-
1
;
}
...
...
@@ -161,7 +183,7 @@ int WiFiClientSecure::available()
int
res
=
data_to_read
(
sslclient
);
if
(
res
<
0
)
{
stop
();
}
}
return
res
;
}
...
...
libraries/WiFiClientSecure/src/WiFiClientSecure.h
浏览文件 @
febcda00
...
...
@@ -31,6 +31,7 @@ protected:
sslclient_context
*
sslclient
;
int
_lastError
=
0
;
int
_peek
=
-
1
;
const
char
*
_CA_cert
;
const
char
*
_cert
;
const
char
*
_private_key
;
...
...
@@ -44,15 +45,12 @@ public:
int
connect
(
const
char
*
host
,
uint16_t
port
);
int
connect
(
IPAddress
ip
,
uint16_t
port
,
const
char
*
rootCABuff
,
const
char
*
cli_cert
,
const
char
*
cli_key
);
int
connect
(
const
char
*
host
,
uint16_t
port
,
const
char
*
rootCABuff
,
const
char
*
cli_cert
,
const
char
*
cli_key
);
int
peek
();
size_t
write
(
uint8_t
data
);
size_t
write
(
const
uint8_t
*
buf
,
size_t
size
);
int
available
();
int
read
();
int
read
(
uint8_t
*
buf
,
size_t
size
);
int
peek
()
{
return
0
;
}
void
flush
()
{}
void
stop
();
uint8_t
connected
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录