MCPcopy Create free account
hub / github.com/apache/nuttx / rpmsg_socket_connect_internal

Function rpmsg_socket_connect_internal

net/rpmsg/rpmsg_sockif.c:749–802  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

747}
748
749static int rpmsg_socket_connect_internal(FAR struct socket *psock)
750{
751 FAR struct rpmsg_socket_conn_s *conn = psock->s_conn;
752 int ret;
753
754 ret = circbuf_resize(&conn->recvbuf, conn->recvsize);
755 if (ret < 0)
756 {
757 return ret;
758 }
759
760 ret = rpmsg_register_callback(conn,
761 rpmsg_socket_device_created,
762 NULL,
763 NULL,
764 NULL);
765 if (ret < 0)
766 {
767 return ret;
768 }
769
770 nxmutex_lock(&conn->sendlock);
771 if (conn->sendsize == 0)
772 {
773 nxmutex_unlock(&conn->sendlock);
774 if (_SS_ISNONBLOCK(conn->sconn.s_flags))
775 {
776 return -EINPROGRESS;
777 }
778
779 ret = net_sem_timedwait(&conn->sendsem,
780 _SO_TIMEOUT(conn->sconn.s_sndtimeo));
781 if (!conn->ept.rdev || conn->unbind)
782 {
783 ret = -ECONNRESET;
784 }
785
786 if (ret < 0)
787 {
788 rpmsg_unregister_callback(conn,
789 rpmsg_socket_device_created,
790 NULL,
791 NULL,
792 NULL);
793 rpmsg_socket_destroy_ept(conn);
794 }
795 }
796 else
797 {
798 nxmutex_unlock(&conn->sendlock);
799 }
800
801 return ret;
802}
803
804static int rpmsg_socket_connect(FAR struct socket *psock,
805 FAR const struct sockaddr *addr,

Callers 2

rpmsg_socket_connectFunction · 0.85
rpmsg_socket_recvmsgFunction · 0.85

Calls 7

circbuf_resizeFunction · 0.85
rpmsg_register_callbackFunction · 0.85
nxmutex_lockFunction · 0.85
nxmutex_unlockFunction · 0.85
net_sem_timedwaitFunction · 0.85
rpmsg_socket_destroy_eptFunction · 0.85

Tested by

no test coverage detected