[Libtorrent-devel] torrent anounced but not able to download,
Shehjar Tikoo
shehjar at sarai.net
Tue Jan 11 10:08:52 UTC 2005
Hi
The problem I am facing now is this.
The tracker gets the announce request.But a peer is not able to
download.The btdownloadcurses tool hangs on the 'connecting to peer'
message'
The problem is most probably occurring due to the extra file descriptor
I have added to the fdset in select call.This FD is for a Unix Domain
Socket that I am using for IPC with another process.But I do unset it
when I call the torrent::work function.
I say that its probably this FD thats causing a problem since, the peer
is able to download when I seed using another program that does the same
seeding but without IPC facilities.But there could also be another reason.
I know this is a generic programming issue, but I was hoping if I could
get some help about this here.
Below is the while loop of the daemon.
=====================
while(1) {
FD_ZERO(&rset);
FD_ZERO(&wset);
FD_ZERO(&eset);
//First mark fd sets from the libtorrent methods.
torrent::mark(&rset, &wset, &eset, &torrent_max_fd);
if(curlStack.is_busy())
curlStack.fdset(&rset, &wset, &eset,curl_max_fd);
maxfd = std::max(torrent_max_fd, curl_max_fd);
//Then mark the unix domain sockets fd
FD_SET(sockfd, &rset);
if(sockfd > maxfd)
maxfd = sockfd;
timout = std::min(5000000 + torrent::get(torrent::TIME_CURRENT),
torrent::get(torrent::TIME_SELECT));
if(timout < 0)
timout = 0;
timeout.tv_sec = timout / 1000000;
timeout.tv_usec = timout % 1000000;
numfd = select(maxfd + 1, &rset, &wset, &eset, &timeout);
if(FD_ISSET(sockfd, &rset)) {
connfd = accept(sockfd, (struct sockaddr *)&seeder_sock, &sockaddr_len);
if(connfd >= 0) {
tmp = add_seed_list(connfd, downloads);
close(connfd);
}
}
//Clear the fd of the unix domain socket, since we now need to
//let libtorrent do its work.
FD_CLR(sockfd, &rset);
try {
torrent::work(&rset, &wset, &eset, numfd);
}catch(std::exception e) {
std::cout<<e.what();
}
curlStack.perform();
}
=========================
Thanks and regards
Shehjar
--
Sarai Program
WWW: http://users.sarai.net/~shehjar
BLOG: http://blog.sarai.net/users/shehjar
More information about the Libtorrent-devel
mailing list