Last active
August 29, 2015 14:27
-
-
Save MicBrain/437606e97e24982a83ae to your computer and use it in GitHub Desktop.
WaitForNext() Function
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
JobInfo* MultiFetcher::WaitForNext() { | |
int index; | |
int timeout = -1; | |
int length = getJobInfoList().size(); | |
download_mgr->watch_fds_ = | |
static_cast<struct pollfd *>(smalloc(length * sizeof(struct pollfd))); | |
download_mgr->watch_fds_size_ = length; | |
for (index = 0; index < length; index++) { | |
download_mgr->watch_fd_[index].fd = JobInfo[idx].pipe_fd | |
download_mgr->watch_fd_[index].events = POLLIN | POLLPRI; | |
download_mgr->watch_fd_[index].revents = 0; | |
} | |
download_mgr->watch_fds_inuse_ = length; | |
DOING SOME OPERATIONS TO FIGURE OUT A RANDOM INDEX FOR OUR JOBINFO OBJECT | |
int retval = poll(download_mgr->watch_fds_, download_mgr->watch_fds_inuse_, | |
timeout); | |
Failures result; | |
result = info->error_code; | |
if (result != kFailOk) { | |
LogCvmfs(kLogDownload, kLogDebug, "download failed (error %d - %s)", result, | |
Code2Ascii(result)); | |
if (info->destination == kDestinationPath) | |
unlink(info->destination_path->c_str()); | |
if (info->destination_mem.data) { | |
free(info->destination_mem.data); | |
info->destination_mem.data = NULL; | |
info->destination_mem.size = 0; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment