2008-11-20 20:24:06 +01:00
|
|
|
/****************************************************************************
|
2014-06-18 18:18:53 +02:00
|
|
|
* net/tcp/tcp_backlog.c
|
2008-11-20 20:24:06 +01:00
|
|
|
*
|
2024-09-11 14:39:39 +02:00
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
|
|
*
|
2021-02-19 12:45:37 +01:00
|
|
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
* contributor license agreements. See the NOTICE file distributed with
|
|
|
|
* this work for additional information regarding copyright ownership. The
|
|
|
|
* ASF licenses this file to you 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
|
2008-11-20 20:24:06 +01:00
|
|
|
*
|
2021-02-19 12:45:37 +01:00
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
2008-11-20 20:24:06 +01:00
|
|
|
*
|
2021-02-19 12:45:37 +01:00
|
|
|
* 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.
|
2008-11-20 20:24:06 +01:00
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Included Files
|
|
|
|
****************************************************************************/
|
|
|
|
|
2014-06-24 16:53:28 +02:00
|
|
|
#include <nuttx/net/netconfig.h>
|
2008-11-20 20:24:06 +01:00
|
|
|
#if defined(CONFIG_NET) && defined(CONFIG_NET_TCP) && defined(CONFIG_NET_TCPBACKLOG)
|
|
|
|
|
2009-12-15 15:53:45 +01:00
|
|
|
#include <stdint.h>
|
|
|
|
#include <stdbool.h>
|
2008-11-20 20:24:06 +01:00
|
|
|
#include <stdlib.h>
|
|
|
|
#include <debug.h>
|
|
|
|
|
2013-03-09 22:12:20 +01:00
|
|
|
#include <nuttx/kmalloc.h>
|
2022-09-25 17:08:38 +02:00
|
|
|
#include <nuttx/queue.h>
|
2014-07-05 00:38:51 +02:00
|
|
|
#include <nuttx/net/net.h>
|
2008-11-20 20:24:06 +01:00
|
|
|
|
2014-06-29 02:07:02 +02:00
|
|
|
#include "devif/devif.h"
|
2014-07-07 01:58:36 +02:00
|
|
|
#include "tcp/tcp.h"
|
2008-11-20 20:24:06 +01:00
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Public Functions
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
/****************************************************************************
|
2017-04-22 00:33:14 +02:00
|
|
|
* Name: tcp_backlogcreate
|
2008-11-20 20:24:06 +01:00
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Called from the listen() logic to setup the backlog as specified in the
|
2009-06-15 20:58:22 +02:00
|
|
|
* the listen arguments.
|
2008-11-20 20:24:06 +01:00
|
|
|
*
|
|
|
|
* Assumptions:
|
2017-08-31 15:23:19 +02:00
|
|
|
* Called from normal task logic. The network may or may not be locked.
|
2008-11-20 20:24:06 +01:00
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
2014-06-25 02:12:49 +02:00
|
|
|
int tcp_backlogcreate(FAR struct tcp_conn_s *conn, int nblg)
|
2008-11-20 20:24:06 +01:00
|
|
|
{
|
2014-06-25 02:12:49 +02:00
|
|
|
FAR struct tcp_backlog_s *bls = NULL;
|
|
|
|
FAR struct tcp_blcontainer_s *blc;
|
2008-11-20 20:24:06 +01:00
|
|
|
int size;
|
|
|
|
int offset;
|
|
|
|
int i;
|
|
|
|
|
2016-06-20 19:59:15 +02:00
|
|
|
ninfo("conn=%p nblg=%d\n", conn, nblg);
|
2008-11-20 22:50:55 +01:00
|
|
|
|
2016-06-11 22:14:08 +02:00
|
|
|
#ifdef CONFIG_DEBUG_FEATURES
|
2008-11-20 20:24:06 +01:00
|
|
|
if (!conn)
|
|
|
|
{
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* Then allocate the backlog as requested */
|
|
|
|
|
|
|
|
if (nblg > 0)
|
|
|
|
{
|
2018-11-09 18:20:33 +01:00
|
|
|
/* nblog value must less than SOMAXCONN */
|
|
|
|
|
|
|
|
if (nblg > SOMAXCONN)
|
|
|
|
{
|
|
|
|
nblg = SOMAXCONN;
|
|
|
|
}
|
|
|
|
|
2008-11-20 20:24:06 +01:00
|
|
|
/* Align the list of backlog structures to 32-bit boundaries. This
|
|
|
|
* may be excessive on 24-16-bit address machines; and insufficient
|
|
|
|
* on 64-bit address machines -- REVISIT
|
|
|
|
*/
|
|
|
|
|
2014-06-25 02:12:49 +02:00
|
|
|
offset = (sizeof(struct tcp_backlog_s) + 3) & ~3;
|
2008-11-20 20:24:06 +01:00
|
|
|
|
|
|
|
/* Then determine the full size of the allocation include the
|
2014-06-25 02:12:49 +02:00
|
|
|
* tcp_backlog_s, a pre-allocated array of struct tcp_blcontainer_s
|
2014-04-12 20:13:01 +02:00
|
|
|
* and alignment padding
|
2008-11-20 20:24:06 +01:00
|
|
|
*/
|
|
|
|
|
2014-06-25 02:12:49 +02:00
|
|
|
size = offset + nblg * sizeof(struct tcp_blcontainer_s);
|
2008-11-20 20:24:06 +01:00
|
|
|
|
|
|
|
/* Then allocate that much */
|
|
|
|
|
2023-08-28 09:39:47 +02:00
|
|
|
bls = kmm_zalloc(size);
|
2008-11-20 20:24:06 +01:00
|
|
|
if (!bls)
|
|
|
|
{
|
2016-06-20 20:44:38 +02:00
|
|
|
nerr("ERROR: Failed to allocate backlog\n");
|
2008-11-20 20:24:06 +01:00
|
|
|
return -ENOMEM;
|
|
|
|
}
|
|
|
|
|
2009-06-25 19:44:35 +02:00
|
|
|
/* Then add all of the pre-allocated containers to the free list */
|
2008-11-20 20:24:06 +01:00
|
|
|
|
2015-10-08 23:10:04 +02:00
|
|
|
blc = (FAR struct tcp_blcontainer_s *)(((FAR uint8_t *)bls) + offset);
|
2008-11-20 20:24:06 +01:00
|
|
|
for (i = 0; i < nblg; i++)
|
|
|
|
{
|
2008-11-21 13:47:36 +01:00
|
|
|
sq_addfirst(&blc->bc_node, &bls->bl_free);
|
2013-09-06 19:43:59 +02:00
|
|
|
blc++;
|
2008-11-20 20:24:06 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Destroy any existing backlog (shouldn't be any) */
|
|
|
|
|
2016-12-03 23:28:19 +01:00
|
|
|
net_lock();
|
2014-06-25 02:12:49 +02:00
|
|
|
tcp_backlogdestroy(conn);
|
2008-11-20 20:24:06 +01:00
|
|
|
|
|
|
|
/* Now install the backlog tear-off in the connection. NOTE that bls may
|
2021-02-19 15:01:46 +01:00
|
|
|
* actually be NULL if nblg is <= 0; In that case, we are disabling
|
|
|
|
* backlog support. Since the network is locked, destroying the old
|
|
|
|
* backlog and replace it with the new is an atomic operation
|
2008-11-20 20:24:06 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
conn->backlog = bls;
|
2016-12-03 23:28:19 +01:00
|
|
|
net_unlock();
|
2008-11-20 20:24:06 +01:00
|
|
|
return OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
/****************************************************************************
|
2017-04-22 00:33:14 +02:00
|
|
|
* Name: tcp_backlogdestroy
|
2008-11-20 20:24:06 +01:00
|
|
|
*
|
|
|
|
* Description:
|
2014-06-25 02:12:49 +02:00
|
|
|
* (1) Called from tcp_free() whenever a connection is freed.
|
|
|
|
* (2) Called from tcp_backlogcreate() to destroy any old backlog
|
2008-11-20 20:24:06 +01:00
|
|
|
*
|
2014-06-25 02:12:49 +02:00
|
|
|
* NOTE: This function may re-enter tcp_free when a connection that
|
2008-11-20 20:24:06 +01:00
|
|
|
* is freed that has pending connections.
|
|
|
|
*
|
|
|
|
* Assumptions:
|
2017-08-31 15:23:19 +02:00
|
|
|
* Called from network socket logic with the network locked
|
2008-11-20 20:24:06 +01:00
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
2014-06-25 02:12:49 +02:00
|
|
|
int tcp_backlogdestroy(FAR struct tcp_conn_s *conn)
|
2008-11-20 20:24:06 +01:00
|
|
|
{
|
2014-06-25 02:12:49 +02:00
|
|
|
FAR struct tcp_backlog_s *blg;
|
|
|
|
FAR struct tcp_blcontainer_s *blc;
|
|
|
|
FAR struct tcp_conn_s *blconn;
|
2008-11-20 20:24:06 +01:00
|
|
|
|
2016-06-20 19:59:15 +02:00
|
|
|
ninfo("conn=%p\n", conn);
|
2008-11-20 22:50:55 +01:00
|
|
|
|
2016-06-11 22:14:08 +02:00
|
|
|
#ifdef CONFIG_DEBUG_FEATURES
|
2008-11-20 20:24:06 +01:00
|
|
|
if (!conn)
|
|
|
|
{
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* Make sure that the connection has a backlog to be destroyed */
|
|
|
|
|
|
|
|
if (conn->backlog)
|
|
|
|
{
|
2019-07-03 02:02:23 +02:00
|
|
|
/* Remove the backlog structure reference from the connection */
|
2008-11-20 20:24:06 +01:00
|
|
|
|
2019-07-03 02:02:23 +02:00
|
|
|
blg = conn->backlog;
|
|
|
|
conn->backlog = NULL;
|
2008-11-20 20:24:06 +01:00
|
|
|
|
2019-07-03 02:02:23 +02:00
|
|
|
/* Handle any pending connections in the backlog */
|
2008-11-20 20:24:06 +01:00
|
|
|
|
2020-01-11 16:40:32 +01:00
|
|
|
while ((blc = (FAR struct tcp_blcontainer_s *)
|
|
|
|
sq_remfirst(&blg->bl_pending)) != NULL)
|
2019-07-03 02:02:23 +02:00
|
|
|
{
|
|
|
|
blconn = blc->bc_conn;
|
|
|
|
if (blconn)
|
|
|
|
{
|
2021-02-19 15:01:46 +01:00
|
|
|
/* REVISIT
|
|
|
|
* -- such connections really need to be gracefully closed
|
|
|
|
*/
|
2019-07-03 02:02:23 +02:00
|
|
|
|
|
|
|
blconn->blparent = NULL;
|
|
|
|
blconn->backlog = NULL;
|
|
|
|
blconn->crefs = 0;
|
|
|
|
tcp_free(blconn);
|
|
|
|
}
|
|
|
|
}
|
2008-11-20 20:24:06 +01:00
|
|
|
|
2019-07-03 02:02:23 +02:00
|
|
|
/* Then free the entire backlog structure */
|
2008-11-20 20:24:06 +01:00
|
|
|
|
2019-07-03 02:02:23 +02:00
|
|
|
kmm_free(blg);
|
2008-11-20 20:24:06 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
return OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
/****************************************************************************
|
2017-04-22 00:33:14 +02:00
|
|
|
* Name: tcp_backlogadd
|
2008-11-20 20:24:06 +01:00
|
|
|
*
|
|
|
|
* Description:
|
2014-06-25 02:12:49 +02:00
|
|
|
* Called tcp_listen when a new connection is made with a listener socket
|
2009-06-15 20:58:22 +02:00
|
|
|
* but when there is no accept() in place to receive the connection. This
|
2008-11-20 20:24:06 +01:00
|
|
|
* function adds the new connection to the backlog.
|
|
|
|
*
|
|
|
|
* Assumptions:
|
2017-08-31 15:23:19 +02:00
|
|
|
* Called from network socket logic with the network locked
|
2008-11-20 20:24:06 +01:00
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
2021-02-19 15:01:46 +01:00
|
|
|
int tcp_backlogadd(FAR struct tcp_conn_s *conn,
|
|
|
|
FAR struct tcp_conn_s *blconn)
|
2008-11-20 20:24:06 +01:00
|
|
|
{
|
2014-06-25 02:12:49 +02:00
|
|
|
FAR struct tcp_backlog_s *bls;
|
|
|
|
FAR struct tcp_blcontainer_s *blc;
|
2008-11-20 20:24:06 +01:00
|
|
|
int ret = -EINVAL;
|
|
|
|
|
2016-06-20 19:59:15 +02:00
|
|
|
ninfo("conn=%p blconn=%p\n", conn, blconn);
|
2008-11-20 22:50:55 +01:00
|
|
|
|
2016-06-11 22:14:08 +02:00
|
|
|
#ifdef CONFIG_DEBUG_FEATURES
|
2008-11-20 20:24:06 +01:00
|
|
|
if (!conn)
|
|
|
|
{
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
bls = conn->backlog;
|
2009-09-16 22:28:30 +02:00
|
|
|
if (bls && blconn)
|
2008-11-20 20:24:06 +01:00
|
|
|
{
|
2020-02-24 18:35:01 +01:00
|
|
|
/* Get a container for the connection from the free list */
|
2008-11-20 20:24:06 +01:00
|
|
|
|
2015-10-08 23:10:04 +02:00
|
|
|
blc = (FAR struct tcp_blcontainer_s *)sq_remfirst(&bls->bl_free);
|
|
|
|
if (!blc)
|
|
|
|
{
|
2020-02-24 18:35:01 +01:00
|
|
|
nerr("ERROR: There are no free containers for TCP BACKLOG!\n");
|
2015-10-08 23:10:04 +02:00
|
|
|
ret = -ENOMEM;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* Save the connection reference in the container and put the
|
|
|
|
* container at the end of the pending connection list (FIFO).
|
|
|
|
*/
|
2008-11-20 20:24:06 +01:00
|
|
|
|
2015-10-08 23:10:04 +02:00
|
|
|
blc->bc_conn = blconn;
|
|
|
|
sq_addlast(&blc->bc_node, &bls->bl_pending);
|
|
|
|
ret = OK;
|
|
|
|
}
|
2008-11-20 20:24:06 +01:00
|
|
|
}
|
2015-10-08 23:10:04 +02:00
|
|
|
|
2008-11-20 20:24:06 +01:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2009-09-11 00:55:52 +02:00
|
|
|
/****************************************************************************
|
2023-04-17 16:07:31 +02:00
|
|
|
* Name: tcp_backlogpending
|
2009-09-11 00:55:52 +02:00
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Called from poll(). Before waiting for a new connection, poll will
|
|
|
|
* call this API to see if there are pending connections in the backlog.
|
|
|
|
*
|
|
|
|
* Assumptions:
|
2017-08-31 15:23:19 +02:00
|
|
|
* Called from network socket logic with the network locked
|
2009-09-11 00:55:52 +02:00
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
2023-04-17 16:07:31 +02:00
|
|
|
bool tcp_backlogpending(FAR struct tcp_conn_s *conn)
|
2009-09-11 00:55:52 +02:00
|
|
|
{
|
|
|
|
return (conn && conn->backlog && !sq_empty(&conn->backlog->bl_pending));
|
|
|
|
}
|
|
|
|
|
2023-04-17 16:07:31 +02:00
|
|
|
/****************************************************************************
|
|
|
|
* Name: tcp_backlogavailable
|
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Called from tcp_input(). Before alloc a new accept connection, tcp_input
|
|
|
|
* will call this API to see if there are free node in the backlog.
|
|
|
|
*
|
|
|
|
* Assumptions:
|
|
|
|
* Called from network socket logic with the network locked
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
bool tcp_backlogavailable(FAR struct tcp_conn_s *conn)
|
|
|
|
{
|
|
|
|
return (conn && conn->backlog && !sq_empty(&conn->backlog->bl_free));
|
|
|
|
}
|
|
|
|
|
2008-11-20 20:24:06 +01:00
|
|
|
/****************************************************************************
|
2017-04-22 00:33:14 +02:00
|
|
|
* Name: tcp_backlogremove
|
2008-11-20 20:24:06 +01:00
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Called from accept(). Before waiting for a new connection, accept will
|
|
|
|
* call this API to see if there are pending connections in the backlog.
|
|
|
|
*
|
|
|
|
* Assumptions:
|
2017-08-31 15:23:19 +02:00
|
|
|
* Called from network socket logic with the network locked
|
2008-11-20 20:24:06 +01:00
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
2014-07-06 20:34:27 +02:00
|
|
|
FAR struct tcp_conn_s *tcp_backlogremove(FAR struct tcp_conn_s *conn)
|
2008-11-20 20:24:06 +01:00
|
|
|
{
|
2014-06-25 02:12:49 +02:00
|
|
|
FAR struct tcp_backlog_s *bls;
|
|
|
|
FAR struct tcp_blcontainer_s *blc;
|
|
|
|
FAR struct tcp_conn_s *blconn = NULL;
|
2008-11-20 20:24:06 +01:00
|
|
|
|
2016-06-11 22:14:08 +02:00
|
|
|
#ifdef CONFIG_DEBUG_FEATURES
|
2008-11-20 20:24:06 +01:00
|
|
|
if (!conn)
|
|
|
|
{
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
#endif
|
2008-11-20 22:50:55 +01:00
|
|
|
|
2008-11-20 20:24:06 +01:00
|
|
|
bls = conn->backlog;
|
2008-11-20 22:50:55 +01:00
|
|
|
if (bls)
|
2008-11-20 20:24:06 +01:00
|
|
|
{
|
2015-10-08 23:10:04 +02:00
|
|
|
/* Remove the a container at the head of the pending connection list
|
|
|
|
* (FIFO)
|
|
|
|
*/
|
2008-11-20 20:24:06 +01:00
|
|
|
|
2015-10-08 23:10:04 +02:00
|
|
|
blc = (FAR struct tcp_blcontainer_s *)sq_remfirst(&bls->bl_pending);
|
|
|
|
if (blc)
|
|
|
|
{
|
|
|
|
/* Extract the connection reference from the container and put
|
|
|
|
* container in the free list
|
|
|
|
*/
|
2008-11-20 20:24:06 +01:00
|
|
|
|
2015-10-08 23:10:04 +02:00
|
|
|
blconn = blc->bc_conn;
|
|
|
|
blc->bc_conn = NULL;
|
|
|
|
sq_addlast(&blc->bc_node, &bls->bl_free);
|
|
|
|
}
|
2008-11-20 20:24:06 +01:00
|
|
|
}
|
2008-11-20 22:50:55 +01:00
|
|
|
|
2016-06-20 19:59:15 +02:00
|
|
|
ninfo("conn=%p, returning %p\n", conn, blconn);
|
2008-11-20 20:24:06 +01:00
|
|
|
return blconn;
|
|
|
|
}
|
|
|
|
|
|
|
|
/****************************************************************************
|
2017-04-22 00:33:14 +02:00
|
|
|
* Name: tcp_backlogdelete
|
2008-11-20 20:24:06 +01:00
|
|
|
*
|
|
|
|
* Description:
|
2014-06-25 02:12:49 +02:00
|
|
|
* Called from tcp_free() when a connection is freed that this also
|
|
|
|
* retained in the pending connection list of a listener. We simply need
|
|
|
|
* to remove the defunct connection from the list.
|
2008-11-20 20:24:06 +01:00
|
|
|
*
|
|
|
|
* Assumptions:
|
2017-08-31 15:23:19 +02:00
|
|
|
* Called from network socket logic with the network locked
|
2008-11-20 20:24:06 +01:00
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
2014-07-06 20:34:27 +02:00
|
|
|
int tcp_backlogdelete(FAR struct tcp_conn_s *conn,
|
|
|
|
FAR struct tcp_conn_s *blconn)
|
2008-11-20 20:24:06 +01:00
|
|
|
{
|
2014-06-25 02:12:49 +02:00
|
|
|
FAR struct tcp_backlog_s *bls;
|
|
|
|
FAR struct tcp_blcontainer_s *blc;
|
|
|
|
FAR struct tcp_blcontainer_s *prev;
|
2008-11-20 20:24:06 +01:00
|
|
|
|
2016-06-20 19:59:15 +02:00
|
|
|
ninfo("conn=%p blconn=%p\n", conn, blconn);
|
2008-11-20 22:50:55 +01:00
|
|
|
|
2016-06-11 22:14:08 +02:00
|
|
|
#ifdef CONFIG_DEBUG_FEATURES
|
2008-11-20 20:24:06 +01:00
|
|
|
if (!conn)
|
|
|
|
{
|
2008-11-20 22:50:55 +01:00
|
|
|
return -EINVAL;
|
2008-11-20 20:24:06 +01:00
|
|
|
}
|
|
|
|
#endif
|
2008-11-20 22:50:55 +01:00
|
|
|
|
2008-11-20 20:24:06 +01:00
|
|
|
bls = conn->backlog;
|
|
|
|
if (bls)
|
|
|
|
{
|
2015-10-08 23:10:04 +02:00
|
|
|
/* Find the container hold the connection */
|
2008-11-20 20:24:06 +01:00
|
|
|
|
2020-01-11 16:40:32 +01:00
|
|
|
for (blc = (FAR struct tcp_blcontainer_s *)sq_peek(&bls->bl_pending),
|
|
|
|
prev = NULL;
|
2015-10-08 23:10:04 +02:00
|
|
|
blc;
|
2021-02-19 15:01:46 +01:00
|
|
|
prev = blc,
|
|
|
|
blc = (FAR struct tcp_blcontainer_s *)sq_next(&blc->bc_node))
|
2015-10-08 23:10:04 +02:00
|
|
|
{
|
|
|
|
if (blc->bc_conn == blconn)
|
|
|
|
{
|
|
|
|
if (prev)
|
|
|
|
{
|
|
|
|
/* Remove the a container from the middle of the list of
|
|
|
|
* pending connections
|
|
|
|
*/
|
|
|
|
|
2020-01-02 17:49:34 +01:00
|
|
|
sq_remafter(&prev->bc_node, &bls->bl_pending);
|
2015-10-08 23:10:04 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* Remove the a container from the head of the list of
|
|
|
|
* pending connections
|
|
|
|
*/
|
|
|
|
|
2020-01-02 17:49:34 +01:00
|
|
|
sq_remfirst(&bls->bl_pending);
|
2015-10-08 23:10:04 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Put container in the free list */
|
|
|
|
|
|
|
|
blc->bc_conn = NULL;
|
|
|
|
sq_addlast(&blc->bc_node, &bls->bl_free);
|
|
|
|
return OK;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-06-20 20:44:38 +02:00
|
|
|
nerr("ERROR: Failed to find pending connection\n");
|
2015-10-08 23:10:04 +02:00
|
|
|
return -EINVAL;
|
2008-11-20 20:24:06 +01:00
|
|
|
}
|
2014-04-12 20:13:01 +02:00
|
|
|
|
2008-11-20 20:24:06 +01:00
|
|
|
return OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* CONFIG_NET && CONFIG_NET_TCP && CONFIG_NET_TCPBACKLOG */
|