Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
U
UERANSIM
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
UERANSIM
Commits
ac447032
Commit
ac447032
authored
Dec 07, 2021
by
aligungr
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
IPv6 support
parent
6699b76d
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
12 deletions
+8
-12
src/lib/app/base_app.cpp
src/lib/app/base_app.cpp
+4
-0
src/utils/network.cpp
src/utils/network.cpp
+4
-12
No files found.
src/lib/app/base_app.cpp
View file @
ac447032
...
@@ -11,6 +11,8 @@
...
@@ -11,6 +11,8 @@
#include <atomic>
#include <atomic>
#include <csignal>
#include <csignal>
#include <cstdio>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <exception>
#include <exception>
#include <vector>
#include <vector>
...
@@ -37,6 +39,8 @@ void Initialize()
...
@@ -37,6 +39,8 @@ void Initialize()
if
(
g_instanceCount
++
!=
0
)
if
(
g_instanceCount
++
!=
0
)
std
::
terminate
();
std
::
terminate
();
srand
(
time
(
nullptr
));
std
::
signal
(
SIGTERM
,
BaseSignalHandler
);
std
::
signal
(
SIGTERM
,
BaseSignalHandler
);
std
::
signal
(
SIGINT
,
BaseSignalHandler
);
std
::
signal
(
SIGINT
,
BaseSignalHandler
);
}
}
...
...
src/utils/network.cpp
View file @
ac447032
...
@@ -273,20 +273,12 @@ Socket Socket::Select(const std::vector<Socket> &readSockets, const std::vector<
...
@@ -273,20 +273,12 @@ Socket Socket::Select(const std::vector<Socket> &readSockets, const std::vector<
std
::
vector
<
Socket
>
rs
,
ws
;
std
::
vector
<
Socket
>
rs
,
ws
;
Select
(
readSockets
,
writeSockets
,
rs
,
ws
,
timeout
);
Select
(
readSockets
,
writeSockets
,
rs
,
ws
,
timeout
);
// Return a socket choosen at random from selection
// Return a socket chosen at random from selection to avoid starvation
// to avoid starvation
auto
r
=
static_cast
<
size_t
>
(
rand
());
std
::
default_random_engine
generator
;
if
(
!
rs
.
empty
())
if
(
!
rs
.
empty
())
{
return
rs
[
r
%
rs
.
size
()];
std
::
uniform_int_distribution
<
int
>
drs
(
0
,
rs
.
size
()
-
1
);
return
rs
[
drs
(
generator
)];
}
if
(
!
ws
.
empty
())
if
(
!
ws
.
empty
())
{
return
ws
[
r
%
ws
.
size
()];
std
::
uniform_int_distribution
<
int
>
dws
(
0
,
ws
.
size
()
-
1
);
return
rs
[
dws
(
generator
)];
}
return
{};
return
{};
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment