MCPcopy Create free account
hub / github.com/LemonOSProject/LemonOS / AllocatePort

Function AllocatePort

Kernel/src/net/net.cpp:26–37  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

24 }
25
26 unsigned short AllocatePort(Socket& sock){
27 unsigned short port = EPHEMERAL_PORT_RANGE_START;
28
29 while(port <= EPHEMERAL_PORT_RANGE_END && AcquirePort(sock, port)) port++;
30
31 if(port > EPHEMERAL_PORT_RANGE_END){
32 Log::Warning("[Network] Could not allocate ephemeral port!");
33 return 0;
34 }
35
36 return port;
37 }
38
39 int AcquirePort(Socket& sock, unsigned int port){
40 if(port > PORT_MAX){

Callers 1

SendToMethod · 0.85

Calls 2

AcquirePortFunction · 0.85
WarningFunction · 0.85

Tested by

no test coverage detected