Beispiel #1
0
void Msg2Msg::OnShutdown()
{
    //we have to close this stuff;
    ListableSocket* sndSocketPtr = NULL;
    while(!sndSockets.IsEmpty())//close out the socket
    {
        sndSocketPtr = sndSockets.RemoveHead();
        if(sndSocketPtr->IsOpen()) sndSocketPtr->Close();
        delete sndSocketPtr;
    }
    
    ListableSocket* rcvSocketPtr = NULL;
    while(!rcvSockets.IsEmpty())//close out the socket
    {
        rcvSocketPtr = rcvSockets.RemoveHead();
        if(rcvSocketPtr->IsOpen()) rcvSocketPtr->Close();
        delete rcvSocketPtr;
    }
    
    ListablePipe* sndPipePtr = NULL;
    while(!sndPipes.IsEmpty())//close out the pipe
    {
        sndPipePtr = sndPipes.RemoveHead();
        if(sndPipePtr->IsOpen()) sndPipePtr->Close();
        delete sndPipePtr;
    }
    
    ListablePipe* rcvPipePtr = NULL;
    while(!rcvPipes.IsEmpty())//close out the pipe
    {
        rcvPipePtr = rcvPipes.RemoveHead();
        if(rcvPipePtr->IsOpen()) rcvPipePtr->Close();
        delete rcvPipePtr;
    }
    
    ListableFile* sndFilePtr = NULL;
    while(!sndFiles.IsEmpty())//close out the file
    {
        sndFilePtr = sndFiles.RemoveHead();
        if(sndFilePtr->IsOpen()) sndFilePtr->Close();
        delete sndFilePtr;
    }
    
    if(usingstdin)
    {
        //do nothing
    }
    if(usingstdout)
    {
        //do nothing
    }
    TRACE("msg2Msg: Done.\n");
}  // end Msg2Msg::OnShutdown()
static status_t
socket_std_ops(int32 op, ...)
{
	switch (op) {
		case B_MODULE_INIT:
		{
			new (&sSocketList) SocketList;
			mutex_init(&sSocketLock, "socket list");

#if ENABLE_DEBUGGER_COMMANDS
			add_debugger_command("sockets", dump_sockets, "lists all sockets");
			add_debugger_command("socket", dump_socket, "dumps a socket");
#endif
			return B_OK;
		}
		case B_MODULE_UNINIT:
			ASSERT(sSocketList.IsEmpty());
			mutex_destroy(&sSocketLock);

#if ENABLE_DEBUGGER_COMMANDS
			remove_debugger_command("socket", dump_socket);
			remove_debugger_command("sockets", dump_sockets);
#endif
			return B_OK;

		default:
			return B_ERROR;
	}
}