void WardenBase::Update() { if (m_initialized) { uint32 ticks = getMSTime(); uint32 diff = ticks - m_WardenTimer; m_WardenTimer = ticks; if (m_WardenDataSent) { // 1.5 minutes after send packet uint32 maxClientResponseDelay = sWorld.getConfig(CONFIG_WARDEN_CLIENT_RESPONSE_DELAY); if (m_WardenKickTimer > maxClientResponseDelay * IN_MILLISECONDS) Client->KickPlayer(); else m_WardenKickTimer += diff; } else if (m_WardenCheckTimer > 0) { if (diff >= m_WardenCheckTimer) { RequestData(); m_WardenCheckTimer = sWorld.getConfig(CONFIG_WARDEN_CLIENT_CHECK_HOLDOFF) * IN_MILLISECONDS; } else m_WardenCheckTimer -= diff; } } }
void WardenBase::Update() { if (m_initialized) { uint32 ticks = getMSTime(); uint32 diff = ticks - m_WardenTimer; m_WardenTimer = ticks; if (m_WardenDataSent) { // 3 minutes after send packet if ((m_WardenKickTimer > 180 * IN_MILLISECONDS) && sWorld->getBoolConfig(CONFIG_BOOL_WARDEN_KICK)) Client->KickPlayer(); else m_WardenKickTimer += diff; } else if (m_WardenCheckTimer > 0) { if (diff >= m_WardenCheckTimer) { RequestData(); // 25-35 second m_WardenCheckTimer = irand(25, 35) * IN_MILLISECONDS; } else m_WardenCheckTimer -= diff; } } }
void CSendDataReceiver::ConstructL() { iQueue = new (ELeave) CArrayPtrSeg<HBufC8>(8); User::LeaveIfError(iCritical.CreateLocal()); CActiveScheduler::Add(this); RequestData(); }
void TeamLeaguePlugin::OnLogOn() { online_ = true; GetFICSUserName(&username_); UpdateTabset(); if (settings_.settings().update_on_logon()) { RequestData(); } }
bool GraphicsServerCommunication::ShutDown() { bool retVal = false; m_isStopSignaled = true; gtASCIIString httpRtnString; retVal = RequestData("/ShutDown", httpRtnString); return retVal; }
::IceInternal::DispatchStatus BHAco::Request::___RequestData(::IceInternal::Incoming&__inS, const ::Ice::Current& __current) { __checkMode(::Ice::Normal, __current.mode); ::IceInternal::BasicStream* __is = __inS.is(); ::IceInternal::BasicStream* __os = __inS.os(); ::BHAco::SDataPacket dp; dp.__read(__is); ::BHAco::SDataPacket __ret = RequestData(dp, __current); __ret.__write(__os); return ::IceInternal::DispatchOK; }
void WardenBase::Update() { if(m_initialized) { uint32 ticks = getMSTime(); uint32 diff = ticks - m_WardenTimer; m_WardenTimer = ticks; if(m_WardenDataSent) { // 3 minutes after send packet if((m_WardenKickTimer > 180 * IN_MILLISECONDS) && sWorld->getBoolConfig(CONFIG_BOOL_WARDEN_KICK)) { if(!m_previousCheckFailed) { m_previousCheckFailed = true; RequestData(); m_WardenKickTimer = 0; m_WardenCheckTimer = irand(25, 35) * IN_MILLISECONDS; sLog->outWarden("Warden: no answer from client, resend check. Account: %u (player: %s)", Client->GetAccountId(), Client->GetPlayerName()); } else Client->KickPlayer(); } else m_WardenKickTimer += diff; } else if(m_WardenCheckTimer > 0) { if(diff >= m_WardenCheckTimer) { RequestData(); // 25-35 second m_WardenCheckTimer = irand(25, 35) * IN_MILLISECONDS; } else m_WardenCheckTimer -= diff; } } }
bool GraphicsServerCommunication::GetProcesses(gtASCIIString& strWebResponse) { bool retVal = false; OS_DEBUG_LOG_TRACER_WITH_RETVAL(retVal); // The ConnectToAPI dialog sends this message periodically directly from the main UI thread. // To keep the UI responsive we set the isResendAllowed flag to false to avoid getting stuck in a // resend loop bool isResendAllowed = false; retVal = RequestData("/Process.xml", strWebResponse, isResendAllowed); return retVal; }
void Warden::Update() { if (_initialized) { uint32 ticks = getMSTime(); uint32 diff = ticks - _previousTimestamp; _previousTimestamp = ticks; if (_dataSent) { uint32 maxClientResponseDelay = sWorld->getIntConfig(CONFIG_WARDEN_CLIENT_RESPONSE_DELAY); if (maxClientResponseDelay > 0) { // Kick player if client response delays more than set in config if (_clientResponseTimer > maxClientResponseDelay * IN_MILLISECONDS) { sLog->outError("WARDEN: Player %s (guid: %u, account: %u) exceeded Warden module response delay. Action: %s (Latency: %u, IP: %s)", _session->GetPlayerName(), _session->GetGuidLow(), _session->GetAccountId(), Penalty().c_str(), _session->GetLatency(), _session->GetRemoteAddress().c_str()); // If action is set to "none" we reset the client response timer to prevent this condition from triggering repeatedly if (sWorld->getIntConfig(CONFIG_WARDEN_CLIENT_FAIL_ACTION) == 0) { _clientResponseTimer = 0; _clientRespExceedCounter++; // DEBUG CODE } } else _clientResponseTimer += diff; } } else if (_checkTimer > 0) { if (diff >= _checkTimer) { RequestData(); uint32 period = sWorld->getIntConfig(CONFIG_WARDEN_CLIENT_CHECK_PERIOD); _checkTimer = irand(period - 5, period + 5) * IN_MILLISECONDS; } else _checkTimer -= diff; } } }
void CSendDataReceiver::RunL() { iCritical.Wait(); //since this function never leaves we do not have //to leave handle the critical region. if(iStatus == KErrNone){ if(iQueue->Count() > 0){ HBufC8* front = iQueue->At(0); iAdmin->WriteToTcp(front); iQueue->Delete(0); } } else { RequestData(); //will this deadlock? } iCritical.Signal(); }
int ExecuteInvokedMethod(RTMP *r, const AVal *method, AMFObject *obj, void *ctx) { struct YLENGStream *yle = (struct YLENGStream *)ctx; int redirected = FALSE; if (!yle || yle->yleAuth == 0) return RTMP_CB_NOT_HANDLED; if (AVMATCH(method, &av_authenticationDetails)) { AMFObject list; AMFProp_GetObject(AMF_GetProp(obj, NULL, 3), &list); if (!ExecuteAuthenticationDetails(r, &list, yle)) return RTMP_CB_ERROR_STOP; if (yle->clipID.av_len) { if (!RequestData(r, yle)) return RTMP_CB_ERROR_STOP; } else if (!RTMP_SendCreateStream(r)) { return RTMP_CB_ERROR_STOP; } return RTMP_CB_SUCCESS; } else if (AVMATCH(method, &av_randomNumberAuthenticated)) { ExecuteRandomNumberAuthenticated(r); return RTMP_CB_SUCCESS; } else if (AVMATCH(method, &av_rpcResult)) { if (!ExecuteRPCResult(r, obj, yle, &redirected)) return RTMP_CB_ERROR_STOP; //if (redirected && !ConnectRedirected(r, r->Link.seekTime, yle)) // return RTMP_CB_ERROR_STOP; return RTMP_CB_SUCCESS; } else if (AVMATCH(method, &av_rpcError)) { RTMP_Log(RTMP_LOGERROR, "RTMP server returned RPC error"); return RTMP_CB_ERROR_STOP; } return RTMP_CB_NOT_HANDLED; }
bool GraphicsServerCommunication::SendCommandWithBinaryData(const gtASCIIString& strCommand, unsigned char*& pReturnDataBuffer, unsigned long& dataBufferSize) { bool retVal = false; gtASCIIString strConnectPid; gtASCIIString strQueryUrl; if ((0 < m_strPid.length()) && (true == m_strPid.isIntegerNumber())) { strConnectPid = m_strPid; } strQueryUrl = "/"; strQueryUrl.append(strConnectPid); strQueryUrl.append(strCommand); retVal = RequestData(strQueryUrl, pReturnDataBuffer, dataBufferSize); return retVal; }
bool CIVConnection::GetYield (LPCTSTR szIndex, double & rdYield ) { InitRequest(); ASSERT (szIndex); CString strURL; if(-1 == m_opts.m_strURL.Find(_T("http"))) { strURL = _T("http://"); strURL += m_opts.m_strURL; } else strURL = m_opts.m_strURL; m_strRequest = strURL + _T("/ivanalyzer.asp?sid=%s&si=2&idx="); m_strRequest += szIndex; if (! RequestData() ) return false; rdYield = 0; LPCTSTR szKey = _T("Yield"); LPCTSTR szToken = _tcsstr_nocase (m_strResult, szKey); if (szToken) { szToken += _tcslen (szKey) ; #ifndef _UNICODE std::istringstream is; #else std::wistringstream is; #endif is.str ( szToken); is >> rdYield; } return true; }
// --------------------------------------------------------------------------- // Name: GraphicsServerCommunication::SendCommandPid // Description: locate available Graphics server // Arguments: strWebResponse(return) - web string returned. // strCommand - URL command to send to server // strPid - optional Process ID string, leave empty, "", to use existing Process ID // Return Val: bool - Success / failure // --------------------------------------------------------------------------- bool GraphicsServerCommunication::SendCommandPid(const gtASCIIString& strCommand, gtASCIIString& strWebResponse, const gtASCIIString& strPid, bool isResendAllowed) { bool retVal = false; gtASCIIString strConnectPid; gtASCIIString strQueryUrl; if ((0 < strPid.length()) && (true == strPid.isIntegerNumber())) { strConnectPid = strPid; } else if ((0 < m_strPid.length()) && (true == m_strPid.isIntegerNumber())) { strConnectPid = m_strPid; } strQueryUrl = "/"; strQueryUrl.append(strConnectPid); strQueryUrl.append(strCommand); retVal = RequestData(strQueryUrl, strWebResponse, isResendAllowed); return retVal; }
void Warden::Update() { if (_initialized) { uint32 currentTimestamp = getMSTime(); uint32 diff = currentTimestamp - _previousTimestamp; _previousTimestamp = currentTimestamp; if (_dataSent) { uint32 maxClientResponseDelay = sWorld->getIntConfig(CONFIG_WARDEN_CLIENT_RESPONSE_DELAY); if (maxClientResponseDelay > 0) { // Kick player if client response delays more than set in config if (_clientResponseTimer > maxClientResponseDelay * IN_MILLISECONDS) { sLog->outWarden("WARDEN: Player %s (guid: %u, account: %u, latency: %u, IP: %s) exceeded Warden module response delay for more than %s - disconnecting client", _session->GetPlayerName(), _session->GetGuidLow(), _session->GetAccountId(), _session->GetLatency(), _session->GetRemoteAddress().c_str(), secsToTimeString(maxClientResponseDelay, true).c_str()); _session->KickPlayer(); } else _clientResponseTimer += diff; } } else { if (diff >= _checkTimer) { RequestData(); } else _checkTimer -= diff; } } }
bool CIVConnection::GetHIVola (LPCTSTR szSymbol, const dte_vec & dtes, hist_ranges_map & ranges) { InitRequest(); ASSERT (szSymbol); CString strURL; if(-1 == m_opts.m_strURL.Find(_T("http"))) { strURL = _T("http://"); strURL += m_opts.m_strURL; } else strURL = m_opts.m_strURL; m_strRequest = strURL + _T("/ivanalyzer.asp?sid=%s&si=1&S="); m_strRequest += szSymbol; CString strDates; for (dte_vec::const_iterator it = dtes.begin() ; it != dtes.end(); it++ ) { CString strFmt; strFmt.Format (_T("&D=%d"), *it ); strDates += strFmt; } m_strRequest += strDates; if (! RequestData() ) return false; ranges.clear(); DATE dtCurrent = (long) (DATE) COleDateTime::GetCurrentTime(); LPTSTR szResult = m_strResult.GetBuffer (0); LPCTSTR szDelimit = _T("\r"); char* szContext = NULL; LPTSTR szToken = _tcstok_s (szResult, szDelimit, &szContext); while (szToken) { LPCTSTR szKey = _T("HiVola"); LPCTSTR szStart = _tcsstr_nocase (szToken, szKey); if (szStart) { szStart += _tcslen (szKey); CHistRangeData hrData; long nDte = 0; #ifndef _UNICODE char chSep; std::istringstream is; #else wchar_t chSep; std::wistringstream is; #endif is.str ( szStart); is >> nDte >> chSep >> hrData.m_dStrike >> chSep >> hrData.m_dHistVolaHigh >> chSep >> hrData.m_dHistVolaLow >> chSep >> hrData.m_bATM; long dtExp = static_cast<long>(dtCurrent) + nDte; ranges.insert ( std::make_pair (dtExp, hrData) ); } szToken = _tcstok_s (NULL, szDelimit, &szContext); } m_strResult.ReleaseBuffer(); return true; }
void BitRequestList::AddRequest(int index, int begin, int length) { request_list_.push_back(RequestData(index, begin, length)); }
bool BitRequestList::IsExistRequest(int index, int begin, int length) const { return std::find(Begin(), End(), RequestData(index, begin, length)) != End(); }
BitRequestList::Iterator BitRequestList::FindRequest(int index, int begin, int length) { return std::find(Begin(), End(), RequestData(index, begin, length)); }
void BitRequestList::DelRequest(int index, int begin, int length) { request_list_.remove(RequestData(index, begin, length)); }
// ---------------------------------------------------------------------------- // CChatBt::RunL() // Respond to an event. // ---------------------------------------------------------------------------- // void CChatBt::RunL() { HBufC* textResource = NULL; TBuf<KMaxMarkLen> mark; if ( iStatus == KErrDisconnected ) { // Disconnected HBufC* strDisconnected = StringLoader ::LoadLC ( R_CHAT_STR_DISCONNECTED ); iLog.LogL( *strDisconnected ); CleanupStack::PopAndDestroy( strDisconnected ); StopL(); return; } else if ( iStatus == KErrAbort ) { HBufC* strDisconnected = StringLoader ::LoadLC ( R_CHAT_STR_DISCONNECTED ); iLog.LogL( *strDisconnected ); CleanupStack::PopAndDestroy( strDisconnected ); StopL(); return; } else if ( iStatus != KErrNone ) { switch ( State() ) { case EGettingDevice: if ( iStatus == KErrCancel ) { textResource = StringLoader ::LoadLC( R_CHAT_ERR_NO_DEVICE_SELECTED ); iLog.LogL( *textResource ); CleanupStack::PopAndDestroy( textResource ); } SetState( EWaitingToGetDevice ); break; case EGettingService: case EGettingConnection: textResource = StringLoader ::LoadLC( R_CHAT_ERR_CONNECTION_ERROR ); iLog.LogL( *textResource, iStatus.Int() ); CleanupStack::PopAndDestroy( textResource ); SetState( EWaitingToGetDevice ); break; case EConnected: textResource = StringLoader ::LoadLC( R_CHAT_ERR_LOST_CONNECTION ); iLog.LogL( *textResource, iStatus.Int() ); DisconnectFromServerL(); CleanupStack::PopAndDestroy( textResource ); SetState( EDisconnecting ); break; case ESendingMessage: textResource = StringLoader ::LoadLC( R_CHAT_ERR_MESSAGE_FAILED ); iLog.LogL( *textResource, iStatus.Int() ); CleanupStack::PopAndDestroy( textResource ); DisconnectFromServerL(); SetState( EDisconnecting ); break; case EDisconnecting: if ( iStatus == KErrDisconnected ) { textResource = StringLoader ::LoadLC( R_CHAT_DISCONNECT_COMPLETE ); iLog.LogL( *textResource, iStatus.Int() ); CleanupStack::PopAndDestroy( textResource ); StopL(); SetState( EWaitingToGetDevice ); } else { textResource = StringLoader ::LoadLC( R_CHAT_ERR_FAILED_TO_DISCONNECT ); iLog.LogL( *textResource, iStatus.Int() ); CleanupStack::PopAndDestroy( textResource ); Panic( EChatUnableToDisconnect ); } break; case EWaitingToGetDevice: textResource = StringLoader ::LoadLC( R_CHAT_STR_DISCONNECTED ); iLog.LogL( *textResource ); CleanupStack::PopAndDestroy( textResource ); break; default: Panic( EChatInvalidLogicState ); break; } } else { switch ( State() ) { case EGettingDevice: // found a device now search for a suitable service iLog.LogL( iServiceSearcher->ResponseParams().DeviceName() ); SetState( EGettingService ); iStatus = KRequestPending; // this means that the RunL // can not be called until // this program does something // to iStatus iServiceSearcher->FindServiceL( iStatus ); SetActive(); break; case EConnecting: textResource = StringLoader::LoadLC ( R_CHAT_CONNECTED ); iLog.LogL( *textResource ); CleanupStack::PopAndDestroy( textResource ); // do not accept any more connections iAdvertiser->UpdateAvailabilityL( EFalse ); RequestData(); SetState( EConnected ); break; case EGettingService: textResource = StringLoader ::LoadLC( R_CHAT_FOUND_SERVICE ); iLog.LogL( *textResource ); CleanupStack::PopAndDestroy( textResource ); SetState( EGettingConnection ); ConnectToServerL(); break; case EGettingConnection: textResource = StringLoader ::LoadLC( R_CHAT_CONNECTED ); iLog.LogL( *textResource ); CleanupStack::PopAndDestroy( textResource ); SetState( EConnected ); RequestData(); break; case EConnected: mark.Append( '>' ); textResource = HBufC::NewLC( iBuffer.Length() ); textResource->Des().Copy( iBuffer ); iLog.LogL( *textResource, mark ); iBuffer.Zero(); CleanupStack::PopAndDestroy( textResource ); RequestData(); break; case ESendingMessage: SetState( EConnected ); RequestData(); break; case EDisconnecting: textResource = StringLoader ::LoadLC( R_CHAT_DISCONNECT_COMPLETE ); iLog.LogL( *textResource ); CleanupStack::PopAndDestroy ( textResource ); iSocket.Close(); SetState( EWaitingToGetDevice ); break; case EWaitingToGetDevice: break; default: Panic( EChatInvalidLogicState ); break; }; } }
void CServerHandshake::Run() { VERIFY(AfxSocketInit()); CSocket socket; // führen Handshake innerhalb des Threads synchron aus socket.Attach(m_hSocket); clock_t end = clock() + HANDSHAKE_TIMEOUT * CLOCKS_PER_SEC; // (1.) auf eingehenden Identifizierungs-String (HANDSHAKE_CLIENTID) + Versionsnummer // vom Client warten UINT nCount = strlen(HANDSHAKE_CLIENTID) + 1 + sizeof(UINT) + 1; if (!RequestData(socket, nCount, end)) { DEBUG_MSG("client timed out, disconnected"); SetExitCode(1); return; } // Daten in Puffer übertragen BYTE *lpBuf = new BYTE[nCount]; int nDone = socket.Receive(lpBuf, nCount); if (nDone == SOCKET_ERROR) goto sockerror; else if (nDone < nCount) goto error; // Pufferinhalt prüfen if (memcmp(lpBuf, HANDSHAKE_CLIENTID, strlen(HANDSHAKE_CLIENTID)) != 0 || lpBuf[strlen(HANDSHAKE_CLIENTID)] != 0 || lpBuf[nCount - 1] != 0) { DEBUG_MSG("client is not a BotE client, disconnected"); delete[] lpBuf; SetExitCode(1); return; } // Puffer erfolgreich geprüft, Versionsnummer extrahieren UINT nClientVersion; memcpy(&nClientVersion, lpBuf + (strlen(HANDSHAKE_CLIENTID) + 1), sizeof(UINT)); TRACE("server: client has version %u\n", nClientVersion); delete[] lpBuf; lpBuf = NULL; // abbrechen, wenn andere Versionsnummer if (nClientVersion != m_nServerVersion) { DEBUG_MSG("client has incompatible version, disconnected"); SetExitCode(1); return; } // (2.) Server-Identifizierung + Versionsnummer senden nDone = socket.Send(HANDSHAKE_SERVERID, strlen(HANDSHAKE_SERVERID)); if (nDone == SOCKET_ERROR) goto sockerror; else if (nDone < strlen(HANDSHAKE_SERVERID)) goto error; lpBuf = new BYTE[nCount = 1 + sizeof(UINT) + 1]; lpBuf[0] = lpBuf[nCount - 1] = 0; memcpy(&lpBuf[1], &m_nServerVersion, sizeof(UINT)); nDone = socket.Send(lpBuf, nCount); if (nDone == SOCKET_ERROR) goto sockerror; else if (nDone < nCount) goto error; delete[] lpBuf; lpBuf = NULL; // (3.a) Bestätigung vom Client abwarten int nLen = 3 + sizeof(UINT); if (!RequestData(socket, nLen, end)) { DEBUG_MSG("client timed out, disconnected"); SetExitCode(1); return; } // Bestätigung prüfen lpBuf = new BYTE[3]; nDone = socket.Receive(lpBuf, 3); if (nDone == SOCKET_ERROR) goto sockerror; else if (nDone < 3) goto error; if (memcmp(lpBuf, "OK\0", 3) != 0) { DEBUG_MSG("client did not confirm, disconnected"); delete[] lpBuf; SetExitCode(1); return; } delete[] lpBuf; // Länge des Benutzernamens ermitteln lpBuf = new BYTE[sizeof(UINT)]; nDone = socket.Receive(lpBuf, sizeof(UINT)); if (nDone == SOCKET_ERROR) goto sockerror; else if (nDone < sizeof(UINT)) goto error; UINT nStrLen = 0; memcpy(&nStrLen, lpBuf, sizeof(UINT)); delete[] lpBuf; // (3.b) Benutzername empfangen if (!RequestData(socket, nStrLen, end)) { DEBUG_MSG("client timed out, disconnected"); SetExitCode(1); return; } // Benutzername lesen lpBuf = new BYTE[nStrLen + 1]; nDone = socket.Receive(lpBuf, nStrLen); if (nDone == SOCKET_ERROR) goto sockerror; else if (nDone < nStrLen) goto error; { lpBuf[nStrLen] = 0; CString strUserName((char *)lpBuf); strUserName.Trim(); // dem Server einen neuen Client melden; verwenden kleinere Versionsnummer zur // Kommunikation server.OnNewClient(socket.Detach(), min(m_nServerVersion, nClientVersion), strUserName); } delete[] lpBuf; return; sockerror: server.OnSocketError(socket.GetLastError()); error: if (lpBuf) delete[] lpBuf; SetExitCode(1); }