void TWebPgFetchPersist::OnError(const int& FId, const TStr& MsgStr) { ErrorCount++; ReportError(MsgStr); Report(); // in case of bad request don't make the request again /*if (!HttpResp.Empty() && HttpResp->GetStatusCd() == 400) { TStr Url = ""; if (IsConn(FId)) Url = GetConnUrl(FId)->GetUrlStr(); if (!Notify.Empty()) { TStr Error = "TWebPgFetchPersist.OnError: Received http response 400 (Bad request). Skipping the request. Request: " + Url; Notify->OnStatus(Error.CStr()); } return; } else if (!HttpResp.Empty() && !Notify.Empty()) { Notify->OnStatusFmt("TWebPgFetchPersist.OnError: Received http response %d.", HttpResp->GetStatusCd()); }*/ if (IsConn(FId) && RepeatFailedRequests) { PUrl Url = GetConnUrl(FId); FetchUrl(Url, false); // enqueue request at the beginning of the queue } }
void SendToMoniterState( const char* pdata ) { if( IsConn() ) { moniter::PACKET_COMMAND pmd; pmd.SetPacketType( moniter::DISPSTATE ); pmd.SetData( pdata ); Send( pmd ); } }
void SendToMoniterBanner( const char* pdata ) { if( IsConn() ) { moniter::PACKET_COMMAND pmd; pmd.SetPacketType( moniter::DISPBANNER ); pmd.SetData( pdata ); Send( pmd ); } }
void SendToMoniter( int nLine, const char* pdata ) { if( IsConn() ) { moniter::PACKET_COMMAND pmd; pmd.SetPacketType( moniter::DISPLINE ); pmd.SetLine( nLine+1 ); pmd.SetData( pdata ); Send( pmd ); } }
int Send( moniter::PACKET_COMMAND& pmd ) { // printf( "want send %d => %s\n",pmd.Size(),pmd.Data() ); if( !IsConn() ) { printf("Not connected!\n"); return 0; } int bytes = write( client_sockfd, pmd.pParam, pmd.Size() ); // printf( "send bytes => %d\n",bytes ); if ( bytes == -1) { printf ("moniter disconnect.\n"); recvflag = false; ThreadLib::WaitForFinish(g_hThreadRecv); isconn = false; close(client_sockfd); client_sockfd = NULL; return -1; } return bytes; }