int MinCollector::collect(std::vector<std::pair<KmerEntry,int>>& v1, std::vector<std::pair<KmerEntry,int>>& v2, bool nonpaired) { std::vector<int> u; int r = intersectKmers(v1, v2, nonpaired, u); if (r != -1) { return increaseCount(u); } else { return -1; } }
ExitCode Entry() { isdownloading = true; /* if (!unpackNow()) { castEvent(13); wxThread::Sleep(100); isdownloading = false; } else { castEvent(1); wxThread::Sleep(100); isdownloading = false; } return 0; */ count = 0; //h->SetHeader ( wxT("Accept") , wxT("text/*") ); //h->SetHeader ( wxT("User-Agent"), wxGetApp().GetAppName() ); h->SetTimeout ( 120 ); if (!h->Connect(_("download.tibia.com"),80)) { castEvent(2); isdownloading = false; wxThread::Sleep(100); return 0; } castEvent(7); h_stream = h->GetInputStream(_("/") + version + ".tgz"); if (!h_stream) { printf("Failed to send request\n"); castEvent(2); isdownloading = false; wxThread::Sleep(100); return 0; } castEvent(8); { wxCriticalSectionLocker locker(m_critsect); wxString some_wxstring = h->GetHeader("Content-length"); contentlength = atoi(some_wxstring.c_str()); printf("Length: %d\n", contentlength); } struct stat st; stat((version + ".tgz").c_str(), &st); size_t size = st.st_size; if (size != contentlength) { unlink((version + ".tgz").c_str()); wxFileOutputStream fos(version + ".tgz"); if (!fos.IsOk()){ castEvent(3); isdownloading = false; wxThread::Sleep(100); return 0; } wxMilliClock_t lasttime = 0; do { char buf[1024]; if (TestDestroy()) { castEvent(4); isdownloading = false; wxThread::Sleep(100); return 0; } h_stream->Read(buf, sizeof(buf)); fos.Write(buf, h_stream->LastRead()); increaseCount(h_stream->LastRead()); if (wxGetLocalTimeMillis() - lasttime >= 50) { lasttime = wxGetLocalTimeMillis(); castEvent(5); } } while(h_stream->LastRead()); delete h_stream; h_stream = NULL; delete h; h = NULL; } if (!unpackNow()) { castEvent(13); wxThread::Sleep(100); isdownloading = false; } else { castEvent(1); wxThread::Sleep(100); isdownloading = false; } return 0; }