mirror of
https://github.com/Zeal-Operating-System/ZealOS.git
synced 2024-12-26 23:36:32 +00:00
Remove redundant code in UDPSocketClose()
This commit is contained in:
parent
4653f274e2
commit
a8fb259f3a
3 changed files with 52 additions and 12 deletions
Binary file not shown.
47
src/Home/Net/Test9.CC
Normal file
47
src/Home/Net/Test9.CC
Normal file
|
@ -0,0 +1,47 @@
|
|||
"\n$$TX+UL,\"Making new socket\"$$\n";
|
||||
|
||||
CUDPSocket *s = UDPSocket(AF_INET);
|
||||
CSocketAddressIPV4 *addr = CAlloc(sizeof(CSocketAddressIPV4));
|
||||
|
||||
ClassRep(s,, 9);
|
||||
ClassRep(addr,, 9);
|
||||
|
||||
"\n$$TX+UL,\"Setting addr family to AF_INET and port to 0xDEAF in B.E., then P to N with 102.33.6.1\"$$\n";
|
||||
|
||||
addr->family = AF_INET;
|
||||
addr->port = EndianU16(0xDEAF);
|
||||
PresentationToNetwork(AF_INET,"102.33.6.1",&addr->address);
|
||||
|
||||
ClassRep(addr,, 9);
|
||||
|
||||
"\n$$TX+UL,\"UDPSocket bind with socket to addr\"$$\n";
|
||||
|
||||
UDPSocketBind(s, addr);
|
||||
|
||||
ClassRep(s,, 9);
|
||||
|
||||
"\n$$TX+UL,\"Global Tree:\"$$\n";
|
||||
|
||||
ClassRep(udp_globals.bound_socket_tree,, 9);
|
||||
|
||||
"\n$$TX+UL,\"Global Tree: Port 0xDEAF Queue\"$$\n";
|
||||
|
||||
ClassRep(udp_globals.bound_socket_tree->queue,, 9);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
"\n$$TX+UL,\"Closing first socket\"$$\n";
|
||||
|
||||
UDPSocketClose(s);
|
||||
|
||||
"\n$$TX+UL,\"Global Tree:\"$$\n";
|
||||
|
||||
ClassRep(udp_globals.bound_socket_tree,, 9);
|
||||
|
||||
"\n$$TX+UL,\"Global Tree: Port 0xDEAF Queue\"$$\n";
|
||||
|
||||
ClassRep(udp_globals.bound_socket_tree->queue,, 9);
|
||||
ClassRep(udp_globals.bound_socket_tree->queue->socket,, 9);
|
|
@ -509,19 +509,12 @@ I64 UDPSocketClose(CUDPSocket *udp_socket)
|
|||
|
||||
if (queue)
|
||||
{
|
||||
if (queue == queue->next == queue->last)
|
||||
{ // queue is alone. Means port only has this address bound.
|
||||
Debug("queue==next==last. implemented(?) this in SocketSinglePop, test it");
|
||||
}
|
||||
else
|
||||
{ // queue has other addresses bound at this port. only Free the queue entry, after removing it.
|
||||
UDPTreeNodeQueueSocketSinglePop(udp_socket, node);
|
||||
UDPTreeNodeQueueSocketSinglePop(udp_socket, node);
|
||||
|
||||
Free(udp_socket->socket);
|
||||
Free(udp_socket->receive_buffer);
|
||||
Free(udp_socket);
|
||||
Free(queue);
|
||||
}
|
||||
Free(udp_socket->socket);
|
||||
Free(udp_socket->receive_buffer);
|
||||
Free(udp_socket);
|
||||
Free(queue);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue