summaryrefslogtreecommitdiff
path: root/Kernel/Net/UDPSocket.cpp
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2019-07-03 21:17:35 +0200
committerAndreas Kling <awesomekling@gmail.com>2019-07-03 21:20:13 +0200
commit27f699ef0c8c2dce0f1dff19eef25f02e3da397e (patch)
tree52f95be1d05ba2a621d3bb8ac9129341f8d9973b /Kernel/Net/UDPSocket.cpp
parentc4c4bbc5ba5119e9ccc8ded948b26e7c4851a909 (diff)
downloadserenity-27f699ef0c8c2dce0f1dff19eef25f02e3da397e.zip
AK: Rename the common integer typedefs to make it obvious what they are.
These types can be picked up by including <AK/Types.h>: * u8, u16, u32, u64 (unsigned) * i8, i16, i32, i64 (signed)
Diffstat (limited to 'Kernel/Net/UDPSocket.cpp')
-rw-r--r--Kernel/Net/UDPSocket.cpp18
1 files changed, 9 insertions, 9 deletions
diff --git a/Kernel/Net/UDPSocket.cpp b/Kernel/Net/UDPSocket.cpp
index c36f09c4bf..9658346642 100644
--- a/Kernel/Net/UDPSocket.cpp
+++ b/Kernel/Net/UDPSocket.cpp
@@ -5,15 +5,15 @@
#include <Kernel/Net/UDPSocket.h>
#include <Kernel/Process.h>
-Lockable<HashMap<word, UDPSocket*>>& UDPSocket::sockets_by_port()
+Lockable<HashMap<u16, UDPSocket*>>& UDPSocket::sockets_by_port()
{
- static Lockable<HashMap<word, UDPSocket*>>* s_map;
+ static Lockable<HashMap<u16, UDPSocket*>>* s_map;
if (!s_map)
- s_map = new Lockable<HashMap<word, UDPSocket*>>;
+ s_map = new Lockable<HashMap<u16, UDPSocket*>>;
return *s_map;
}
-UDPSocketHandle UDPSocket::from_port(word port)
+UDPSocketHandle UDPSocket::from_port(u16 port)
{
RefPtr<UDPSocket> socket;
{
@@ -77,13 +77,13 @@ int UDPSocket::protocol_send(const void* data, int data_length)
int UDPSocket::protocol_allocate_local_port()
{
- static const word first_ephemeral_port = 32768;
- static const word last_ephemeral_port = 60999;
- static const word ephemeral_port_range_size = last_ephemeral_port - first_ephemeral_port;
- word first_scan_port = first_ephemeral_port + RandomDevice::random_value() % ephemeral_port_range_size;
+ static const u16 first_ephemeral_port = 32768;
+ static const u16 last_ephemeral_port = 60999;
+ static const u16 ephemeral_port_range_size = last_ephemeral_port - first_ephemeral_port;
+ u16 first_scan_port = first_ephemeral_port + RandomDevice::random_value() % ephemeral_port_range_size;
LOCKER(sockets_by_port().lock());
- for (word port = first_scan_port;;) {
+ for (u16 port = first_scan_port;;) {
auto it = sockets_by_port().resource().find(port);
if (it == sockets_by_port().resource().end()) {
set_local_port(port);