net_startmonitor.c always returned zero. In the case where a socket has already been closed, it correctly handled the disconnetion event but still returned OK. Returning OK causes the callers of net_startmonitor to assume that the connection was okay, undoing the good things that net_startmonitor did and causing the socket to be marked as connected. This behavior was noted by Pelle Windestam.

This commit is contained in:
Gregory Nutt
2015-05-28 08:23:51 -06:00
parent 0e2b6929b4
commit 01d176af76
6 changed files with 74 additions and 24 deletions
+7 -1
View File
@@ -231,7 +231,13 @@ FAR struct socket *sockfd_socket(int sockfd);
* psock - The socket of interest
*
* Returned Value:
* For now, this function always returns OK.
* On success, net_startmonitor returns OK; On any failure,
* net_startmonitor will return a negated errno value. The only failure
* that can occur is if the socket has already been closed and, in this
* case, -ENOTCONN is returned.
*
* Assumptions:
* The caller holds the network lock.
*
****************************************************************************/