iperf: handle NO_MEM error in OpenThread iperf

* simplify iperf send/recv loop
This commit is contained in:
zhangwenxu
2021-10-25 14:47:05 +08:00
committed by bot
parent 9044374032
commit 0fe32adb58
3 changed files with 30 additions and 60 deletions

View File

@@ -1,16 +1,8 @@
// Copyright 2021 Espressif Systems (Shanghai) CO LTD
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License
/*
* SPDX-FileCopyrightText: 2021 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <string.h>
#include "esp_netif.h"
@@ -55,10 +47,15 @@ static err_t openthread_output_ip6(struct netif *netif, struct pbuf *p, const st
pbuf_free(q);
}
/* Check error */
if (unlikely(ret != ESP_OK)) {
return ERR_ABRT;
} else {
switch(ret) {
case ESP_ERR_NO_MEM:
return ERR_MEM;
case ESP_OK:
return ERR_OK;
default:
return ERR_ABRT;
}
}