If write buffering is enabled, then it is necessary to release the write buffer resources (callback structure) when the socket is closed

This commit is contained in:
Gregory Nutt 2014-01-14 18:19:43 -06:00
parent 10d4657d15
commit d89adb76d8

View File

@ -215,7 +215,7 @@ static void telnetd_getchar(FAR struct telnetd_dev_s *priv, uint8_t ch,
* Name: telnetd_receive * Name: telnetd_receive
* *
* Description: * Description:
* Process a received telenet buffer * Process a received Telnet buffer
* *
****************************************************************************/ ****************************************************************************/
@ -500,12 +500,20 @@ static int telnetd_close(FAR struct file *filep)
} }
else else
{ {
/* Unregister the character driver */ /* Un-register the character driver */
ret = unregister_driver(devpath); ret = unregister_driver(devpath);
if (ret < 0) if (ret < 0)
{ {
nlldbg("Failed to unregister the driver %s: %d\n", devpath, ret); /* NOTE: a return value of -EBUSY is not an error, it simply
* means that the Telnet driver is busy now and cannot be
* registered now because there are other sessions using the
* connection. The driver will be properly unregistered when
* the final session terminates.
*/
nlldbg("Failed to unregister the driver %s: %d\n",
devpath, ret);
} }
free(devpath); free(devpath);