mirror of
https://github.com/open5gs/open5gs.git
synced 2025-11-04 22:13:26 +00:00
Oops! re-add net_read() in testcode
This commit is contained in:
@@ -88,6 +88,7 @@ int tests1ap_enb_read(net_sock_t *sock, pkbuf_t *recvbuf)
|
||||
{
|
||||
int rc = 0;
|
||||
|
||||
#if USE_USRSCTP == 1
|
||||
struct socket *psock = (struct socket *)sock;
|
||||
struct sockaddr_in addr;
|
||||
char name[INET6_ADDRSTRLEN];
|
||||
@@ -98,6 +99,8 @@ int tests1ap_enb_read(net_sock_t *sock, pkbuf_t *recvbuf)
|
||||
struct sctp_rcvinfo rcv_info;
|
||||
unsigned int infotype;
|
||||
|
||||
while(1)
|
||||
{
|
||||
n = usrsctp_recvv(psock, recvbuf->payload, MAX_SDU_LEN,
|
||||
(struct sockaddr *)&addr, &from_len, (void *)&rcv_info,
|
||||
&infolen, &infotype, &flags);
|
||||
@@ -106,6 +109,7 @@ int tests1ap_enb_read(net_sock_t *sock, pkbuf_t *recvbuf)
|
||||
printf("Notification of length %llu received.\n",
|
||||
(unsigned long long)n);
|
||||
} else {
|
||||
c_uint32_t ppid = ntohl(rcv_info.rcv_ppid);
|
||||
if (infotype == SCTP_RECVV_RCVINFO) {
|
||||
printf("Msg of length %llu received from %s:%u"
|
||||
"on stream %u with SSN %u and TSN %u, PPID %u,"
|
||||
@@ -116,14 +120,43 @@ int tests1ap_enb_read(net_sock_t *sock, pkbuf_t *recvbuf)
|
||||
rcv_info.rcv_sid,
|
||||
rcv_info.rcv_ssn,
|
||||
rcv_info.rcv_tsn,
|
||||
ntohl(rcv_info.rcv_ppid),
|
||||
ppid,
|
||||
rcv_info.rcv_context,
|
||||
(flags & MSG_EOR) ? 1 : 0);
|
||||
} else {
|
||||
#if 0
|
||||
if (ppid == SCTP_S1AP_PPID)
|
||||
#endif
|
||||
{
|
||||
rc = n;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#else
|
||||
while(1)
|
||||
{
|
||||
rc = net_read(sock, recvbuf->payload, recvbuf->len, 0);
|
||||
if (rc == -2)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
else if (rc <= 0)
|
||||
{
|
||||
if (sock->sndrcv_errno == EAGAIN)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user