Add net_stack_cleanup()
Add a cleanup function net_stack_cleanup() that calls a new NetStack::ShutDown() method. Make sure this method works even if the network stack was never initialized. Signed-off-by: Augustin Cavalier <[email protected]>
This commit is contained in:
committed by
Augustin Cavalier
parent
9037351c6c
commit
74077e46e1
@@ -26,6 +26,7 @@ private:
|
|||||||
public:
|
public:
|
||||||
static status_t CreateDefault();
|
static status_t CreateDefault();
|
||||||
static NetStack *Default();
|
static NetStack *Default();
|
||||||
|
static status_t ShutDown();
|
||||||
|
|
||||||
status_t AddEthernetInterface(EthernetInterface *interface);
|
status_t AddEthernetInterface(EthernetInterface *interface);
|
||||||
|
|
||||||
@@ -53,6 +54,7 @@ private:
|
|||||||
// afterwards, which is supposed to add network interfaces.
|
// afterwards, which is supposed to add network interfaces.
|
||||||
status_t net_stack_init();
|
status_t net_stack_init();
|
||||||
status_t platform_net_stack_init();
|
status_t platform_net_stack_init();
|
||||||
|
status_t net_stack_cleanup();
|
||||||
|
|
||||||
|
|
||||||
#endif // _BOOT_NET_STACK_H
|
#endif // _BOOT_NET_STACK_H
|
||||||
|
|||||||
@@ -120,6 +120,19 @@ NetStack::Default()
|
|||||||
return sNetStack;
|
return sNetStack;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
status_t
|
||||||
|
NetStack::ShutDown()
|
||||||
|
{
|
||||||
|
if (sNetStack != NULL) {
|
||||||
|
delete sNetStack;
|
||||||
|
sNetStack = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
return B_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// AddEthernetInterface
|
// AddEthernetInterface
|
||||||
status_t
|
status_t
|
||||||
NetStack::AddEthernetInterface(EthernetInterface *interface)
|
NetStack::AddEthernetInterface(EthernetInterface *interface)
|
||||||
@@ -155,3 +168,9 @@ net_stack_init()
|
|||||||
return platform_net_stack_init();
|
return platform_net_stack_init();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
status_t
|
||||||
|
net_stack_cleanup()
|
||||||
|
{
|
||||||
|
return NetStack::ShutDown();
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user