Yet another repair for the previouis botched recvfrom() fix; Fix telnet driver: It needs to break out of the read loop if 0 (meaning not conneced) of a value < 0 (an error) is encountered.
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5541 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
parent
98e3699cc6
commit
b4cff0fa72
@ -490,3 +490,5 @@
|
||||
* apps/builtin/: Extensions from Mike Smith.
|
||||
* apps/examples/ftpd/Makefile: Name ftpd_start is not the name of
|
||||
the entrypoint. Should be ftpd_main (from Yan T.)
|
||||
* apps/netutils/telnetd/telnetd_driver: Was stuck in a loop if
|
||||
recv[from]() ever returned a value <= 0.
|
||||
|
@ -558,6 +558,8 @@ static ssize_t telnetd_read(FAR struct file *filep, FAR char *buffer, size_t len
|
||||
{
|
||||
if (priv->td_pending > 0)
|
||||
{
|
||||
/* Process the buffered telnet data */
|
||||
|
||||
FAR const char *src = &priv->td_rxbuffer[priv->td_offset];
|
||||
ret = telnetd_receive(priv, src, priv->td_pending, buffer, len);
|
||||
}
|
||||
@ -568,13 +570,25 @@ static ssize_t telnetd_read(FAR struct file *filep, FAR char *buffer, size_t len
|
||||
{
|
||||
ret = psock_recv(&priv->td_psock, priv->td_rxbuffer,
|
||||
CONFIG_TELNETD_RXBUFFER_SIZE, 0);
|
||||
|
||||
/* Did we receive anything? */
|
||||
|
||||
if (ret > 0)
|
||||
{
|
||||
/* Process the received telnet data */
|
||||
/* Yes.. Process the newly received telnet data */
|
||||
|
||||
telnetd_dumpbuffer("Received buffer", priv->td_rxbuffer, ret);
|
||||
ret = telnetd_receive(priv, priv->td_rxbuffer, ret, buffer, len);
|
||||
}
|
||||
|
||||
/* Otherwise the peer closed the connection (ret == 0) or an error
|
||||
* occurred (ret < 0).
|
||||
*/
|
||||
|
||||
else
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
while (ret == 0);
|
||||
|
Loading…
Reference in New Issue
Block a user