Пример #1
0
void CEMSocket::OnClose(int nErrorCode)
{
	m_eConnectionState = ES_DISCONNECTED;
	CEncryptedStreamSocket::OnClose(nErrorCode);
	RemoveAllLayers();
	ClearQueues();
}
Пример #2
0
CEMSocket::~CEMSocket()
{
	EMTrace("CEMSocket::~CEMSocket() on %d",(SOCKET)this);
	ClearQueues();
	RemoveAllLayers();
	AsyncSelect(0);
}
Пример #3
0
status_t MSNConnection::HandleXFR( Command * command ) {
	LOG(kProtocolName, liDebug, "C %lX: Processing XFR", this);
	command->Debug();
	
	ServerAddress sa = ExtractServerDetails((char *)command->Param(1));
	
	BMessage newCon(msnmsgNewConnection);
	newCon.AddString("host", sa.first);
	newCon.AddInt16("port", sa.second);
	newCon.AddString("type", command->Param(0));
	newCon.AddInt32("trid", command->TransactionID());
	
	if (strcmp(command->Param(0), "NS") == 0) {
		StopReceiver();
			
		ClearQueues();
			
		BMessage closeCon(msnmsgCloseConnection);
		closeCon.AddPointer("connection", this);
			
		fManMsgr.SendMessage(&closeCon);
	};
		
	if (strcmp(command->Param(0), "SB") == 0) {
		newCon.AddString("authType", command->Param(2));
		newCon.AddString("authString", command->Param(3));
	};			

	fManMsgr.SendMessage(&newCon);

	return B_OK;
}
Пример #4
0
// Read the data files
void
InputEvents::readFile()
{
  LogStartUp(_T("Loading input events file"));

  // clear the GCE and NMEA queues
  ClearQueues();

  LoadDefaults(input_config);

  // Read in user defined configuration file
  std::unique_ptr<TLineReader> reader(OpenConfiguredTextFile(szProfileInputFile));
  if (reader)
    ::ParseInputFile(input_config, *reader);
}
Пример #5
0
void CEMSocket::OnClose(int nErrorCode){
    // need to be locked here to know that the other methods
    // won't be in the middle of things
    sendLocker.Lock();
	byConnected = ES_DISCONNECTED;
    sendLocker.Unlock();

    // now that we know no other method will keep adding to the queue
    // we can remove ourself from the queue
    theApp.uploadBandwidthThrottler->RemoveFromAllQueues(this);

	CEncryptedStreamSocket::OnClose(nErrorCode); // deadlake changed socket to PROXYSUPPORT ( AsyncSocketEx )
	RemoveAllLayers(); // deadlake PROXYSUPPORT
	ClearQueues();
}
Пример #6
0
void CEMSocket::OnClose(int WXUNUSED(nErrorCode))
{
    // need to be locked here to know that the other methods
    // won't be in the middle of things
    {
    	wxMutexLocker lock(m_sendLocker);
		byConnected = ES_DISCONNECTED;
	}

    // now that we know no other method will keep adding to the queue
    // we can remove ourself from the queue
    theApp->uploadBandwidthThrottler->RemoveFromAllQueues(this);
	
	ClearQueues();
}
Пример #7
0
CEMSocket::~CEMSocket(){
	EMTrace("CEMSocket::~CEMSocket() on %d",(SOCKET)this);

    // need to be locked here to know that the other methods
    // won't be in the middle of things
    sendLocker.Lock();
	byConnected = ES_DISCONNECTED;
    sendLocker.Unlock();

    // now that we know no other method will keep adding to the queue
    // we can remove ourself from the queue
    theApp.uploadBandwidthThrottler->RemoveFromAllQueues(this);

    ClearQueues();
	RemoveAllLayers(); // deadlake PROXYSUPPORT
	AsyncSelect(0);
}
Пример #8
0
CEMSocket::~CEMSocket()
{
    // need to be locked here to know that the other methods
    // won't be in the middle of things
    {
    	wxMutexLocker lock(m_sendLocker);
		byConnected = ES_DISCONNECTED;
	}

    // now that we know no other method will keep adding to the queue
    // we can remove ourself from the queue
	if (theApp->uploadBandwidthThrottler) {
	    theApp->uploadBandwidthThrottler->RemoveFromAllQueues(this);
	}

    ClearQueues();
	
	SetNotify(0);
	Notify(FALSE);
}
Пример #9
0
NTSTATUS OnCloseRequest(
	IN PDEVICE_OBJECT	DeviceObject,
	IN PIRP			Irp
)
{
	PIO_STACK_LOCATION	currentIrpStack	= IoGetCurrentIrpStackLocation(Irp);
	PIO_STACK_LOCATION	nextIrpStack	= IoGetNextIrpStackLocation(Irp);

	Irp->IoStatus.Status      = STATUS_SUCCESS;
	Irp->IoStatus.Information = 0;

	if(DeviceObject == HookMouseDeviceObject)
	{
		*nextIrpStack = *currentIrpStack;
		return IoCallDriver(LowerMouseDeviceObject, Irp);
	} 
	if(DeviceObject == HookKbrdDeviceObject)
	{
		*nextIrpStack = *currentIrpStack;
		return IoCallDriver(LowerKbrdDeviceObject, Irp);
	} 

	if(FALSE == DriverOpened)
	{
		Irp->IoStatus.Status = STATUS_INVALID_DEVICE_REQUEST;
		DbgPrint("Driver already closed.\n");
	}
	else
	{
		DriverOpened = FALSE;
		InputDisabled = FALSE;
		KeSetEvent(&MouseEvent, IO_NO_INCREMENT, FALSE);
		KeSetEvent(&KbrdEvent, IO_NO_INCREMENT, FALSE);
		ClearQueues();
		DbgPrint("Driver is closed.\n");
	}

	IoCompleteRequest(Irp, IO_NO_INCREMENT);
	return STATUS_SUCCESS;
}
Пример #10
0
DWORD CDecodeThread::ThreadProc()
{
  HRESULT hr;
  DWORD cmd;

  BOOL bEOS = FALSE;
  BOOL bReinit = FALSE;

  SetThreadName(-1, "LAVVideo Decode Thread");

  HANDLE hWaitEvents[2] = { GetRequestHandle(), m_evInput };
  while(1) {
    if (!bEOS && !bReinit) {
      // Wait for either an input sample, or an request
      WaitForMultipleObjects(2, hWaitEvents, FALSE, INFINITE);
    }

    if (CheckRequest(&cmd)) {
      switch (cmd) {
      case CMD_CREATE_DECODER:
        {
          CAutoLock lock(&m_ThreadCritSec);
          hr = CreateDecoderInternal(m_ThreadCallContext.pmt, m_ThreadCallContext.codec);
          Reply(hr);

          m_ThreadCallContext.pmt = nullptr;
        }
        break;
      case CMD_CLOSE_DECODER:
        {
          ClearQueues();
          SAFE_DELETE(m_pDecoder);
          Reply(S_OK);
        }
        break;
      case CMD_FLUSH:
        {
          ClearQueues();
          m_pDecoder->Flush();
          Reply(S_OK);
        }
        break;
      case CMD_EOS:
        {
          bEOS = TRUE;
          m_evEOSDone.Reset();
          Reply(S_OK);
        }
        break;
      case CMD_EXIT:
        {
          Reply(S_OK);
          return 0;
        }
        break;
      case CMD_INIT_ALLOCATOR:
        {
          CAutoLock lock(&m_ThreadCritSec);
          hr = m_pDecoder->InitAllocator(m_ThreadCallContext.allocator);
          Reply(hr);

          m_ThreadCallContext.allocator = nullptr;
        }
        break;
      case CMD_POST_CONNECT:
        {
          CAutoLock lock(&m_ThreadCritSec);
          hr = PostConnectInternal(m_ThreadCallContext.pin);
          Reply(hr);

          m_ThreadCallContext.pin = nullptr;
        }
        break;
      case CMD_REINIT:
        {
          CMediaType &mt = m_pLAVVideo->GetInputMediaType();
          CreateDecoderInternal(&mt, m_Codec);
          m_TempSample[1] = m_NextSample;
          m_NextSample = m_FailedSample;
          m_FailedSample = nullptr;
          bReinit = TRUE;
          m_evEOSDone.Reset();
          Reply(S_OK);
          m_bDecoderNeedsReInit = FALSE;
        }
        break;
      default:
        ASSERT(0);
      }
    }

    if (m_bDecoderNeedsReInit) {
      m_evInput.Reset();
      continue;
    }

    if (bReinit && !m_NextSample) {
      if (m_TempSample[0]) {
        m_NextSample = m_TempSample[0];
        m_TempSample[0] = nullptr;
      } else if (m_TempSample[1]) {
        m_NextSample = m_TempSample[1];
        m_TempSample[1] = nullptr;
      } else {
        bReinit = FALSE;
        m_evEOSDone.Set();
        m_evSample.Set();
        continue;
      }
    }

    IMediaSample *pSample = GetSample();
    if (!pSample) {
      // Process the EOS now that the sample queue is empty
      if (bEOS) {
        bEOS = FALSE;
        m_pDecoder->EndOfStream();
        m_evEOSDone.Set();
        m_evSample.Set();
      }
      continue;
    }

    DecodeInternal(pSample);

    // Release the sample
    SafeRelease(&pSample);

    // Indicates we're done decoding this sample
    m_evDecodeDone.Set();

    // Set the Sample Event to unblock any waiting threads
    m_evSample.Set();
  }

  return 0;
}