int CCircuitry::RecordWith(int nChan, BYTE* pBuffer, DWORD dwStopOffset) { if ( ! m_pChain || ! m_pChain->IsConnected() ) return -1; if ( m_pRecIoOver->Offset >= MAX_RECLST ) return -1; if ( ! HasOverlappedIoCompleted(m_pRecIoOver) ) return -1; CBuffer* pOutput = m_pChain->m_pOutput; if ( dwStopOffset ) pOutput->Add( pBuffer, dwStopOffset + 1 ); Neighbour.m_pWakeup.SetEvent(); if ( int nResult = SsmRecordMemBlock(nChan, 6, pBuffer, TEMP_BUFFER, OnRecMemBlockDone, m_pRecIoOver) ) { #ifdef _DEBUG CHAR sError[1024]; SsmGetLastErrMsg( sError ); theApp.Message( MSG_ERROR, sError ); #endif return nResult; } m_pRecIoOver->Offset++; ResetEvent( m_pRecIoOver->hEvent ); //TRACE("%i-> RecordWith in [%i]\n", GetTickCount(), m_pRecIoOver->Offset); return 0; }
void CLocalSearch::AddHitDC(CDCPacket* pPacket, CSchemaMap& /*pSchemas*/, CLibraryFile* pFile, int /*nIndex*/) { // Active user: // $SR Nick FileName<0x05>FileSize FreeSlots/TotalSlots<0x05>HubName (HubIP:HubPort)| // Passive user: // $SR Nick FileName<0x05>FileSize FreeSlots/TotalSlots<0x05>HubName (HubIP:HubPort)<0x05>User| if ( ! m_pSearch ) return; CUploadQueue* pQueue = UploadQueues.SelectQueue( PROTOCOL_DC, NULL, 0, CUploadQueue::ulqBoth, NULL ); int nTotalSlots = pQueue ? pQueue->m_nMaxTransfers : 0; int nActiveSlots = pQueue ? pQueue->GetActiveCount() : 0; int nFreeSlots = nTotalSlots > nActiveSlots ? ( nTotalSlots - nActiveSlots ) : 0; CString sHubName; if ( pFile->m_oTiger ) // It's TTH search sHubName = _T("TTH:") + pFile->m_oTiger.toString(); else sHubName = m_pSearch->m_sMyHub; CBuffer pAnswer; pAnswer.Add( _P("$SR ") ); pAnswer.Print( m_pSearch->m_sMyNick ); pAnswer.Add( _P(" ") ); pAnswer.Print( pFile->m_sName ); pAnswer.Add( _P("\x05") ); CString strSize; strSize.Format( _T("%I64u %d/%d"), pFile->m_nSize, nFreeSlots, nTotalSlots ); pAnswer.Print( strSize ); pAnswer.Add( _P("\x05") ); pAnswer.Print( sHubName ); pAnswer.Add( _P(" (") ); pAnswer.Print( HostToString( &m_pSearch->m_pMyHub ) ); pAnswer.Add( _P(")") ); if ( ! m_pSearch->m_bUDP ) { pAnswer.Add( _P("\x05") ); pAnswer.Print( m_pSearch->m_sUserNick ); } pAnswer.Add( _P("|") ); pPacket->Write( pAnswer.m_pBuffer, pAnswer.m_nLength ); }