bool CWindowsNetWriter::OnNewClient(tcp_socket_ptr s) { NETWRITER_EVENT("CWindowsNetWriter::OnNewClient " << make_tuple(s, m_ClientHandles.size())); LIVE_ASSERT( m_ClientHandles.find(s.get()) == m_ClientHandles.end() ); WindowsMediaClient ClientHandle( this, s ); // 将这个SOCKET挂接到 m_ClientHandles m_ClientHandles[s.get()] = ClientHandle; return true; }
TVerdict COomTestStep::ImplOomServerTestL() { RScsClientBase *client = ClientHandle(); if(!client) { ERR_PRINTF1(_L("ClientHandle has returned NULL. The server cannot be tested without the client handle!")); User::Leave(KErrArgument); } TInt err(0); for (TInt testCount=0; ; ++testCount) { INFO_PRINTF2(_L("OOM Server Test %d"), testCount); err = client->SetServerHeapFail(testCount+1); if(KErrNone != err) { ERR_PRINTF3(_L("OOM Server Test Result: Failed to set heap fail on iteration %d. Error:%d"), testCount, err); SetTestStepResult(EFail); break; } TRAPD(retStepVal, ImplTestStepL()); err = client->ResetServerHeapFail(); if(KErrNone != err) { ERR_PRINTF3(_L("ResetServerHeapFail failed on iteration %d with error %d"), testCount, err); SetTestStepResult(EFail); break; } if(KErrNoMemory == retStepVal) { INFO_PRINTF2(_L("Received correct out of memory error on iteration %d"), testCount); } else if (KErrNone == retStepVal) { INFO_PRINTF1(_L("Server OOM Test Finished")); break; } else { // Propagate all errors apart from KErrNoMemory User::Leave(retStepVal); } }// for return TestStepResult(); }
TUint32 CWsWindow::Handle() const { return ClientHandle(); }