void WinRenderFrontend::RenderFinished (POVMS_Message& msg, POVMS_Message&, int)
{
  FlushStreams () ;
  render_stopped () ;
  CloseStreams () ;
  CollectStats = false ;
  for (int i = 0 ; i < MAX_STREAMS ; i++)
    consoleoutput [i] = TRUE ;
}
Esempio n. 2
0
extern void StopWWAN(MyInfoRef infoRef)
{
	MyStreamInfoPtr myInfoPtr = (MyStreamInfoPtr)infoRef;
	
	printf("stopWWAN entered\n");
	assert(myInfoPtr != NULL);
	myInfoPtr->isConnected = FALSE;
	CleanupAfterWAAN(myInfoPtr);
	CloseStreams(myInfoPtr);
	free(myInfoPtr);
}
Esempio n. 3
0
wxArchiveFSCacheDataImpl::~wxArchiveFSCacheDataImpl()
{
    WX_CLEAR_HASH_MAP(wxArchiveFSEntryHash, m_hash);

    wxArchiveFSEntry *entry = m_begin;

    while (entry)
    {
        wxArchiveFSEntry *next = entry->next;
        delete entry;
        entry = next;
    }

    CloseStreams();
}
Esempio n. 4
0
wxArchiveFSEntry *wxArchiveFSCacheDataImpl::GetNext(wxArchiveFSEntry *fse)
{
    wxArchiveFSEntry *next = fse ? fse->next : m_begin;

    if (!next && m_archive)
    {
        wxArchiveEntry *entry = m_archive->GetNextEntry();

        if (entry)
            next = AddToCache(entry);
        else
            CloseStreams();
    }

    return next;
}
Esempio n. 5
0
wxArchiveEntry *wxArchiveFSCacheDataImpl::Get(const wxString& name)
{
    wxArchiveFSEntryHash::iterator it = m_hash.find(name);

    if (it != m_hash.end())
        return it->second;

    if (!m_archive)
        return NULL;

    wxArchiveEntry *entry;

    while ((entry = m_archive->GetNextEntry()) != NULL)
    {
        AddToCache(entry);

        if (entry->GetName(wxPATH_UNIX) == name)
            return entry;
    }

    CloseStreams();

    return NULL;
}
Esempio n. 6
0
extern MyInfoRef StartWWAN(ConnectClientCallBack clientCB, void *refCon)
{
	char						host[] = kTestHost;
	int							portNum = kTestPort;
	CFDataRef					addressData;
	MyStreamInfoPtr				myInfoPtr;
	CFStreamClientContext		ctxt = {0, NULL, NULL, NULL, NULL};
	Boolean						errorOccurred = FALSE;
	
	myInfoPtr = malloc(sizeof(MyStreamInfo));
	if (!myInfoPtr)
	{
		return NULL;
	}
	
	// init the allocated memory
	memset(myInfoPtr, 0, sizeof(MyStreamInfo));
	myInfoPtr->clientCB = clientCB;
	myInfoPtr->refCon = refCon;
	ctxt.info = myInfoPtr;
	
	// Check for a dotted-quad address, if so skip any host lookups
	in_addr_t addr = inet_addr(host);
	if (addr != INADDR_NONE) {
		// Create the streams from numberical host
		struct sockaddr_in sin;
		memset(&sin, 0, sizeof(sin));
		
		sin.sin_len= sizeof(sin);
		sin.sin_family = AF_INET;
		sin.sin_addr.s_addr = addr;
		sin.sin_port = htons(portNum);
		
		addressData = CFDataCreate(NULL, (UInt8 *)&sin, sizeof(sin));
		CFSocketSignature sig = { AF_INET, SOCK_STREAM, IPPROTO_TCP, addressData };
		
		// Create the streams.
		CFStreamCreatePairWithPeerSocketSignature(kCFAllocatorDefault, &sig, &(myInfoPtr->rStreamRef), &(myInfoPtr->wStreamRef));
		CFRelease(addressData);
	} else {
		// Create the streams from ascii host name
		CFStringRef hostStr = CFStringCreateWithCStringNoCopy(kCFAllocatorDefault, host, kCFStringEncodingUTF8, kCFAllocatorNull);
		CFStreamCreatePairWithSocketToHost(kCFAllocatorDefault, hostStr, portNum, &(myInfoPtr->rStreamRef), &(myInfoPtr->wStreamRef));
        //hostStr = NULL;
        if(hostStr)
        {
            CFRelease(hostStr);
        }
	}
	
	myInfoPtr->isConnected = FALSE;
	myInfoPtr->isStreamInitd = TRUE;
	myInfoPtr->isClientSet = FALSE;
	
	// Inform the streams to kill the socket when it is done with it.
	// This effects the write stream too since the pair shares the
	// one socket.
	CFWriteStreamSetProperty(myInfoPtr->wStreamRef, kCFStreamPropertyShouldCloseNativeSocket, kCFBooleanTrue);
	
	// set up the client
	if (!CFWriteStreamSetClient(myInfoPtr->wStreamRef, kCFStreamEventOpenCompleted | kCFStreamEventErrorOccurred | kCFStreamEventEndEncountered,
								MyCFWriteStreamClientCallBack, &ctxt))
	{
		printf("CFWriteStreamSetClient failed\n");
		errorOccurred = TRUE;
	}
	else
		myInfoPtr->isClientSet = TRUE;
	
	if (!errorOccurred)
	{
		// schedule the stream
		CFWriteStreamScheduleWithRunLoop(myInfoPtr->wStreamRef, CFRunLoopGetCurrent(), kCFRunLoopCommonModes);
		
		// Try to open the stream.
		if (!CFWriteStreamOpen(myInfoPtr->wStreamRef))
		{
			printf("CFWriteStreamOpen failed\n");
			errorOccurred = TRUE;
		}
	}
	
	if (!errorOccurred)
	{
		// everything worked so far, so run the runloop - when the callback gets called, it will stop the run loop
		printf("CFWriteStreamOpen returned with no error - calling CFRunLoopRun\n");
		CFRunLoopRun();
		if (myInfoPtr->errorOccurred)
			errorOccurred = TRUE;
		printf("after CFRunLoopRun - returning\n");
	}
	
	if (errorOccurred)
	{
		myInfoPtr->isConnected = FALSE;
		CleanupAfterWAAN(myInfoPtr);
		CloseStreams(myInfoPtr);
		
		if (myInfoPtr->isStreamInitd)
		{
            if(myInfoPtr->rStreamRef)
                CFRelease(myInfoPtr->rStreamRef);
            if(myInfoPtr->wStreamRef)
                CFRelease(myInfoPtr->wStreamRef);
			myInfoPtr->isStreamInitd = FALSE;
		}
		free(myInfoPtr);
		return NULL;
	}
    
	return (MyInfoRef)myInfoPtr;
}
WinRenderFrontend::~WinRenderFrontend()
{
  rendering = false ;
  CloseStreams () ;
  CollectStats = false ;
}
Esempio n. 8
0
DefaultRenderFrontend::~DefaultRenderFrontend()
{
	CloseStreams();
}