Ejemplo n.º 1
0
void EZB::ConnectionCheck(){

	while(!m_exit){
		if(m_lastcommand_time + (KEEP_ALIVE_INTERVAL/1000) <= time(NULL) && !KeepAlive()){
			m_connected = false;
			break;
		}
		usleep(KEEP_ALIVE_INTERVAL * 1000);
	}
}
Ejemplo n.º 2
0
void
DOMStorageCache::LoadDone(nsresult aRv)
{
  // Keep the preloaded cache alive for a time
  KeepAlive();

  MonitorAutoLock monitor(mMonitor);
  mLoadResult = aRv;
  mLoaded = true;
  monitor.Notify();
}
Ejemplo n.º 3
0
bool XMsgClient::RefreshTime()
{
    uint32 now = rtc::Time();
    if (m_lastUpdateTime <= now) {
        m_lastUpdateTime = now  + TIMEOUT_TS;
        KeepAlive();
        return true;
    } else {
        return false;
    }
}
Ejemplo n.º 4
0
bool NFNetModule::Execute()
{
    if (!m_pNet)
    {
        return false;
    }


    KeepAlive();

    return m_pNet->Execute();
}
Ejemplo n.º 5
0
CVariant CKadScript::Execute(const map<CVariant, CKadOperator::SKadRequest>& Requests, const CUInt128& TargetID, CReportLogger* pLogger)
{
	KeepAlive();

	m_pLogger = CPointer<CReportLogger>(pLogger, true); // this is a week pointer and it gets cleared when the caller exits

	CVariant Results(CVariant::EList);
	for(map<CVariant, CKadOperator::SKadRequest>::const_iterator I = Requests.begin(); I != Requests.end(); I++)
	{
		CKadRequest* pRequest = I->second.pRequest;
		Results.Append(Call(pRequest->GetName(), pRequest->GetArguments(), TargetID, pRequest->GetXID()));
	}
	return Results;
}
Ejemplo n.º 6
0
CVariant CKadScript::Execute(const CVariant& Requests, const CUInt128& TargetID, CReportLogger* pLogger)
{
	KeepAlive();

	m_pLogger = CPointer<CReportLogger>(pLogger, true); // this is a week pointer and it gets cleared when the caller exits

	CVariant Results(CVariant::EList);
	for(uint32 i=0; i < Requests.Count(); i++)
	{
		const CVariant& Request = Requests.At(i);
		Results.Append(Call(Request["FX"], Request["ARG"], TargetID, Request["XID"]));
	}
	return Results;
}
Ejemplo n.º 7
0
int32 FPerforceConnection::CreatePendingChangelist(const FText &Description, FOnIsCancelled InIsCancelled, TArray<FText>& OutErrorMessages)
{
#if USE_P4_API
	TArray<FString> Params;
	FP4RecordSet Records;

	const char *ArgV[] = { "-i" };
	P4Client.SetArgv(1, const_cast<char*const*>(ArgV));

	FP4KeepAlive KeepAlive(InIsCancelled);
	P4Client.SetBreak(&KeepAlive);

	FP4CreateChangelistClientUser User(Records, bIsUnicode, OutErrorMessages, Description, P4Client);
	P4Client.Run("change", &User);

	P4Client.SetBreak(NULL);

	return User.ChangelistNumber;
#else
	return 0;
#endif
}
Ejemplo n.º 8
0
void CClientProxy::RouteMessage()
{
	try{
		double tmLastTick = GetMilliTime();
		while( true ){
			TIMEVAL tmout;
			tmout.tv_sec = TMMS_KEEPALIVE/1000;
			tmout.tv_usec = 0;

			fd_set rfds;
			FD_ZERO( &rfds );
			FD_SET( m_sock, &rfds );
			int nRet = Select( m_sock+1, &rfds, NULL, NULL, &tmout );

			double tmNow = GetMilliTime();
			if( nRet==0 || tmNow-tmLastTick>TMMS_KEEPALIVE ){	//time out, send the keep alive message
				KeepAlive();
				tmLastTick = tmNow;
			}
			if( nRet!=0 && FD_ISSET(m_sock, &rfds) ){
				CMessageBase* pMsg = RecvMessage<CMessageBase>( m_sock );
				if( pMsg==NULL )break;	//sock shutdown.
				CClientSession* pSession = GetSession( pMsg->GetDstAddr() );
				if( pSession ){
					pSession->PostMessage( pMsg );
				}else{
					CMessageTrash trash(pMsg);
				}
			}
		}
	}catch( CSockException* e ){
		cout<<"Client Proxy Sock:"<<e->what()<<endl;
		e->Delete();
	}

	ShutdownSessions();
	closesocket( m_sock );
}
Ejemplo n.º 9
0
int
main(int argc, char **argv)
{
    char **av = argv;
    struct sockaddr_in host;
    afs_int32 code;
    struct hostent *hp;
    char hnamebuf[200];
    struct timeval tv;
    int noAuth = 1;		/* Default is authenticated connections */

    argc--, av++;
    if (argc < 1) {
	printf("usage: pxclient <serverHost>\n");
	exit(1);
    }
    memset(&host, 0, sizeof(struct sockaddr_in));
    host.sin_family = AF_INET;
    host.sin_addr.s_addr = inet_addr(av[0]);
#ifdef STRUCT_SOCKADDR_HAS_SA_LEN
    host.sin_len = sizeof(struct sockaddr_in);
#endif
    if (host.sin_addr.s_addr != -1) {
	strcpy(hnamebuf, av[0]);
    } else {
	hp = gethostbyname(av[0]);
	if (hp) {
	    host.sin_family = hp->h_addrtype;
	    memcpy((caddr_t) & host.sin_addr, hp->h_addr, hp->h_length);
	} else {
	    printf("unknown server host %s\n", av[0]);
	    exit(1);
	}
    }
    if ((code = pxclient_Initialize(noAuth, host.sin_addr.s_addr)) != 0) {
	printf("Couldn't initialize fs library (code=%d).\n", code);
	exit(1);
    }

    code = ubik_Call(RXAFS_GetTime, cstruct, 0, &tv.tv_sec, &tv.tv_usec);
    if (!code)
	printf("AFS_GetTime on %s sec=%ld, usec=%ld\n", av[0], tv.tv_sec,
	       (long int)tv.tv_usec);
    else
	printf("return code is %d\n", code);

#ifdef notdef
    while (1) {
	char line[500];
	int nargs;

	printf("fs> ");
	if (fgets(line, 499, stdin) != NULL) {
	    char *oper;
	    char **argp = args;
	    GetArgs(line, argp, &nargs);
	    oper = &argp[0][0];
	    ++argp, --nargs;
	    if (!strcmp(oper, "probe")) {
		code =
		    ubik_Call(RXAFS_GetTime, cstruct, 0, &tv.tv_sec,
			      &tv.tv_usec);
		printf("return code is %d\n", code);
		if (!code)
		    printf("sec=%d\n", tv.tv_sec);
	    } else if (!strcmp(oper, "fsstats")) {
		struct afsStatistics stats;

		code = ubik_AFS_GetStatistics(cstruct, 0, &stats);
		printf("return code is %d\n", code);
	    } else if (!strcmp(oper, "fd")) {
		code = FetchData(argp);
		printf("return code is %d\n", code);
	    } else if (!strcmp(oper, "fs")) {
		code = FetchStatus(argp);
		printf("return code is %d\n", code);
	    } else if (!strcmp(oper, "fa")) {
		code = FetchACL(argp);
		printf("return code is %d\n", code);
	    } else if (!strcmp(oper, "sd")) {
		code = StoreData(argp);
		printf("return code is %d\n", code);
	    } else if (!strcmp(oper, "ss")) {
		code = StoreStatus(argp);
		printf("return code is %d\n", code);
	    } else if (!strcmp(oper, "sa")) {
		code = StoreACL(argp);
		printf("return code is %d\n", code);
	    } else if (!strcmp(oper, "cf")) {
		code = CreateFile(argp);
		printf("return code is %d\n", code);
	    } else if (!strcmp(oper, "rf")) {
		code = RemoveFile(argp);
		printf("return code is %d\n", code);
	    } else if (!strcmp(oper, "rn")) {
		code = Rename(argp);
		printf("return code is %d\n", code);
	    } else if (!strcmp(oper, "sl")) {
		code = Symlink(argp);
		printf("return code is %d\n", code);
	    } else if (!strcmp(oper, "hl")) {
		code = HardLink(argp);
		printf("return code is %d\n", code);
	    } else if (!strcmp(oper, "md")) {
		code = MakeDir(argp);
		printf("return code is %d\n", code);
	    } else if (!strcmp(oper, "rd")) {
		code = RemoveDir(argp);
		printf("return code is %d\n", code);
	    } else if (!strcmp(oper, "rdd")) {
		code = Readdir(argp);
		printf("return code is %d\n", code);
	    } else if (!strcmp(oper, "mm")) {
		code = MakeMountPoint(argp);
		printf("return code is %d\n", code);
	    } else if (!strcmp(oper, "rt")) {
		code = ReleaseTokens(argp);
		printf("return code is %d\n", code);
	    } else if (!strcmp(oper, "bs")) {
		code = BulkStatus(argp);
		printf("return code is %d\n", code);
	    } else if (!strcmp(oper, "lk")) {
		code = Lookup(argp);
		printf("return code is %d\n", code);
	    } else if (!strcmp(oper, "gt")) {
		code = GetToken(argp);
		printf("return code is %d\n", code);
	    } else if (!strcmp(oper, "ka")) {
		code = KeepAlive(argp);
		printf("return code is %d\n", code);
	    } else if ((!strcmp(oper, "q")) || !strcmp(oper, "quit"))
		exit(0);
	    else {
		printf("Unknown oper! Available operations: \n\n");
		printf("fd <vnode> <unique> <pos> <len>\n");
		printf("fs <vnode> <unique>\n");
		printf("fa <vnode> <unique>\n");
		printf
		    ("sd <vnode> <unique> <pos> <len> <flen> [<mode>|-1] [<owner>|-1] [<length>|-1] <string>\n");
		printf
		    ("ss <vnode> <unique> [<mode>|-1] [<owner>|-1] [<length>|-1]\n");
		printf("sa <vnode> <unique> <string>\n");
		printf("rf <vnode> <unique> <name>\n");
		printf
		    ("cf <vnode> <unique> <name> [<mode>|-1] [<owner>|-1] [<length>|-1]\n");
		printf
		    ("rn <ovnode> <ounique> <oname> <nvnode> <nunique> <nname>\n");
		printf
		    ("sl <vnode> <unique> <name> <contents> [<mode>|-1] [<owner>|-1] [<length>|-1]\n");
		printf("hl <dvnode> <dunique> <name> <evnode> <eunique>\n");
		printf
		    ("md <vnode> <unique> <name> [<mode>|-1] [<owner>|-1] [<length>|-1]\n");
		printf("rd <vnode> <unique> <name>\n");
		printf("rdd <vnode> <unique> <pos> <len>\n");
		printf("lk <vnode> <unique> <name>\n");
		printf("gt <vnode> <unique> <tokenID>\n");
		printf("ka <vol.l> <vnode> <unique> <isExec> <kaTime>\n");
	    }
	}
    }
#endif
    return 0;
}
Ejemplo n.º 10
0
bool FPerforceConnection::RunCommand(const FString& InCommand, const TArray<FString>& InParameters, FP4RecordSet& OutRecordSet, TArray<FText>& OutErrorMessage, FOnIsCancelled InIsCancelled, bool& OutConnectionDropped, const bool bInStandardDebugOutput, const bool bInAllowRetry)
{
#if USE_P4_API
	if (!bEstablishedConnection)
	{
		return false;
	}

	FString FullCommand = InCommand;

	// Prepare arguments
	int32 ArgC = InParameters.Num();
	UTF8CHAR** ArgV = new UTF8CHAR*[ArgC];
	for (int32 Index = 0; Index < ArgC; Index++)
	{
		if(bIsUnicode)
		{
			FTCHARToUTF8 UTF8String(*InParameters[Index]);
			ArgV[Index] = new UTF8CHAR[UTF8String.Length() + 1];
			FMemory::Memcpy(ArgV[Index], UTF8String.Get(), UTF8String.Length() + 1);
		}
		else
		{
			ArgV[Index] = new UTF8CHAR[InParameters[Index].Len() + 1];
			FMemory::Memcpy(ArgV[Index], TCHAR_TO_ANSI(*InParameters[Index]), InParameters[Index].Len() + 1);
		}
		
		if (bInStandardDebugOutput)
		{
			FullCommand += TEXT(" ");
			FullCommand += InParameters[Index];
		}
	}

	if (bInStandardDebugOutput)
	{
		UE_LOG( LogSourceControl, Log, TEXT("Attempting 'p4 %s'"), *FullCommand );
	}

	double SCCStartTime = FPlatformTime::Seconds();

	P4Client.SetArgv(ArgC, (char**)ArgV);

	FP4KeepAlive KeepAlive(InIsCancelled);
	P4Client.SetBreak(&KeepAlive);

	OutRecordSet.Reset();
	FP4ClientUser User(OutRecordSet, bIsUnicode, OutErrorMessage);
	P4Client.Run(FROM_TCHAR(*InCommand, bIsUnicode), &User);
	if ( P4Client.Dropped() )
	{
		OutConnectionDropped = true;
	}

	P4Client.SetBreak(NULL);

	// Free arguments
	for (int32 Index = 0; Index < ArgC; Index++)
	{
		delete [] ArgV[Index];
	}
	delete [] ArgV;

	if (bInStandardDebugOutput)
	{
		UE_LOG( LogSourceControl, VeryVerbose, TEXT("P4 execution time: %0.4f seconds. Command: %s"), FPlatformTime::Seconds() - SCCStartTime, *FullCommand );
	}
#endif

	return OutRecordSet.Num() > 0;
}
Ejemplo n.º 11
0
void EZB::Connect(char* mac_address){

	if(m_connected)
		throw std::runtime_error("Already connected");


	if(mac_address){
		m_mac_address = (char*)malloc(sizeof(char) * (strlen(mac_address)+1));
		strcpy(m_mac_address, mac_address);
	}else{

	}

	// allocate a socket
	m_socket = socket(AF_BLUETOOTH, SOCK_STREAM, BTPROTO_RFCOMM);

	// set the connection parameters (who to connect to)
#ifdef _WINDOWS
	m_addr.addressFamily = AF_BLUETOOTH;
	m_addr.port = 1;
	str2ba(m_mac_address, &m_addr.btAddr);
#else
	m_addr.rc_family = AF_BLUETOOTH;
	m_addr.rc_channel = (uint8_t) 1;
	str2ba( m_mac_address, &m_addr.rc_bdaddr );
#endif
	// connect to server
	int status = connect(m_socket, (struct sockaddr *)&m_addr, sizeof(m_addr));

	if(status < 0){
		char error[512];
		sprintf(error, "%s", strerror(errno));
		throw std::runtime_error(error);
	}

	CreateObjects();

#ifdef _WINDOWS
	InitializeCriticalSection(&m_send_mutex);
#else
	pthread_mutex_init(&m_send_mutex, NULL);
#endif

	m_connected = true;

	SendCommand(EZB::Ping);
	usleep(1000000);



	if(!KeepAlive())
		throw std::runtime_error("Controller not responding");

#ifdef _WINDOWS
	m_keepalive_thread = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)ConnectionCheckStub, (void*)this, NULL, 0);
#else
	pthread_create(&m_keepalive_thread, NULL, ConnectionCheckStub, (void*)this);
#endif


}
Ejemplo n.º 12
0
void TCPServer::WaitForClientThread() {
	csIsWaiting.Enter();
	bIsWaiting = true;
	csIsWaiting.Leave();
	
	SOCKET UDPSocket = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
	if (UDPSocket == INVALID_SOCKET) {
		ErrorHandler(UDPSocket, WSAGetLastError(), TEXT("UDPSocket create fail!"));
		csIsWaiting.Enter();
		bIsWaiting = false;
		csIsWaiting.Leave();
		return;
	}
	
	sockaddr_in udp_addr = {0};
	udp_addr.sin_family = AF_INET;
	udp_addr.sin_port = htons(PORT);
	udp_addr.sin_addr.s_addr = htonl(INADDR_ANY);
	
	if (bind(UDPSocket, (sockaddr*)&udp_addr, sizeof(sockaddr_in)) == SOCKET_ERROR) {
		ErrorHandler(UDPSocket, WSAGetLastError(), TEXT("UDPSocket bind fail!"));
		csIsWaiting.Enter();
		bIsWaiting = false;
		csIsWaiting.Leave();
		return;
	}
	
	WSAEVENT hEvent = WSACreateEvent();
	if (hEvent == WSA_INVALID_EVENT) {
		ErrorHandler(UDPSocket, WSAGetLastError(), TEXT("WSACreateEvent fail!"));
		csIsWaiting.Enter();
		bIsWaiting = false;
		csIsWaiting.Leave();
		return;
	}
	
	if (WSAEventSelect(UDPSocket, hEvent, FD_READ) == SOCKET_ERROR) {
		ErrorHandler(UDPSocket, WSAGetLastError(), TEXT("WSAEventSelect fail!"));
		csIsWaiting.Enter();
		bIsWaiting = false;
		csIsWaiting.Leave();
		return;
	}
	
	csStopWait.Enter();
	bStopWait = false;
	csStopWait.Leave();
	
	while (true) {
		DWORD result = WSAWaitForMultipleEvents(1, &hEvent, FALSE, 500, FALSE);
		if (result == WSA_WAIT_FAILED) {
			ErrorHandler(UDPSocket, WSAGetLastError(), TEXT("WSAWaitForMultipleEvents fail!"));
			csIsWaiting.Enter();
			bIsWaiting = false;
			csIsWaiting.Leave();
			return;
		}
		
		csStopWait.Enter();
		if (bStopWait) {
			csStopWait.Leave();
			closesocket(UDPSocket);
			csIsWaiting.Enter();
			bIsWaiting = false;
			csIsWaiting.Leave();
			return;
		}
		csStopWait.Leave();
		
		if (result == WSA_WAIT_TIMEOUT) {
			continue;
		}
		
		WSANETWORKEVENTS netEvents = {0};
		if (WSAEnumNetworkEvents(UDPSocket, hEvent, &netEvents) == SOCKET_ERROR) {
			ErrorHandler(UDPSocket, WSAGetLastError(), TEXT("WSAWaitForMultipleEvents fail!"));
			csIsWaiting.Enter();
			bIsWaiting = false;
			csIsWaiting.Leave();
			return;
		}
		
		if (netEvents.iErrorCode[FD_READ]) {
			ErrorHandler(UDPSocket, WSAGetLastError(), TEXT("iErrorCode FD_READ fail!"));
			csIsWaiting.Enter();
			bIsWaiting = false;
			csIsWaiting.Leave();
			return;
		}
		
		sockaddr_in client_addr = {0};
		int client_addr_size = sizeof(sockaddr_in);
		UDPPacket packet = {0};
		
		if (recvfrom(UDPSocket, (char*)&packet, sizeof(UDPPacket), 0, (sockaddr*)&client_addr, &client_addr_size) == SOCKET_ERROR) {
			ErrorHandler(UDPSocket, WSAGetLastError(), TEXT("UDPSocket recvfrom fail!"));
			csIsWaiting.Enter();
			bIsWaiting = false;
			csIsWaiting.Leave();
			return;
		}
		
		if (packet.message == LOCATE_SERVER) {
			UDPPacket answer = {0};
			answer.message = CONFIRM_SERVER;
			
			csTCP.Enter();
			_tcscpy_s(answer.nick, STR_SIZE, Nick);
			_tcscpy_s(answer.pcname, STR_SIZE, PCName);
			csTCP.Leave();
			
			if (sendto(UDPSocket, (char*)&answer, sizeof(UDPPacket), 0, (sockaddr*)&client_addr, client_addr_size) == SOCKET_ERROR) {
				ErrorHandler(UDPSocket, WSAGetLastError(), TEXT("UDPSocket sendto fail!"));
				csIsWaiting.Enter();
				bIsWaiting = false;
				csIsWaiting.Leave();
				return;
			}
			
			continue;
		}
		
		if (packet.message == CONNECT_TO_SERVER) {
			csTCP.Enter();
			_tcscpy_s(oppNick, STR_SIZE, packet.nick);
			_tcscpy_s(oppPCName, STR_SIZE, packet.pcname);
			csTCP.Leave();
			
			closesocket(UDPSocket);
			break;
		}
	}
	
	SOCKET listenSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
	if (listenSocket == INVALID_SOCKET) {
		ErrorHandler(listenSocket, WSAGetLastError(), TEXT("listenSocket create fail!"));
		csIsWaiting.Enter();
		bIsWaiting = false;
		csIsWaiting.Leave();
		return;
	}
	
	sockaddr_in listen_addr = {0};
	listen_addr.sin_family = AF_INET;
	listen_addr.sin_port = htons(PORT);
	listen_addr.sin_addr.s_addr = htonl(INADDR_ANY);
	
	if (bind(listenSocket, (sockaddr*)&listen_addr, sizeof(sockaddr_in)) == SOCKET_ERROR) {
		ErrorHandler(listenSocket, WSAGetLastError(), TEXT("listenSocket bind fail!"));
		csIsWaiting.Enter();
		bIsWaiting = false;
		csIsWaiting.Leave();
		return;
	}
	
	if (listen(listenSocket, 1) == SOCKET_ERROR) {
		ErrorHandler(listenSocket, WSAGetLastError(), TEXT("listenSocket listen fail!"));
		csIsWaiting.Enter();
		bIsWaiting = false;
		csIsWaiting.Leave();
		return;
	}
	
	int connect_addr_size = sizeof(sockaddr_in);
	TCPSocket = accept(listenSocket, (sockaddr*)&connect_addr, &connect_addr_size);
	closesocket(listenSocket);
	if (TCPSocket == INVALID_SOCKET) {
		ErrorHandler(TCPSocket, WSAGetLastError(), TEXT("listenSocket accept fail!"));
		csIsWaiting.Enter();
		bIsWaiting = false;
		csIsWaiting.Leave();
		return;
	}
	
	if (!KeepAlive()) {
		csIsWaiting.Enter();
		bIsWaiting = false;
		csIsWaiting.Leave();
		return;
	}
	
	if (!ReceiveData()) {
		ErrorHandler(TCPSocket, ERROR_CREATE_THREAD_FAIL, TEXT("ReceiveDataThread start fail!"));
		csIsWaiting.Enter();
		bIsWaiting = false;
		csIsWaiting.Leave();
		return;
	}
	
	csTCP.Enter();
	bIsConnected = true;
	csTCP.Leave();
	PostMessage(hSendWnd, SUCCESS_CONNECTED, NULL, NULL);
	
	csIsWaiting.Enter();
	bIsWaiting = false;
	csIsWaiting.Leave();
	
	return;
};
Ejemplo n.º 13
0
BOOLEAN Dot11bSendProc (void*) {
    PACKET_HANDLE packet;
    PUCHAR addr;
    UINT len;
    HRESULT hr;
    bool bRet;
    ulong sample_size;
    DOT11RFC1042ENCAP wheader = { 0 };
    
    if ( mgmtPkt ) {
        ULONG mp = 0;
        mp = InterlockedExchange ( (LONG*)&mgmtPkt, 0 );
        return ProcessMgmtPktSendRequest(mp);
    }
    
    if ( fKeepAlive == 1 ) {
        KeepAlive ();
        fKeepAlive = 0;
    }

    hr = SoraUGetTxPacket(&packet, (VOID**)&addr, &len, 10);
    if (hr == S_OK) {

        struct PACKETxID* ptid;
        ptid = (struct PACKETxID*)malloc(sizeof(struct PACKETxID));
        memset(ptid, 0, sizeof(struct PACKETxID));
        ptid->m_packet = packet;
                
        bRet = Encapsulate80211Frame (ptid, wheader, addr, len );		

        bRet = ModBuffer11b ( (UCHAR*)&wheader, sizeof(DOT11RFC1042ENCAP), 
                addr + sizeof(ETHERNET_HEADER), len - sizeof(ETHERNET_HEADER), 
                (ushort) gDataRateK, 
                (COMPLEX8*)SampleBuffer[0], SampleSize, &sample_size );

        if ( bRet ) {
            // Frame is modulated
            hr = TransferBuffers(ptid, SampleBuffer, 1, sample_size);
            if (SUCCEEDED(hr)) {
                insert_list_tail(&SendListHead, 
                    &ptid->m_entry, 
                    &SendListLock);
            }
            else {
                printf("SoraURadioTransferEx hr: [0x%08x]\n", hr);
                
                ptid->m_status = PACKET_TF_FAIL;
                debug_printf("Queued Send Packet PACKET_TF_FAIL: [%08x]\n", 
                    ptid->m_packet);
                insert_list_tail(   &SendListHead, 
                                    &ptid->m_entry, 
                                    &SendListLock  );
            }
        }
        else {
            printf("Modulation failure\n");

            ptid->m_status = PACKET_NOT_MOD;
            debug_printf("Queued Send Packet PACKET_NOT_MOD: [%08x]\n", 
                ptid->m_packet);
            insert_list_tail(&SendListHead, 
                &ptid->m_entry, 
                &SendListLock);
        }

    }
    else
    if (hr == ERROR_CANCELLED)
        return FALSE;

    return TRUE;
}