This repository was archived by the owner on Jan 20, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +16
-5
lines changed Expand file tree Collapse file tree 1 file changed +16
-5
lines changed Original file line number Diff line number Diff line change @@ -119,6 +119,17 @@ AsyncClient& AsyncClient::operator=(const AsyncClient& other){
119
119
120
120
_pcb = other._pcb ;
121
121
if (_pcb) {
122
+ if (axl_get (_pcb)){
123
+ _pcb_secure = true ;
124
+ _handshake_done = false ;
125
+ axl_arg (_pcb, this );
126
+ axl_data (_pcb, &_s_data);
127
+ axl_handshake (_pcb, &_s_handshake);
128
+ axl_err (_pcb, &_s_ssl_error);
129
+ } else {
130
+ _pcb_secure = false ;
131
+ _handshake_done = true ;
132
+ }
122
133
tcp_setprio (_pcb, TCP_PRIO_MIN);
123
134
tcp_arg (_pcb, this );
124
135
tcp_recv (_pcb, &_s_recv);
@@ -243,13 +254,13 @@ size_t AsyncClient::ack(size_t len){
243
254
int8_t AsyncClient::_close (){
244
255
int8_t err = ERR_OK;
245
256
if (_pcb) {
257
+ if (_pcb_secure)
258
+ axl_free (_pcb);
246
259
tcp_arg (_pcb, NULL );
247
260
tcp_sent (_pcb, NULL );
248
261
tcp_recv (_pcb, NULL );
249
262
tcp_err (_pcb, NULL );
250
263
tcp_poll (_pcb, NULL , 0 );
251
- if (_pcb_secure)
252
- axl_free (_pcb);
253
264
err = tcp_close (_pcb);
254
265
if (err != ERR_OK) {
255
266
err = abort ();
@@ -287,13 +298,13 @@ int8_t AsyncClient::_connected(void* pcb, int8_t err){
287
298
288
299
void AsyncClient::_error (int8_t err) {
289
300
if (_pcb){
301
+ if (_pcb_secure)
302
+ axl_free (_pcb);
290
303
tcp_arg (_pcb, NULL );
291
304
tcp_sent (_pcb, NULL );
292
305
tcp_recv (_pcb, NULL );
293
306
tcp_err (_pcb, NULL );
294
307
tcp_poll (_pcb, NULL , 0 );
295
- if (_pcb_secure)
296
- axl_free (_pcb);
297
308
_pcb = NULL ;
298
309
}
299
310
if (_error_cb)
@@ -606,7 +617,7 @@ void AsyncClient::onPoll(AcConnectHandler cb, void* arg){
606
617
607
618
608
619
size_t AsyncClient::space (){
609
- if ((_pcb != NULL ) && (_pcb->state == 4 ))
620
+ if ((_pcb != NULL ) && (_pcb->state == 4 ) && _handshake_done )
610
621
return _pcb->snd_buf ;
611
622
return 0 ;
612
623
}
You can’t perform that action at this time.
0 commit comments