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
|
|
|
*
|
2013-03-09 22:12:20 +01:00
|
|
|
* Copyright (C) 2008-2009, 2011-2013 Gregory Nutt. All rights reserved.
|
2012-03-04 00:18:34 +01:00
|
|
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
2008-11-20 20:24:06 +01:00
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
*
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in
|
|
|
|
* the documentation and/or other materials provided with the
|
|
|
|
* distribution.
|
|
|
|
* 3. Neither the name NuttX nor the names of its contributors may be
|
|
|
|
* used to endorse or promote products derived from this software
|
|
|
|
* without specific prior written permission.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
|
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
|
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
|
|
|
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
|
|
|
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
|
|
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
|
|
|
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
|
|
|
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
|
|
|
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
|
|
|
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
|
|
* POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* 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 <queue.h>
|
|
|
|
#include <debug.h>
|
|
|
|
|
2013-03-09 22:12:20 +01:00
|
|
|
#include <nuttx/kmalloc.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 */
|
|
|
|
|
2014-09-01 01:34:44 +02:00
|
|
|
bls = (FAR struct tcp_backlog_s *)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
|
|
|
|
* actually be NULL if nblg is <= 0; In that case, we are disabling backlog
|
2017-08-31 15:23:19 +02:00
|
|
|
* support. Since the network is locked, destroying the old backlog and
|
2008-11-20 20:24:06 +01:00
|
|
|
* replace it with the new is an atomic operation
|
|
|
|
*/
|
|
|
|
|
|
|
|
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)
|
|
|
|
{
|
|
|
|
/* Remove the backlog structure reference from the connection */
|
|
|
|
|
|
|
|
blg = conn->backlog;
|
|
|
|
conn->backlog = NULL;
|
|
|
|
|
|
|
|
/* Handle any pending connections in the backlog */
|
|
|
|
|
2015-10-08 23:10:04 +02:00
|
|
|
while ((blc = (FAR struct tcp_blcontainer_s *)sq_remfirst(&blg->bl_pending)) != NULL)
|
2008-11-20 20:24:06 +01:00
|
|
|
{
|
|
|
|
blconn = blc->bc_conn;
|
|
|
|
if (blconn)
|
|
|
|
{
|
|
|
|
/* REVISIT -- such connections really need to be gracefully closed */
|
|
|
|
|
|
|
|
blconn->blparent = NULL;
|
|
|
|
blconn->backlog = NULL;
|
2009-09-16 18:28:53 +02:00
|
|
|
blconn->crefs = 0;
|
2014-06-25 02:12:49 +02:00
|
|
|
tcp_free(blconn);
|
2008-11-20 20:24:06 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Then free the entire backlog structure */
|
|
|
|
|
2014-09-01 01:04:02 +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
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
2014-06-25 02:12:49 +02: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
|
|
|
{
|
2015-10-08 23:10:04 +02:00
|
|
|
/* Allocate 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)
|
|
|
|
{
|
2016-06-20 20:44:38 +02:00
|
|
|
nerr("ERROR: Failed to allocate container\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
|
|
|
/****************************************************************************
|
2017-04-22 00:33:14 +02:00
|
|
|
* Name: tcp_backlogremove
|
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
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#ifndef CONFIG_DISABLE_POLL
|
2014-06-25 02:12:49 +02:00
|
|
|
bool tcp_backlogavailable(FAR struct tcp_conn_s *conn)
|
2009-09-11 00:55:52 +02:00
|
|
|
{
|
|
|
|
return (conn && conn->backlog && !sq_empty(&conn->backlog->bl_pending));
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
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
|
|
|
|
2015-10-08 23:10:04 +02:00
|
|
|
for (blc = (FAR struct tcp_blcontainer_s *)sq_peek(&bls->bl_pending), prev = NULL;
|
|
|
|
blc;
|
|
|
|
prev = blc, blc = (FAR struct tcp_blcontainer_s *)sq_next(&blc->bc_node))
|
|
|
|
{
|
|
|
|
if (blc->bc_conn == blconn)
|
|
|
|
{
|
|
|
|
if (prev)
|
|
|
|
{
|
|
|
|
/* Remove the a container from the middle of the list of
|
|
|
|
* pending connections
|
|
|
|
*/
|
|
|
|
|
|
|
|
(void)sq_remafter(&prev->bc_node, &bls->bl_pending);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* Remove the a container from the head of the list of
|
|
|
|
* pending connections
|
|
|
|
*/
|
|
|
|
|
|
|
|
(void)sq_remfirst(&bls->bl_pending);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* 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 */
|