sockets: re-check socket state after call to pr_rcvd()
Socket state may have changed after dropping the receive
buffer lock in order to call pr_rcvd(). If the buffer is
empty, re-check the state after reaquiring the lock and
skip calling sbwait() if the socket is in error or the
peer has closed.
Approved by: re (gjb)
PR: 212716
Reviewed by: markj, glebius
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D41783
(cherry picked from commit f44102411e1b16363e91a074c9c403069c550e4d)
(cherry picked from commit caaea455773898bee9a0c59466a84256192e0980)