Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
openairinterface5G
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Worker.N
openairinterface5G
Commits
d454a956
Commit
d454a956
authored
6 years ago
by
Robert Schmidt
Browse files
Options
Downloads
Patches
Plain Diff
Reduce warnings in ASYNC_IF
parent
b27cd4dd
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
openair2/UTIL/ASYNC_IF/socket_link.c
+18
-20
18 additions, 20 deletions
openair2/UTIL/ASYNC_IF/socket_link.c
with
18 additions
and
20 deletions
openair2/UTIL/ASYNC_IF/socket_link.c
+
18
−
20
View file @
d454a956
...
...
@@ -167,9 +167,8 @@ socket_link_t *new_link_udp_server(int port){
socket_link_t
*
ret
=
NULL
;
struct
sockaddr_in
si_me
,
si_other
;
int
socket_server
,
i
,
slen
=
sizeof
(
si_other
)
,
recv_bytes
;
char
buf
[
1500
];
struct
sockaddr_in
si_me
;
int
socket_server
=
-
1
;
ret
=
calloc
(
1
,
sizeof
(
socket_link_t
));
if
(
ret
==
NULL
)
{
...
...
@@ -201,7 +200,7 @@ socket_link_t *new_link_udp_server(int port){
return
ret
;
error:
close
(
socket_server
);
if
(
socket_server
!=
-
1
)
close
(
socket_server
);
if
(
ret
!=
NULL
)
close
(
ret
->
socket_fd
);
free
(
ret
);
//printf("\n\n\nERROR PROTO_AGENT: ERROR in new_link_udp_server (see above), returning NULL\n");
...
...
@@ -219,10 +218,9 @@ socket_link_t *new_link_udp_client(char *server, int port){
}
ret
->
socket_fd
=
-
1
;
struct
sockaddr_in
si_other
,
server_info
;
int
s
,
i
,
slen
=
sizeof
(
si_other
);
char
buf
[
1500
];
char
message
[
1500
];
struct
sockaddr_in
si_other
;
int
s
;
socklen_t
slen
;
if
(
(
s
=
socket
(
AF_INET
,
SOCK_DGRAM
,
IPPROTO_UDP
))
==
-
1
){
goto
error
;
...
...
@@ -258,14 +256,8 @@ socket_link_t *new_link_sctp_server(int port)
{
socket_link_t
*
ret
=
NULL
;
ret
=
calloc
(
1
,
sizeof
(
socket_link_t
));
if
(
ret
==
NULL
)
{
LOG_D
(
PROTO_AGENT
,
"%s:%d: out of memory
\n
"
,
__FILE__
,
__LINE__
);
goto
error
;
}
ret
->
socket_fd
=
-
1
;
int
listenSock
,
temp
;
int
listenSock
=
-
1
,
temp
;
struct
sockaddr_in
servaddr
;
listenSock
=
socket
(
AF_INET
,
SOCK_STREAM
,
IPPROTO_SCTP
);
...
...
@@ -296,13 +288,19 @@ socket_link_t *new_link_sctp_server(int port)
close
(
listenSock
);
exit
(
1
);
}
ret
=
calloc
(
1
,
sizeof
(
socket_link_t
));
if
(
ret
==
NULL
)
{
LOG_D
(
PROTO_AGENT
,
"%s:%d: out of memory
\n
"
,
__FILE__
,
__LINE__
);
goto
error
;
}
ret
->
socket_fd
=
-
1
;
ret
->
socket_fd
=
accept
(
listenSock
,
(
struct
sockaddr
*
)
NULL
,
(
int
*
)
NULL
);
ret
->
socket_fd
=
accept
(
listenSock
,
NULL
,
NULL
);
return
ret
;
error:
close
(
listenSock
);
if
(
listenSock
!=
-
1
)
close
(
listenSock
);
if
(
ret
!=
NULL
)
close
(
ret
->
socket_fd
);
free
(
ret
);
LOG_E
(
MAC
,
"ERROR in new_link_sctp_server (see above), returning NULL
\n
"
);
...
...
@@ -399,13 +397,13 @@ static int socket_udp_receive(int socket_fd, void *buf, int size)
LOG_D
(
PROTO_AGENT
,
"UDP RECEIVE
\n
"
);
struct
sockaddr_in
client
;
int
slen
=
sizeof
(
client
)
;
socklen_t
slen
;
char
*
s
=
buf
;
int
l
;
while
(
size
)
{
l
=
recvfrom
(
socket_fd
,
s
,
size
,
0
,
(
struct
sockaddr
*
)
&
client
,
&
slen
);
getsockname
(
s
,
(
struct
sockaddr
*
)
&
client
,
&
slen
);
getsockname
(
s
ocket_fd
,
(
struct
sockaddr
*
)
&
client
,
&
slen
);
LOG_D
(
PROTO_AGENT
,
"Got message from src port: %u
\n
"
,
ntohs
(
client
.
sin_port
));
if
(
l
==
-
1
)
goto
error
;
if
(
l
==
0
)
goto
socket_closed
;
...
...
@@ -511,7 +509,7 @@ int link_send_packet(socket_link_t *link, void *data, int size, uint16_t proto_t
if
(
socket_udp_send
(
link
->
socket_fd
,
sizebuf
,
4
,
peer_addr
,
link
->
peer_port
)
==
-
1
)
goto
error
;
LOG_I
(
PROTO_AGENT
,
"sent
%d
bytes over the channel
\n
"
,
(
int32_t
*
)
sizebuf
);
LOG_I
(
PROTO_AGENT
,
"sent
4
bytes over the channel
\n
"
);
link
->
bytes_sent
+=
4
;
if
(
socket_udp_send
(
link
->
socket_fd
,
data
,
size
,
peer_addr
,
link
->
peer_port
)
==
-
1
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment