added buffer, datalink and socket module references to the stack module so we don't have to load them in each other module.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20673 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Hugo Santos
2007-04-13 03:06:36 +00:00
parent bfb45f717c
commit d438fa4c12
8 changed files with 67 additions and 117 deletions
+9 -14
View File
@@ -31,17 +31,16 @@ public:
extern net_stack_module_info *gStackModule;
extern net_buffer_module_info *gBufferModule;
class NetModuleBundle {
class NetModuleBundleGetter {
public:
static net_stack_module_info *Stack() { return gStackModule; }
static net_buffer_module_info *Buffer() { return gBufferModule; }
static net_buffer_module_info *Buffer() { return gStackModule->buffer_module; }
};
template<typename LockingBase = BenaphoreLocking,
typename ModuleBundle = NetModuleBundle>
typename ModuleBundle = NetModuleBundleGetter>
class DatagramSocket {
public:
DatagramSocket(const char *name, net_socket *socket);
@@ -78,7 +77,6 @@ protected:
typedef DoublyLinkedListCLink<net_buffer> NetBufferLink;
typedef DoublyLinkedList<net_buffer, NetBufferLink> BufferList;
status_t fStatus;
net_socket *fSocket;
sem_id fNotify;
BufferList fBuffers;
@@ -96,8 +94,10 @@ DECL_DATAGRAM_SOCKET(inline)::DatagramSocket(const char *name,
net_socket *socket)
: fSocket(socket), fCurrentBytes(0)
{
fStatus = LockingBase::Init(&fLock, name);
if (fStatus >= B_OK)
status_t status = LockingBase::Init(&fLock, name);
if (status < B_OK)
fNotify = status;
else
fNotify = create_sem(0, name);
}
@@ -105,18 +105,13 @@ DECL_DATAGRAM_SOCKET(inline)::DatagramSocket(const char *name,
DECL_DATAGRAM_SOCKET(inline)::~DatagramSocket()
{
_Clear();
if (fStatus >= B_OK) {
delete_sem(fNotify);
LockingBase::Destroy(&fLock);
}
delete_sem(fNotify);
LockingBase::Destroy(&fLock);
}
DECL_DATAGRAM_SOCKET(inline status_t)::InitCheck() const
{
if (fStatus < 0)
return fStatus;
return fNotify;
}
+4
View File
@@ -55,6 +55,10 @@ struct net_device_monitor {
struct net_stack_module_info {
module_info info;
struct net_buffer_module_info *buffer_module;
struct net_datalink_module_info *datalink_module;
struct net_socket_module_info *socket_module;
status_t (*register_domain)(int family, const char *name,
struct net_protocol_module_info *module,
struct net_address_module_info *addressModule,