Add support for TCP/IP connection backlog

git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@1294 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
patacongo
2008-11-20 19:24:06 +00:00
parent 14d2342d9e
commit 73a6fc026d
57 changed files with 690 additions and 105 deletions
+3
View File
@@ -576,4 +576,7 @@
and not recv() is in-place when a TCP/IP packet is received, the packet is placed into
a read-ahead buffer. However, the old contents of the read-ahead buffer were not being
cleared and old data would contaminate the newly received buffer.
* Implemented support for connection backlog. The size of the backlog is specified by the
second argument of the standard listen() API. Hooks are provided to support poll()/select()
waiting for connections, with a subsequent call to accept() to use the backlogged connection.
+4 -1
View File
@@ -8,7 +8,7 @@
<tr align="center" bgcolor="#e4e4e4">
<td>
<h1><big><font color="#3c34ec"><i>NuttX RTOS</i></font></big></h1>
<p>Last Updated: November 17, 2008</p>
<p>Last Updated: November 20, 2008</p>
</td>
</tr>
</table>
@@ -1212,6 +1212,9 @@ nuttx-0.3.19 2008-xx-xx Gregory Nutt &lt;spudmonkey@racsa.co.cr&gt;
and not recv() is in-place when a TCP/IP packet is received, the packet is placed into
a read-ahead buffer. However, the old contents of the read-ahead buffer were not being
cleared and old data would contaminate the newly received buffer.
* Implemented support for connection backlog. The size of the backlog is specified by the
second argument of the standard listen() API. Hooks are provided to support poll()/select()
waiting for connections, with a subsequent call to accept() to use the backlogged connection.
pascal-0.1.3 2008-xx-xx Gregory Nutt &lt;spudmonkey@racsa.co.cr&gt;
+5
View File
@@ -1594,6 +1594,11 @@ The system can be re-made subsequently by just typing <code>make</code>.
<li>
<code>CONFIG_NET_TCP_CONNS</code>: Maximum number of TCP connections (all tasks).
</li>
<li>
<code>CONFIG_NET_TCPBACKLOG</code>:
Incoming connections pend in a backlog until <code>accept()</code> is called.
The size of the backlog is selected when <code>listen()</code> is called.
</li>
<li>
<code>CONFIG_NET_TCP_READAHEAD_BUFSIZE</code>: Size of TCP read-ahead buffers
</li>
+8
View File
@@ -6069,6 +6069,14 @@ interface of the same name.
<li><code>CONFIG_NSOCKET_DESCRIPTORS</code> Defined to be greater than 0</li>
<li><code>CONFIG_NET_NTCP_READAHEAD_BUFFERS</code> Defined to be greater than zero</li>
</ul>
<p>
In order to for select to work with incoming connections, you must also select:
</p>
<ul>
<li><code>CONFIG_NET_TCPBACKLOG</code>
Incoming connections pend in a backlog until <code>accept()</cod> is called.
The size of the backlog is selected when <code>listen()</code> is called.</li>
</ul>
<p>
<b>Input Parameters:</b>
</p>
+2 -2
View File
@@ -1,4 +1,4 @@
NuttX TODO List (Last updated November 17, 2008)
NuttX TODO List (Last updated November 19, 2008)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
(7) Task/Scheduler (sched/)
@@ -7,7 +7,7 @@ NuttX TODO List (Last updated November 17, 2008)
(1) Signals (sched/, arch/)
(1) pthreads (sched/)
(1) C++ Support
(14) Network (net/, netutils/)
(15) Network (net/, netutils/)
(1) USB (drivers/usbdev)
(4) Libraries (lib/)
(6) File system/Generic drivers (fs/, drivers/)
+3
View File
@@ -287,6 +287,9 @@ defconfig -- This is a configuration file similar to the Linux
CONFIG_NET_TCP_READAHEAD_BUFSIZE - Size of TCP read-ahead buffers
CONFIG_NET_NTCP_READAHEAD_BUFFERS - Number of TCP read-ahead buffers
(may be zero)
CONFIG_NET_TCPBACKLOG - Incoming connections pend in a backlog until
accept() is called. The size of the backlog is selected when listen()
is called.
CONFIG_NET_UDP - UDP support on or off
CONFIG_NET_UDP_CHECKSUMS - UDP checksums on or off
CONFIG_NET_UDP_CONNS - The maximum amount of concurrent UDP
+3
View File
@@ -279,6 +279,8 @@ CONFIG_PREALLOC_TIMERS=8
# CONFIG_NET_TCP_CONNS - Maximum number of TCP connections (all tasks)
# CONFIG_NET_TCP_READAHEAD_BUFSIZE - Size of TCP read-ahead buffers
# CONFIG_NET_NTCP_READAHEAD_BUFFERS - Number of TCP read-ahead buffers (may be zero)
# CONFIG_NET_TCPBACKLOG - Incoming connections pend in a backlog until
# accept() is called. The size of the backlog is selected when listen() is called.
# CONFIG_NET_MAX_LISTENPORTS - Maximum number of listening TCP ports (all tasks)
# CONFIG_NET_UDP - UDP support on or off
# CONFIG_NET_UDP_CHECKSUMS - UDP checksums on or off
@@ -300,6 +302,7 @@ CONFIG_NET_BUFSIZE=420
CONFIG_NET_TCP=n
CONFIG_NET_TCP_CONNS=40
CONFIG_NET_NTCP_READAHEAD_BUFFERS=8
CONFIG_NET_TCPBACKLOG=n
CONFIG_NET_MAX_LISTENPORTS=40
CONFIG_NET_UDP=n
CONFIG_NET_UDP_CHECKSUMS=y
+3
View File
@@ -279,6 +279,8 @@ CONFIG_PREALLOC_TIMERS=8
# CONFIG_NET_TCP_CONNS - Maximum number of TCP connections (all tasks)
# CONFIG_NET_TCP_READAHEAD_BUFSIZE - Size of TCP read-ahead buffers
# CONFIG_NET_NTCP_READAHEAD_BUFFERS - Number of TCP read-ahead buffers (may be zero)
# CONFIG_NET_TCPBACKLOG - Incoming connections pend in a backlog until
# accept() is called. The size of the backlog is selected when listen() is called.
# CONFIG_NET_MAX_LISTENPORTS - Maximum number of listening TCP ports (all tasks)
# CONFIG_NET_UDP - UDP support on or off
# CONFIG_NET_UDP_CHECKSUMS - UDP checksums on or off
@@ -300,6 +302,7 @@ CONFIG_NET_BUFSIZE=420
CONFIG_NET_TCP=n
CONFIG_NET_TCP_CONNS=0
CONFIG_NET_NTCP_READAHEAD_BUFFERS=0
CONFIG_NET_TCPBACKLOG=n
CONFIG_NET_MAX_LISTENPORTS=0
CONFIG_NET_UDP=y
CONFIG_NET_UDP_CHECKSUMS=y
+3
View File
@@ -279,6 +279,8 @@ CONFIG_PREALLOC_TIMERS=8
# CONFIG_NET_TCP_CONNS - Maximum number of TCP connections (all tasks)
# CONFIG_NET_TCP_READAHEAD_BUFSIZE - Size of TCP read-ahead buffers
# CONFIG_NET_NTCP_READAHEAD_BUFFERS - Number of TCP read-ahead buffers (may be zero)
# CONFIG_NET_TCPBACKLOG - Incoming connections pend in a backlog until
# accept() is called. The size of the backlog is selected when listen() is called.
# CONFIG_NET_MAX_LISTENPORTS - Maximum number of listening TCP ports (all tasks)
# CONFIG_NET_UDP - UDP support on or off
# CONFIG_NET_UDP_CHECKSUMS - UDP checksums on or off
@@ -300,6 +302,7 @@ CONFIG_NET_BUFSIZE=420
CONFIG_NET_TCP=y
CONFIG_NET_TCP_CONNS=8
CONFIG_NET_NTCP_READAHEAD_BUFFERS=32
CONFIG_NET_TCPBACKLOG=n
CONFIG_NET_MAX_LISTENPORTS=8
CONFIG_NET_UDP=n
CONFIG_NET_UDP_CHECKSUMS=y
+3
View File
@@ -279,6 +279,8 @@ CONFIG_PREALLOC_TIMERS=8
# CONFIG_NET_TCP_CONNS - Maximum number of TCP connections (all tasks)
# CONFIG_NET_TCP_READAHEAD_BUFSIZE - Size of TCP read-ahead buffers
# CONFIG_NET_NTCP_READAHEAD_BUFFERS - Number of TCP read-ahead buffers (may be zero)
# CONFIG_NET_TCPBACKLOG - Incoming connections pend in a backlog until
# accept() is called. The size of the backlog is selected when listen() is called.
# CONFIG_NET_MAX_LISTENPORTS - Maximum number of listening TCP ports (all tasks)
# CONFIG_NET_UDP - UDP support on or off
# CONFIG_NET_UDP_CHECKSUMS - UDP checksums on or off
@@ -300,6 +302,7 @@ CONFIG_NET_BUFSIZE=420
CONFIG_NET_TCP=y
CONFIG_NET_TCP_CONNS=8
CONFIG_NET_NTCP_READAHEAD_BUFFERS=32
CONFIG_NET_TCPBACKLOG=n
CONFIG_NET_MAX_LISTENPORTS=8
CONFIG_NET_UDP=n
CONFIG_NET_UDP_CHECKSUMS=y
+2
View File
@@ -279,6 +279,8 @@ CONFIG_PREALLOC_TIMERS=0
# CONFIG_NET_TCP_CONNS - Maximum number of TCP connections (all tasks)
# CONFIG_NET_TCP_READAHEAD_BUFSIZE - Size of TCP read-ahead buffers
# CONFIG_NET_NTCP_READAHEAD_BUFFERS - Number of TCP read-ahead buffers (may be zero)
# CONFIG_NET_TCPBACKLOG - Incoming connections pend in a backlog until
# accept() is called. The size of the backlog is selected when listen() is called.
# CONFIG_NET_MAX_LISTENPORTS - Maximum number of listening TCP ports (all tasks)
# CONFIG_NET_UDP - UDP support on or off
# CONFIG_NET_UDP_CHECKSUMS - UDP checksums on or off
+2
View File
@@ -263,6 +263,8 @@ CONFIG_PREALLOC_TIMERS=8
# CONFIG_NET_TCP_CONNS - Maximum number of TCP connections (all tasks)
# CONFIG_NET_TCP_READAHEAD_BUFSIZE - Size of TCP read-ahead buffers
# CONFIG_NET_NTCP_READAHEAD_BUFFERS - Number of TCP read-ahead buffers (may be zero)
# CONFIG_NET_TCPBACKLOG - Incoming connections pend in a backlog until
# accept() is called. The size of the backlog is selected when listen() is called.
# CONFIG_NET_MAX_LISTENPORTS - Maximum number of listening TCP ports (all tasks)
# CONFIG_NET_UDP - UDP support on or off
# CONFIG_NET_UDP_CHECKSUMS - UDP checksums on or off
+2
View File
@@ -316,6 +316,8 @@ CONFIG_MMCSD_READONLY=n
# CONFIG_NET_TCP_CONNS - Maximum number of TCP connections (all tasks)
# CONFIG_NET_TCP_READAHEAD_BUFSIZE - Size of TCP read-ahead buffers
# CONFIG_NET_NTCP_READAHEAD_BUFFERS - Number of TCP read-ahead buffers (may be zero)
# CONFIG_NET_TCPBACKLOG - Incoming connections pend in a backlog until
# accept() is called. The size of the backlog is selected when listen() is called.
# CONFIG_NET_MAX_LISTENPORTS - Maximum number of listening TCP ports (all tasks)
# CONFIG_NET_UDP - UDP support on or off
# CONFIG_NET_UDP_CHECKSUMS - UDP checksums on or off
+2
View File
@@ -311,6 +311,8 @@ CONFIG_MMCSD_READONLY=n
# CONFIG_NET_TCP_CONNS - Maximum number of TCP connections (all tasks)
# CONFIG_NET_TCP_READAHEAD_BUFSIZE - Size of TCP read-ahead buffers
# CONFIG_NET_NTCP_READAHEAD_BUFFERS - Number of TCP read-ahead buffers (may be zero)
# CONFIG_NET_TCPBACKLOG - Incoming connections pend in a backlog until
# accept() is called. The size of the backlog is selected when listen() is called.
# CONFIG_NET_MAX_LISTENPORTS - Maximum number of listening TCP ports (all tasks)
# CONFIG_NET_UDP - UDP support on or off
# CONFIG_NET_UDP_CHECKSUMS - UDP checksums on or off
@@ -312,6 +312,8 @@ CONFIG_MMCSD_READONLY=n
# CONFIG_NET_TCP_CONNS - Maximum number of TCP connections (all tasks)
# CONFIG_NET_TCP_READAHEAD_BUFSIZE - Size of TCP read-ahead buffers
# CONFIG_NET_NTCP_READAHEAD_BUFFERS - Number of TCP read-ahead buffers (may be zero)
# CONFIG_NET_TCPBACKLOG - Incoming connections pend in a backlog until
# accept() is called. The size of the backlog is selected when listen() is called.
# CONFIG_NET_MAX_LISTENPORTS - Maximum number of listening TCP ports (all tasks)
# CONFIG_NET_UDP - UDP support on or off
# CONFIG_NET_UDP_CHECKSUMS - UDP checksums on or off
@@ -312,6 +312,8 @@ CONFIG_MMCSD_READONLY=n
# CONFIG_NET_TCP_CONNS - Maximum number of TCP connections (all tasks)
# CONFIG_NET_TCP_READAHEAD_BUFSIZE - Size of TCP read-ahead buffers
# CONFIG_NET_NTCP_READAHEAD_BUFFERS - Number of TCP read-ahead buffers (may be zero)
# CONFIG_NET_TCPBACKLOG - Incoming connections pend in a backlog until
# accept() is called. The size of the backlog is selected when listen() is called.
# CONFIG_NET_MAX_LISTENPORTS - Maximum number of listening TCP ports (all tasks)
# CONFIG_NET_UDP - UDP support on or off
# CONFIG_NET_UDP_CHECKSUMS - UDP checksums on or off
+4
View File
@@ -277,6 +277,8 @@ CONFIG_PREALLOC_TIMERS=8
# CONFIG_NET_TCP_CONNS - Maximum number of TCP connections (all tasks)
# CONFIG_NET_TCP_READAHEAD_BUFSIZE - Size of TCP read-ahead buffers
# CONFIG_NET_NTCP_READAHEAD_BUFFERS - Number of TCP read-ahead buffers (may be zero)
# CONFIG_NET_TCPBACKLOG - Incoming connections pend in a backlog until
# accept() is called. The size of the backlog is selected when listen() is called.
# CONFIG_NET_MAX_LISTENPORTS - Maximum number of listening TCP ports (all tasks)
# CONFIG_NET_UDP - UDP support on or off
# CONFIG_NET_UDP_CHECKSUMS - UDP checksums on or off
@@ -297,6 +299,8 @@ CONFIG_NET_SOCKOPTS=y
CONFIG_NET_BUFSIZE=420
CONFIG_NET_TCP=y
CONFIG_NET_TCP_CONNS=8
CONFIG_NET_NTCP_READAHEAD_BUFFERS=16
CONFIG_NET_TCPBACKLOG=n
CONFIG_NET_MAX_LISTENPORTS=8
CONFIG_NET_UDP=n
CONFIG_NET_UDP_CHECKSUMS=y
+4
View File
@@ -285,6 +285,8 @@ CONFIG_FS_ROMFS=y
# CONFIG_NET_TCP_CONNS - Maximum number of TCP connections (all tasks)
# CONFIG_NET_TCP_READAHEAD_BUFSIZE - Size of TCP read-ahead buffers
# CONFIG_NET_NTCP_READAHEAD_BUFFERS - Number of TCP read-ahead buffers (may be zero)
# CONFIG_NET_TCPBACKLOG - Incoming connections pend in a backlog until
# accept() is called. The size of the backlog is selected when listen() is called.
# CONFIG_NET_MAX_LISTENPORTS - Maximum number of listening TCP ports (all tasks)
# CONFIG_NET_UDP - UDP support on or off
# CONFIG_NET_UDP_CHECKSUMS - UDP checksums on or off
@@ -305,6 +307,8 @@ CONFIG_NET_SOCKOPTS=y
CONFIG_NET_BUFSIZE=562
CONFIG_NET_TCP=y
CONFIG_NET_TCP_CONNS=8
CONFIG_NET_NTCP_READAHEAD_BUFFERS=16
CONFIG_NET_TCPBACKLOG=n
CONFIG_NET_MAX_LISTENPORTS=8
CONFIG_NET_UDP=y
CONFIG_NET_UDP_CHECKSUMS=y
+2
View File
@@ -277,6 +277,8 @@ CONFIG_PREALLOC_TIMERS=8
# CONFIG_NET_TCP_CONNS - Maximum number of TCP connections (all tasks)
# CONFIG_NET_TCP_READAHEAD_BUFSIZE - Size of TCP read-ahead buffers
# CONFIG_NET_NTCP_READAHEAD_BUFFERS - Number of TCP read-ahead buffers (may be zero)
# CONFIG_NET_TCPBACKLOG - Incoming connections pend in a backlog until
# accept() is called. The size of the backlog is selected when listen() is called.
# CONFIG_NET_MAX_LISTENPORTS - Maximum number of listening TCP ports (all tasks)
# CONFIG_NET_UDP - UDP support on or off
# CONFIG_NET_UDP_CHECKSUMS - UDP checksums on or off
+4 -1
View File
@@ -277,6 +277,8 @@ CONFIG_PREALLOC_TIMERS=8
# CONFIG_NET_TCP_CONNS - Maximum number of TCP connections (all tasks)
# CONFIG_NET_TCP_READAHEAD_BUFSIZE - Size of TCP read-ahead buffers
# CONFIG_NET_NTCP_READAHEAD_BUFFERS - Number of TCP read-ahead buffers (may be zero)
# CONFIG_NET_TCPBACKLOG - Incoming connections pend in a backlog until
# accept() is called. The size of the backlog is selected when listen() is called.
# CONFIG_NET_MAX_LISTENPORTS - Maximum number of listening TCP ports (all tasks)
# CONFIG_NET_UDP - UDP support on or off
# CONFIG_NET_UDP_CHECKSUMS - UDP checksums on or off
@@ -297,7 +299,8 @@ CONFIG_NET_SOCKOPTS=y
CONFIG_NET_BUFSIZE=420
CONFIG_NET_TCP=y
CONFIG_NET_TCP_CONNS=8
CONFIG_NET_TCP_READAHEAD_BUFSIZE=16
CONFIG_NET_NTCP_READAHEAD_BUFFERS=16
CONFIG_NET_TCPBACKLOG=y
CONFIG_NET_MAX_LISTENPORTS=8
CONFIG_NET_UDP=n
CONFIG_NET_UDP_CHECKSUMS=y
+4
View File
@@ -277,6 +277,8 @@ CONFIG_PREALLOC_TIMERS=8
# CONFIG_NET_TCP_CONNS - Maximum number of TCP connections (all tasks)
# CONFIG_NET_TCP_READAHEAD_BUFSIZE - Size of TCP read-ahead buffers
# CONFIG_NET_NTCP_READAHEAD_BUFFERS - Number of TCP read-ahead buffers (may be zero)
# CONFIG_NET_TCPBACKLOG - Incoming connections pend in a backlog until
# accept() is called. The size of the backlog is selected when listen() is called.
# CONFIG_NET_MAX_LISTENPORTS - Maximum number of listening TCP ports (all tasks)
# CONFIG_NET_UDP - UDP support on or off
# CONFIG_NET_UDP_CHECKSUMS - UDP checksums on or off
@@ -297,6 +299,8 @@ CONFIG_NET_SOCKOPTS=y
CONFIG_NET_BUFSIZE=420
CONFIG_NET_TCP=n
CONFIG_NET_TCP_CONNS=0
CONFIG_NET_NTCP_READAHEAD_BUFFERS=16
CONFIG_NET_TCPBACKLOG=n
CONFIG_NET_MAX_LISTENPORTS=0
CONFIG_NET_UDP=y
CONFIG_NET_UDP_CHECKSUMS=y
+4
View File
@@ -277,6 +277,8 @@ CONFIG_PREALLOC_TIMERS=8
# CONFIG_NET_TCP_CONNS - Maximum number of TCP connections (all tasks)
# CONFIG_NET_TCP_READAHEAD_BUFSIZE - Size of TCP read-ahead buffers
# CONFIG_NET_NTCP_READAHEAD_BUFFERS - Number of TCP read-ahead buffers (may be zero)
# CONFIG_NET_TCPBACKLOG - Incoming connections pend in a backlog until
# accept() is called. The size of the backlog is selected when listen() is called.
# CONFIG_NET_MAX_LISTENPORTS - Maximum number of listening TCP ports (all tasks)
# CONFIG_NET_UDP - UDP support on or off
# CONFIG_NET_UDP_CHECKSUMS - UDP checksums on or off
@@ -297,6 +299,8 @@ CONFIG_NET_SOCKOPTS=y
CONFIG_NET_BUFSIZE=420
CONFIG_NET_TCP=y
CONFIG_NET_TCP_CONNS=8
CONFIG_NET_NTCP_READAHEAD_BUFFERS=16
CONFIG_NET_TCPBACKLOG=n
CONFIG_NET_MAX_LISTENPORTS=8
CONFIG_NET_UDP=n
CONFIG_NET_UDP_CHECKSUMS=y
+2
View File
@@ -378,6 +378,8 @@ CONFIG_MMCSD_READONLY=n
# CONFIG_NET_TCP_CONNS - Maximum number of TCP connections (all tasks)
# CONFIG_NET_TCP_READAHEAD_BUFSIZE - Size of TCP read-ahead buffers
# CONFIG_NET_NTCP_READAHEAD_BUFFERS - Number of TCP read-ahead buffers (may be zero)
# CONFIG_NET_TCPBACKLOG - Incoming connections pend in a backlog until
# accept() is called. The size of the backlog is selected when listen() is called.
# CONFIG_NET_MAX_LISTENPORTS - Maximum number of listening TCP ports (all tasks)
# CONFIG_NET_UDP - UDP support on or off
# CONFIG_NET_UDP_CHECKSUMS - UDP checksums on or off
+2
View File
@@ -260,6 +260,8 @@ CONFIG_PREALLOC_TIMERS=0
# CONFIG_NET_TCP_CONNS - Maximum number of TCP connections (all tasks)
# CONFIG_NET_TCP_READAHEAD_BUFSIZE - Size of TCP read-ahead buffers
# CONFIG_NET_NTCP_READAHEAD_BUFFERS - Number of TCP read-ahead buffers (may be zero)
# CONFIG_NET_TCPBACKLOG - Incoming connections pend in a backlog until
# accept() is called. The size of the backlog is selected when listen() is called.
# CONFIG_NET_MAX_LISTENPORTS - Maximum number of listening TCP ports (all tasks)
# CONFIG_NET_UDP - UDP support on or off
# CONFIG_NET_UDP_CHECKSUMS - UDP checksums on or off
+2
View File
@@ -235,6 +235,8 @@ CONFIG_FS_ROMFS=n
# CONFIG_NET_TCP_CONNS - Maximum number of TCP connections (all tasks)
# CONFIG_NET_TCP_READAHEAD_BUFSIZE - Size of TCP read-ahead buffers
# CONFIG_NET_NTCP_READAHEAD_BUFFERS - Number of TCP read-ahead buffers (may be zero)
# CONFIG_NET_TCPBACKLOG - Incoming connections pend in a backlog until
# accept() is called. The size of the backlog is selected when listen() is called.
# CONFIG_NET_MAX_LISTENPORTS - Maximum number of listening TCP ports (all tasks)
# CONFIG_NET_UDP - UDP support on or off
# CONFIG_NET_UDP_CHECKSUMS - UDP checksums on or off
+2
View File
@@ -235,6 +235,8 @@ CONFIG_FS_ROMFS=n
# CONFIG_NET_TCP_CONNS - Maximum number of TCP connections (all tasks)
# CONFIG_NET_TCP_READAHEAD_BUFSIZE - Size of TCP read-ahead buffers
# CONFIG_NET_NTCP_READAHEAD_BUFFERS - Number of TCP read-ahead buffers (may be zero)
# CONFIG_NET_TCPBACKLOG - Incoming connections pend in a backlog until
# accept() is called. The size of the backlog is selected when listen() is called.
# CONFIG_NET_MAX_LISTENPORTS - Maximum number of listening TCP ports (all tasks)
# CONFIG_NET_UDP - UDP support on or off
# CONFIG_NET_UDP_CHECKSUMS - UDP checksums on or off
+2
View File
@@ -235,6 +235,8 @@ CONFIG_FS_ROMFS=y
# CONFIG_NET_TCP_CONNS - Maximum number of TCP connections (all tasks)
# CONFIG_NET_TCP_READAHEAD_BUFSIZE - Size of TCP read-ahead buffers
# CONFIG_NET_NTCP_READAHEAD_BUFFERS - Number of TCP read-ahead buffers (may be zero)
# CONFIG_NET_TCPBACKLOG - Incoming connections pend in a backlog until
# accept() is called. The size of the backlog is selected when listen() is called.
# CONFIG_NET_MAX_LISTENPORTS - Maximum number of listening TCP ports (all tasks)
# CONFIG_NET_UDP - UDP support on or off
# CONFIG_NET_UDP_CHECKSUMS - UDP checksums on or off
+2
View File
@@ -236,6 +236,8 @@ CONFIG_FS_ROMFS=n
# CONFIG_NET_TCP_CONNS - Maximum number of TCP connections (all tasks)
# CONFIG_NET_TCP_READAHEAD_BUFSIZE - Size of TCP read-ahead buffers
# CONFIG_NET_NTCP_READAHEAD_BUFFERS - Number of TCP read-ahead buffers (may be zero)
# CONFIG_NET_TCPBACKLOG - Incoming connections pend in a backlog until
# accept() is called. The size of the backlog is selected when listen() is called.
# CONFIG_NET_MAX_LISTENPORTS - Maximum number of listening TCP ports (all tasks)
# CONFIG_NET_UDP - UDP support on or off
# CONFIG_NET_UDP_CHECKSUMS - UDP checksums on or off
+2
View File
@@ -235,6 +235,8 @@ CONFIG_FS_ROMFS=n
# CONFIG_NET_TCP_CONNS - Maximum number of TCP connections (all tasks)
# CONFIG_NET_TCP_READAHEAD_BUFSIZE - Size of TCP read-ahead buffers
# CONFIG_NET_NTCP_READAHEAD_BUFFERS - Number of TCP read-ahead buffers (may be zero)
# CONFIG_NET_TCPBACKLOG - Incoming connections pend in a backlog until
# accept() is called. The size of the backlog is selected when listen() is called.
# CONFIG_NET_MAX_LISTENPORTS - Maximum number of listening TCP ports (all tasks)
# CONFIG_NET_UDP - UDP support on or off
# CONFIG_NET_UDP_CHECKSUMS - UDP checksums on or off
+2
View File
@@ -330,6 +330,8 @@ CONFIG_MMCSD_READONLY=n
# CONFIG_NET_TCP_CONNS - Maximum number of TCP connections (all tasks)
# CONFIG_NET_TCP_READAHEAD_BUFSIZE - Size of TCP read-ahead buffers
# CONFIG_NET_NTCP_READAHEAD_BUFFERS - Number of TCP read-ahead buffers (may be zero)
# CONFIG_NET_TCPBACKLOG - Incoming connections pend in a backlog until
# accept() is called. The size of the backlog is selected when listen() is called.
# CONFIG_NET_MAX_LISTENPORTS - Maximum number of listening TCP ports (all tasks)
# CONFIG_NET_UDP - UDP support on or off
# CONFIG_NET_UDP_CHECKSUMS - UDP checksums on or off
+2
View File
@@ -330,6 +330,8 @@ CONFIG_MMCSD_READONLY=n
# CONFIG_NET_TCP_CONNS - Maximum number of TCP connections (all tasks)
# CONFIG_NET_TCP_READAHEAD_BUFSIZE - Size of TCP read-ahead buffers
# CONFIG_NET_NTCP_READAHEAD_BUFFERS - Number of TCP read-ahead buffers (may be zero)
# CONFIG_NET_TCPBACKLOG - Incoming connections pend in a backlog until
# accept() is called. The size of the backlog is selected when listen() is called.
# CONFIG_NET_MAX_LISTENPORTS - Maximum number of listening TCP ports (all tasks)
# CONFIG_NET_UDP - UDP support on or off
# CONFIG_NET_UDP_CHECKSUMS - UDP checksums on or off
+2
View File
@@ -256,6 +256,8 @@ CONFIG_PREALLOC_TIMERS=0
# CONFIG_NET_TCP_CONNS - Maximum number of TCP connections (all tasks)
# CONFIG_NET_TCP_READAHEAD_BUFSIZE - Size of TCP read-ahead buffers
# CONFIG_NET_NTCP_READAHEAD_BUFFERS - Number of TCP read-ahead buffers (may be zero)
# CONFIG_NET_TCPBACKLOG - Incoming connections pend in a backlog until
# accept() is called. The size of the backlog is selected when listen() is called.
# CONFIG_NET_MAX_LISTENPORTS - Maximum number of listening TCP ports (all tasks)
# CONFIG_NET_UDP - UDP support on or off
# CONFIG_NET_UDP_CHECKSUMS - UDP checksums on or off
+2
View File
@@ -256,6 +256,8 @@ CONFIG_PREALLOC_TIMERS=0
# CONFIG_NET_TCP_CONNS - Maximum number of TCP connections (all tasks)
# CONFIG_NET_TCP_READAHEAD_BUFSIZE - Size of TCP read-ahead buffers
# CONFIG_NET_NTCP_READAHEAD_BUFFERS - Number of TCP read-ahead buffers (may be zero)
# CONFIG_NET_TCPBACKLOG - Incoming connections pend in a backlog until
# accept() is called. The size of the backlog is selected when listen() is called.
# CONFIG_NET_MAX_LISTENPORTS - Maximum number of listening TCP ports (all tasks)
# CONFIG_NET_UDP - UDP support on or off
# CONFIG_NET_UDP_CHECKSUMS - UDP checksums on or off
+2
View File
@@ -256,6 +256,8 @@ CONFIG_PREALLOC_TIMERS=0
# CONFIG_NET_TCP_CONNS - Maximum number of TCP connections (all tasks)
# CONFIG_NET_TCP_READAHEAD_BUFSIZE - Size of TCP read-ahead buffers
# CONFIG_NET_NTCP_READAHEAD_BUFFERS - Number of TCP read-ahead buffers (may be zero)
# CONFIG_NET_TCPBACKLOG - Incoming connections pend in a backlog until
# accept() is called. The size of the backlog is selected when listen() is called.
# CONFIG_NET_MAX_LISTENPORTS - Maximum number of listening TCP ports (all tasks)
# CONFIG_NET_UDP - UDP support on or off
# CONFIG_NET_UDP_CHECKSUMS - UDP checksums on or off
+2
View File
@@ -282,6 +282,8 @@ CONFIG_PREALLOC_TIMERS=4
# CONFIG_NET_TCP_CONNS - Maximum number of TCP connections (all tasks)
# CONFIG_NET_TCP_READAHEAD_BUFSIZE - Size of TCP read-ahead buffers
# CONFIG_NET_NTCP_READAHEAD_BUFFERS - Number of TCP read-ahead buffers (may be zero)
# CONFIG_NET_TCPBACKLOG - Incoming connections pend in a backlog until
# accept() is called. The size of the backlog is selected when listen() is called.
# CONFIG_NET_MAX_LISTENPORTS - Maximum number of listening TCP ports (all tasks)
# CONFIG_NET_UDP - UDP support on or off
# CONFIG_NET_UDP_CHECKSUMS - UDP checksums on or off
@@ -282,6 +282,8 @@ CONFIG_PREALLOC_TIMERS=4
# CONFIG_NET_TCP_CONNS - Maximum number of TCP connections (all tasks)
# CONFIG_NET_TCP_READAHEAD_BUFSIZE - Size of TCP read-ahead buffers
# CONFIG_NET_NTCP_READAHEAD_BUFFERS - Number of TCP read-ahead buffers (may be zero)
# CONFIG_NET_TCPBACKLOG - Incoming connections pend in a backlog until
# accept() is called. The size of the backlog is selected when listen() is called.
# CONFIG_NET_MAX_LISTENPORTS - Maximum number of listening TCP ports (all tasks)
# CONFIG_NET_UDP - UDP support on or off
# CONFIG_NET_UDP_CHECKSUMS - UDP checksums on or off
+2
View File
@@ -246,6 +246,8 @@ CONFIG_PREALLOC_TIMERS=0
# CONFIG_NET_TCP_CONNS - Maximum number of TCP connections (all tasks)
# CONFIG_NET_TCP_READAHEAD_BUFSIZE - Size of TCP read-ahead buffers
# CONFIG_NET_NTCP_READAHEAD_BUFFERS - Number of TCP read-ahead buffers (may be zero)
# CONFIG_NET_TCPBACKLOG - Incoming connections pend in a backlog until
# accept() is called. The size of the backlog is selected when listen() is called.
# CONFIG_NET_MAX_LISTENPORTS - Maximum number of listening TCP ports (all tasks)
# CONFIG_NET_UDP - UDP support on or off
# CONFIG_NET_UDP_CHECKSUMS - UDP checksums on or off
+2
View File
@@ -246,6 +246,8 @@ CONFIG_PREALLOC_TIMERS=0
# CONFIG_NET_TCP_CONNS - Maximum number of TCP connections (all tasks)
# CONFIG_NET_TCP_READAHEAD_BUFSIZE - Size of TCP read-ahead buffers
# CONFIG_NET_NTCP_READAHEAD_BUFFERS - Number of TCP read-ahead buffers (may be zero)
# CONFIG_NET_TCPBACKLOG - Incoming connections pend in a backlog until
# accept() is called. The size of the backlog is selected when listen() is called.
# CONFIG_NET_MAX_LISTENPORTS - Maximum number of listening TCP ports (all tasks)
# CONFIG_NET_UDP - UDP support on or off
# CONFIG_NET_UDP_CHECKSUMS - UDP checksums on or off
+2
View File
@@ -246,6 +246,8 @@ CONFIG_PREALLOC_TIMERS=0
# CONFIG_NET_TCP_CONNS - Maximum number of TCP connections (all tasks)
# CONFIG_NET_TCP_READAHEAD_BUFSIZE - Size of TCP read-ahead buffers
# CONFIG_NET_NTCP_READAHEAD_BUFFERS - Number of TCP read-ahead buffers (may be zero)
# CONFIG_NET_TCPBACKLOG - Incoming connections pend in a backlog until
# accept() is called. The size of the backlog is selected when listen() is called.
# CONFIG_NET_MAX_LISTENPORTS - Maximum number of listening TCP ports (all tasks)
# CONFIG_NET_UDP - UDP support on or off
# CONFIG_NET_UDP_CHECKSUMS - UDP checksums on or off
+2
View File
@@ -280,6 +280,8 @@ CONFIG_PREALLOC_TIMERS=0
# CONFIG_NET_TCP_CONNS - Maximum number of TCP connections (all tasks)
# CONFIG_NET_TCP_READAHEAD_BUFSIZE - Size of TCP read-ahead buffers
# CONFIG_NET_NTCP_READAHEAD_BUFFERS - Number of TCP read-ahead buffers (may be zero)
# CONFIG_NET_TCPBACKLOG - Incoming connections pend in a backlog until
# accept() is called. The size of the backlog is selected when listen() is called.
# CONFIG_NET_MAX_LISTENPORTS - Maximum number of listening TCP ports (all tasks)
# CONFIG_NET_UDP - UDP support on or off
# CONFIG_NET_UDP_CHECKSUMS - UDP checksums on or off
+2
View File
@@ -280,6 +280,8 @@ CONFIG_PREALLOC_TIMERS=0
# CONFIG_NET_TCP_CONNS - Maximum number of TCP connections (all tasks)
# CONFIG_NET_TCP_READAHEAD_BUFSIZE - Size of TCP read-ahead buffers
# CONFIG_NET_NTCP_READAHEAD_BUFFERS - Number of TCP read-ahead buffers (may be zero)
# CONFIG_NET_TCPBACKLOG - Incoming connections pend in a backlog until
# accept() is called. The size of the backlog is selected when listen() is called.
# CONFIG_NET_MAX_LISTENPORTS - Maximum number of listening TCP ports (all tasks)
# CONFIG_NET_UDP - UDP support on or off
# CONFIG_NET_UDP_CHECKSUMS - UDP checksums on or off
+5
View File
@@ -118,6 +118,11 @@ examples/poll
CONFIG_EXAMPLE_POLL_DRIPADDR - Default router IP addess
CONFIG_EXAMPLE_POLL_NETMASK - Network mask
In order to for select to work with incoming connections, you
must also select:
CONFIG_NET_TCPBACKLOG - Incoming connections pend in a backlog until accept() is called.
In additional to the target device-side example, there is also
a host-side application in this directory. It can be compiled under
Linux or Cygwin as follows:
+1 -1
View File
@@ -70,6 +70,6 @@ clean:
$(call CLEAN)
distclean: clean
@rm -f Make.dep .depend
@rm -f Make.dep .depend host
-include Make.dep
+1 -1
View File
@@ -156,7 +156,7 @@ int user_start(int argc, char *argv[])
}
#ifdef HAVE_NETPOLL
#if 0 /* select doesn't work for connections yet */
#ifdef CONFIG_NET_TCPBACKLOG
message("user_start: Starting net_listener thread\n");
ret = pthread_create(&tid3, NULL, net_listener, NULL);
+77 -18
View File
@@ -77,19 +77,19 @@
/* The TCP states used in the struct uip_conn tcpstateflags field */
#define UIP_CLOSED 0 /* The connection is not in use and available */
#define UIP_ALLOCATED 1 /* The connection is allocated, but not yet initialized */
#define UIP_SYN_RCVD 2
#define UIP_SYN_SENT 3
#define UIP_ESTABLISHED 4
#define UIP_FIN_WAIT_1 5
#define UIP_FIN_WAIT_2 6
#define UIP_CLOSING 7
#define UIP_TIME_WAIT 8
#define UIP_LAST_ACK 9
#define UIP_TS_MASK 15
#define UIP_STOPPED 16
#define UIP_TS_MASK 0x0f /* Bits 0-3: TCP state */
#define UIP_CLOSED 0x00 /* The connection is not in use and available */
#define UIP_ALLOCATED 0x01 /* The connection is allocated, but not yet initialized */
#define UIP_SYN_RCVD 0x02
#define UIP_SYN_SENT 0x03
#define UIP_ESTABLISHED 0x04
#define UIP_FIN_WAIT_1 0x05
#define UIP_FIN_WAIT_2 0x06
#define UIP_CLOSING 0x07
#define UIP_TIME_WAIT 0x08
#define UIP_LAST_ACK 0x09
#define UIP_STOPPED 0x10 /* Bit 4: stopped */
/* Bit 5-7: Unused, but not available */
/* Flag bits in 16-bit flags+ipoffset IPv4 TCP header field */
@@ -118,13 +118,11 @@
struct uip_driver_s; /* Forward reference */
struct uip_callback_s; /* Forward reference */
struct uip_backlog_s; /* Forward reference */
struct uip_conn
{
dq_entry_t node; /* Implements a doubly linked list */
#if 0 /* Not used */
uip_ipaddr_t lipaddr; /* The local IP address */
#endif
uip_ipaddr_t ripaddr; /* The IP address of the remote host */
uint16 lport; /* The local TCP port, in network byte order */
uint16 rport; /* The remoteTCP port, in network byte order */
@@ -146,10 +144,29 @@ struct uip_conn
uint8 nrtx; /* The number of retransmissions for the last
* segment sent */
/* Read-ahead buffering */
/* Read-ahead buffering.
*
* readahead - A singly linked list of type struct uip_readahead_s
* where the TCP/IP read-ahead data is retained.
*/
#if CONFIG_NET_NTCP_READAHEAD_BUFFERS > 0
sq_queue_t readahead;
sq_queue_t readahead; /* Read-ahead buffering */
#endif
/* Listen backlog support
*
* blparent - The backlog parent. If this connection is backlogged,
* this field will be non-null and will refer to the TCP connection
* structure in which this connection is backlogged.
* backlog - The pending connection backlog. If this connection is
* configured as a listener with backlog, then this refers to the
* struct uip_backlog_s tear-off structure that manages that backlog.
*/
#ifdef CONFIG_NET_TCPBACKLOG
struct uip_conn *blparent;
struct uip_backlog_s *backlog;
#endif
/* Application callbacks:
@@ -204,6 +221,27 @@ struct uip_readahead_s
};
#endif
/* Support for listen backlog:
*
* struct uip_blcontainer_s describes one backlogged connection
* struct uip_backlog_s is a "tear-off" describing all backlog for a
* listener connection
*/
#ifdef CONFIG_NET_TCPBACKLOG
struct uip_blcontainer_s
{
dq_entry_t bc_node; /* Implements a doubly linked list */
FAR struct uip_conn *bc_conn; /* Holds reference to the new connection structure */
};
struct uip_backlog_s
{
dq_queue_t bl_free; /* Implements a doubly-linked list of free containers */
dq_queue_t bl_pending; /* Implements a doubly-linked list of pending connections */
};
#endif
/* The structure holding the TCP/IP statistics that are gathered if
* CONFIG_NET_STATISTICS is defined.
*/
@@ -350,6 +388,27 @@ extern struct uip_readahead_s *uip_tcpreadaheadalloc(void);
extern void uip_tcpreadaheadrelease(struct uip_readahead_s *buf);
#endif /* CONFIG_NET_NTCP_READAHEAD_BUFFERS */
/* Backlog support */
#ifdef CONFIG_NET_TCPBACKLOG
/* APIs to create and terminate TCP backlog support */
extern int uip_backlogcreate(FAR struct uip_conn *conn, int nblg);
extern int uip_backlogdestroy(FAR struct uip_conn *conn);
/* APIs to manage individual backlog actions */
extern int uip_backlogadd(FAR struct uip_conn *conn, FAR struct uip_conn *blconn);
extern FAR struct uip_conn *uip_backlogremove(FAR struct uip_conn *conn);
extern int uip_backlogdelete(FAR struct uip_conn *conn, FAR struct uip_conn *blconn);
#else
# define uip_backlogcreate(conn,nblg) (-ENOSYS)
# define uip_backlogdestroy(conn) (-ENOSYS)
# define uip_backlogadd(conn,blconn) (-ENOSYS)
# define uip_backlogremove(conn) (NULL)
#endif
/* Tell the sending host to stop sending data.
*
* This function will close our receiver's window so that we stop
+10 -6
View File
@@ -81,7 +81,10 @@
* UIP_POLL IN: Used for polling the application. This is provided
* periodically from the drivers to support (1) timed
* operations, and (2) to check if the application has
* data that it wants to send
* data that it wants to send
* OUT: Not used
* UIP_BACKLOG IN: There is a new connection in the backlog list set
* up by the listen() command. (TCP only)
* OUT: Not used
* UIP_CLOSE IN: The remote host has closed the connection, thus the
* connection has gone away. (TCP only)
@@ -110,11 +113,12 @@
#define UIP_SNDACK (1 << 2)
#define UIP_REXMIT (1 << 3)
#define UIP_POLL (1 << 4)
#define UIP_CLOSE (1 << 5)
#define UIP_ABORT (1 << 6)
#define UIP_CONNECTED (1 << 7)
#define UIP_TIMEDOUT (1 << 8)
#define UIP_ECHOREPLY (1 << 9)
#define UIP_BACKLOG (1 << 5)
#define UIP_CLOSE (1 << 6)
#define UIP_ABORT (1 << 7)
#define UIP_CONNECTED (1 << 8)
#define UIP_TIMEDOUT (1 << 9)
#define UIP_ECHOREPLY (1 << 10)
#define UIP_CONN_EVENTS (UIP_CLOSE|UIP_ABORT|UIP_CONNECTED|UIP_TIMEDOUT)
+73 -55
View File
@@ -1,7 +1,7 @@
/****************************************************************************
* net/accept.c
*
* Copyright (C) 2007 Gregory Nutt. All rights reserved.
* Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@@ -289,7 +289,9 @@ int accept(int sockfd, struct sockaddr *addr, socklen_t *addrlen)
goto errout;
}
/* Verify that a valid memory block has been provided to receive the address address */
/* Verify that a valid memory block has been provided to receive
* the address
*/
#ifdef CONFIG_NET_IPv6
if (addr->sa_family != AF_INET6 || *addrlen < sizeof(struct sockaddr_in6))
@@ -301,7 +303,9 @@ int accept(int sockfd, struct sockaddr *addr, socklen_t *addrlen)
goto errout;
}
/* Allocate a socket descriptor for the new connection now (so that it cannot fail later) */
/* Allocate a socket descriptor for the new connection now
* (so that it cannot fail later)
*/
newfd = sockfd_allocate();
if (newfd < 0)
@@ -317,69 +321,80 @@ int accept(int sockfd, struct sockaddr *addr, socklen_t *addrlen)
goto errout_with_socket;
}
/* Set the socket state to accepting */
psock->s_flags = _SS_SETSTATE(psock->s_flags, _SF_ACCEPT);
/* Perform the TCP accept operation */
/* Initialize the state structure. This is done with interrupts
* disabled because we don't want anything to happen until we
* are ready.
/* Check the backlog to see if there is a connection already pending
* for this listener.
*/
save = irqsave();
state.acpt_addr = inaddr;
state.acpt_newconn = NULL;
state.acpt_result = OK;
sem_init(&state.acpt_sem, 0, 0);
save = irqsave();
conn = (struct uip_conn *)psock->s_conn;
/* Set up the callback in the connection */
#ifdef CONFIG_NET_TCPBACKLOG
state.acpt_newconn = uip_backlogremove(conn);
if (!state.acpt_newconn)
#endif
{
/* Set the socket state to accepting */
conn = (struct uip_conn *)psock->s_conn;
conn->accept_private = (void*)&state;
conn->accept = accept_interrupt;
psock->s_flags = _SS_SETSTATE(psock->s_flags, _SF_ACCEPT);
/* Wait for the send to complete or an error to occur: NOTES: (1)
* sem_wait will also terminate if a signal is received, (2) interrupts
* are disabled! They will be re-enabled while the task sleeps and
* automatically re-enabled when the task restarts.
*/
/* Perform the TCP accept operation */
ret = sem_wait(&state.acpt_sem);
/* Initialize the state structure. This is done with interrupts
* disabled because we don't want anything to happen until we
* are ready.
*/
/* Make sure that no further interrupts are processed */
state.acpt_addr = inaddr;
state.acpt_newconn = NULL;
state.acpt_result = OK;
sem_init(&state.acpt_sem, 0, 0);
conn->accept_private = NULL;
conn->accept = NULL;
/* Set up the callback in the connection */
sem_destroy(&state. acpt_sem);
conn->accept_private = (void*)&state;
conn->accept = accept_interrupt;
/* Wait for the send to complete or an error to occur: NOTES: (1)
* sem_wait will also terminate if a signal is received, (2) interrupts
* are disabled! They will be re-enabled while the task sleeps and
* automatically re-enabled when the task restarts.
*/
ret = sem_wait(&state.acpt_sem);
/* Make sure that no further interrupts are processed */
conn->accept_private = NULL;
conn->accept = NULL;
sem_destroy(&state. acpt_sem);
/* Set the socket state to idle */
psock->s_flags = _SS_SETSTATE(psock->s_flags, _SF_IDLE);
/* Check for a errors. Errors are signaled by negative errno values
* for the send length
*/
if (state.acpt_result != 0)
{
err = state.acpt_result;
goto errout_with_irq;
}
/* If sem_wait failed, then we were probably reawakened by a signal. In
* this case, sem_wait will have set errno appropriately.
*/
if (ret < 0)
{
err = -ret;
goto errout_with_irq;
}
}
irqrestore(save);
/* Set the socket state to idle */
psock->s_flags = _SS_SETSTATE(psock->s_flags, _SF_IDLE);
/* Check for a errors. Errors are signaled by negative errno values
* for the send length
*/
if (state.acpt_result != 0)
{
err = state.acpt_result;
goto errout_with_socket;
}
/* If sem_wait failed, then we were probably reawakened by a signal. In
* this case, sem_wait will have set errno appropriately.
*/
if (ret < 0)
{
err = -ret;
goto errout_with_socket;
}
/* Initialize the socket structure and mark the socket as connected */
pnewsock->s_type = SOCK_STREAM;
@@ -387,6 +402,9 @@ int accept(int sockfd, struct sockaddr *addr, socklen_t *addrlen)
pnewsock->s_flags |= _SF_CONNECTED;
return newfd;
errout_with_irq:
irqrestore(save);
errout_with_socket:
sockfd_release(newfd);
+15 -4
View File
@@ -114,7 +114,7 @@ int listen(int sockfd, int backlog)
}
/* Verify that the sockfd corresponds to a connected SOCK_STREAM */
conn = (struct uip_conn *)psock->s_conn;
if (psock->s_type != SOCK_STREAM || !psock->s_conn || conn->lport <= 0)
{
@@ -122,16 +122,27 @@ int listen(int sockfd, int backlog)
goto errout;
}
/* Set up the backlog for this connection */
#ifdef CONFIG_NET_TCPBACKLOG
err = uip_backlogcreate(conn, backlog);
if (err < 0)
{
err = -err;
goto errout;
}
#endif
/* Start listening to the bound port. This enables callbacks when accept()
* is called; and someday should enable post() or select() logic.
* is called and enables poll()/select() logic.
*/
uip_listen(conn);
psock->s_flags |= _SF_LISTENING;
return OK;
errout:
*get_errno_ptr() = err;
errno = err;
return ERROR;
}
+4 -6
View File
@@ -114,9 +114,9 @@ static uint16 poll_interrupt(struct uip_driver_s *dev, FAR void *conn,
{
pollevent_t eventset = 0;
/* Check for data availability events. */
/* Check for data or connection availability events. */
if ((flags & UIP_NEWDATA) != 0)
if ((flags & (UIP_NEWDATA|UIP_BACKLOG)) != 0)
{
eventset |= POLLIN & fds->events;
}
@@ -174,8 +174,7 @@ static inline int net_pollsetup(FAR struct socket *psock, struct pollfd *fds)
#ifdef CONFIG_DEBUG
if (!conn || !fds)
{
ret = -EINVAL;
goto errout;
return -EINVAL;
}
#endif
@@ -194,7 +193,7 @@ static inline int net_pollsetup(FAR struct socket *psock, struct pollfd *fds)
/* Initialize the callbcack structure */
cb->flags = UIP_NEWDATA|UIP_POLL|UIP_CLOSE|UIP_ABORT|UIP_TIMEDOUT;
cb->flags = UIP_NEWDATA|UIP_BACKLOG|UIP_POLL|UIP_CLOSE|UIP_ABORT|UIP_TIMEDOUT;
cb->private = (FAR void *)fds;
cb->event = poll_interrupt;
@@ -219,7 +218,6 @@ static inline int net_pollsetup(FAR struct socket *psock, struct pollfd *fds)
errout_with_irq:
irqrestore(flags);
errout:
return ret;
}
#endif /* HAVE_NETPOLL */
+1 -1
View File
@@ -53,7 +53,7 @@ ifeq ($(CONFIG_NET_TCP),y)
UIP_CSRCS += uip-tcpconn.c uip-tcppoll.c uip-tcptimer.c uip-tcpsend.c \
uip-tcpinput.c uip-tcpappsend.c uip-listen.c uip-tcpcallback.c \
uip-tcpreadahead.c
uip-tcpreadahead.c uip-tcpbacklog.c
endif

Some files were not shown because too many files have changed in this diff Show More