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

Function AcquirePort

Kernel/src/net/net.cpp:39–53  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

37 }
38
39 int AcquirePort(Socket& sock, unsigned int port){
40 if(port > PORT_MAX){
41 Log::Warning("[Network] AcquirePort: Invalid port: %d", port);
42 return -1;
43 }
44
45 if(ports[port]){
46 Log::Warning("[Network] AcquirePort: Port %d in use!", port);
47 return -2;
48 }
49
50 ports[port] = &sock;
51
52 return 0;
53 }
54
55 void ReleasePort(unsigned short port){
56 assert(port <= PORT_MAX);

Callers 1

AllocatePortFunction · 0.85

Calls 1

WarningFunction · 0.85

Tested by

no test coverage detected