From: Efraim Flashner <efraim@flashner.co.il>
To: "Ludovic Courtès" <ludo@gnu.org>
Cc: guix-devel@gnu.org
Subject: Re: [PATCH 0/3] add c-ares and aria2
Date: Thu, 12 Nov 2015 19:38:44 +0200 [thread overview]
Message-ID: <20151112193844.7a3479ae@debian-netbook> (raw)
In-Reply-To: <87egfvxt9g.fsf@gnu.org>
[-- Attachment #1.1: Type: text/plain, Size: 1960 bytes --]
On Thu, 12 Nov 2015 14:05:31 +0100
ludo@gnu.org (Ludovic Courtès) wrote:
> Efraim Flashner <efraim@flashner.co.il> skribis:
>
> >> In the end rebuilding c-ares with the release tarball and not the github
> >> tarball fixed the issues with aria2 not recognizing c-ares. I wasn't able to
> >> get anything more out of aria2, more than it not finding the locations and
> >> leaving me with with variables pointing to /path/to/dir and the like.
> >>
> >
> > here's the end of the log file:
> >
> > ##Failure Location unknown## : Error
> > Test name: N5aria224LpdMessageDispatcherTestE::testSendMessage
> > uncaught exception of type N5aria29DlAbortExE
> > - Failed to set a socket option, cause: No such device
>
> Could you check what this test does? The “No such device” is likely due
> to our build environment not corresponding to the assumptions made by
> the test wrt. available networking capabilities.
here's the failing line:
std::shared_ptr<SocketCore> recvsock(new SocketCore(SOCK_DGRAM));
new SocketCore(SOCK_DGRAM) occurs only in LpdMessage{Dispatcher,Reciever}Test.cc and in SocketCoreTest.cc
> > LpdMessageReceiverTest.cc:34:Assertion
> > Test name: N5aria222LpdMessageReceiverTestE::testReceiveMessage
> > assertion failed
> > - Expression: rcv.init("")
>
> And this one is likely related to the one above.
Looking at LpdMessageReceiver.h, I'm not sure that this is connected to the other failed test, or really why it failed. Or maybe it was supposed to fail for not passing an address, or it was supposed to be commented out since the line before it was created with an address and port.
> TIA,
> Ludo’.
I'll keep staring at it, and hopefully it'll make sense soon :)
--
Efraim Flashner <efraim@flashner.co.il> אפרים פלשנר
GPG key = A28B F40C 3E55 1372 662D 14F7 41AA E7DC CA3D 8351
Confidentiality cannot be guaranteed on emails sent or received unencrypted
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: LpdMessageDispatcherTest.cc --]
[-- Type: text/x-c++src, Size: 2603 bytes --]
#include "LpdMessageDispatcher.h"
#include <cstring>
#include <sstream>
#include <cppunit/extensions/HelperMacros.h>
#include "TestUtil.h"
#include "Exception.h"
#include "util.h"
#include "LpdMessageDispatcher.h"
#include "SocketCore.h"
#include "BtConstants.h"
namespace aria2 {
class LpdMessageDispatcherTest:public CppUnit::TestFixture {
CPPUNIT_TEST_SUITE(LpdMessageDispatcherTest);
CPPUNIT_TEST(testCreateLpdRequest);
CPPUNIT_TEST(testSendMessage);
CPPUNIT_TEST_SUITE_END();
public:
void testCreateLpdRequest();
void testSendMessage();
};
CPPUNIT_TEST_SUITE_REGISTRATION(LpdMessageDispatcherTest);
void LpdMessageDispatcherTest::testCreateLpdRequest()
{
std::string infoHashString = "cd41c7fdddfd034a15a04d7ff881216e01c4ceaf";
CPPUNIT_ASSERT_EQUAL
(std::string("BT-SEARCH * HTTP/1.1\r\n"
"Host: 239.192.152.143:6771\r\n"
"Port: 6000\r\n"
"Infohash: cd41c7fdddfd034a15a04d7ff881216e01c4ceaf\r\n"
"\r\n\r\n"),
bittorrent::createLpdRequest("239.192.152.143", 6771,
fromHex(infoHashString), 6000));
}
void LpdMessageDispatcherTest::testSendMessage()
{
std::shared_ptr<SocketCore> recvsock(new SocketCore(SOCK_DGRAM));
#ifdef __MINGW32__
recvsock->bindWithFamily(LPD_MULTICAST_PORT, AF_INET);
#else // !__MINGW32__
recvsock->bind(LPD_MULTICAST_ADDR, LPD_MULTICAST_PORT, AF_INET);
#endif // !__MINGW32__
recvsock->joinMulticastGroup(LPD_MULTICAST_ADDR, LPD_MULTICAST_PORT, "");
recvsock->setNonBlockingMode();
LpdMessageDispatcher d("cd41c7fdddfd034a15a04d7ff881216e01c4ceaf", 6000,
LPD_MULTICAST_ADDR, LPD_MULTICAST_PORT);
d.init("", 0, 1);
CPPUNIT_ASSERT(d.sendMessage());
unsigned char buf[200];
std::pair<std::string, uint16_t> peer;
ssize_t nbytes;
int trycnt;
for(trycnt = 0; trycnt < 5; ++trycnt) {
nbytes = recvsock->readDataFrom(buf, sizeof(buf), peer);
if(nbytes == 0) {
util::sleep(1);
} else {
break;
}
}
if(trycnt == 5) {
CPPUNIT_FAIL("[TIMEOUT] No Multicast packet received.");
}
buf[nbytes] = '\0';
std::stringstream temp;
temp << "BT-SEARCH * HTTP/1.1\r\n"
<< "Host: " << LPD_MULTICAST_ADDR << ":" << LPD_MULTICAST_PORT << "\r\n"
<< "Port: " << d.getPort() << "\r\n"
<< "Infohash: " << util::toHex(d.getInfoHash()) << "\r\n"
<< "\r\n\r\n";
CPPUNIT_ASSERT_EQUAL(temp.str(), std::string(&buf[0], &buf[nbytes]));
}
} // namespace aria2
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.3: LpdMessageReceiverTest.cc --]
[-- Type: text/x-c++src, Size: 2758 bytes --]
#include "LpdMessageReceiver.h"
#include <cstring>
#include <cppunit/extensions/HelperMacros.h>
#include "TestUtil.h"
#include "Exception.h"
#include "util.h"
#include "LpdMessageReceiver.h"
#include "SocketCore.h"
#include "BtConstants.h"
#include "LpdMessage.h"
#include "LpdMessageDispatcher.h"
#include "Peer.h"
namespace aria2 {
class LpdMessageReceiverTest:public CppUnit::TestFixture {
CPPUNIT_TEST_SUITE(LpdMessageReceiverTest);
CPPUNIT_TEST(testReceiveMessage);
CPPUNIT_TEST_SUITE_END();
public:
void testReceiveMessage();
};
CPPUNIT_TEST_SUITE_REGISTRATION(LpdMessageReceiverTest);
void LpdMessageReceiverTest::testReceiveMessage()
{
LpdMessageReceiver rcv(LPD_MULTICAST_ADDR, LPD_MULTICAST_PORT);
CPPUNIT_ASSERT(rcv.init(""));
std::shared_ptr<SocketCore> sendsock(new SocketCore(SOCK_DGRAM));
sendsock->create(AF_INET);
// Mingw32 build needs to set interface explicitly.
sendsock->setMulticastInterface("");
sendsock->setMulticastTtl(0);
std::string infoHashString = "cd41c7fdddfd034a15a04d7ff881216e01c4ceaf";
std::string infoHash = fromHex(infoHashString);
std::string request =
bittorrent::createLpdRequest(LPD_MULTICAST_ADDR, LPD_MULTICAST_PORT,
infoHash,
6000);
sendsock->writeData(request.c_str(), request.size(),
LPD_MULTICAST_ADDR, LPD_MULTICAST_PORT);
rcv.getSocket()->isReadable(5);
auto msg = rcv.receiveMessage();
CPPUNIT_ASSERT(msg);
CPPUNIT_ASSERT_EQUAL(std::string("cd41c7fdddfd034a15a04d7ff881216e01c4ceaf"),
util::toHex(msg->infoHash));
CPPUNIT_ASSERT_EQUAL((uint16_t)6000, msg->peer->getPort());
// Bad infohash
std::string badInfoHashString = "cd41c7fdddfd034a15a04d7ff881216e01c4ce";
request =
bittorrent::createLpdRequest(LPD_MULTICAST_ADDR, LPD_MULTICAST_PORT,
fromHex(badInfoHashString),
6000);
sendsock->writeData(request.c_str(), request.size(),
LPD_MULTICAST_ADDR, LPD_MULTICAST_PORT);
rcv.getSocket()->isReadable(5);
msg = rcv.receiveMessage();
CPPUNIT_ASSERT(!msg);
// Bad port
request =
bittorrent::createLpdRequest(LPD_MULTICAST_ADDR, LPD_MULTICAST_PORT,
infoHash,
0);
sendsock->writeData(request.c_str(), request.size(),
LPD_MULTICAST_ADDR, LPD_MULTICAST_PORT);
rcv.getSocket()->isReadable(5);
msg = rcv.receiveMessage();
CPPUNIT_ASSERT(!msg);
// No data available
msg = rcv.receiveMessage();
CPPUNIT_ASSERT(!msg);
}
} // namespace aria2
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.4: LpdMessageReceiver.h --]
[-- Type: text/x-chdr, Size: 2723 bytes --]
/*
* aria2 - The high speed download utility
*
* Copyright (C) 2010 Tatsuhiro Tsujikawa
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* In addition, as a special exception, the copyright holders give
* permission to link the code of portions of this program with the
* OpenSSL library under certain conditions as described in each
* individual source file, and distribute linked combinations
* including the two.
* You must obey the GNU General Public License in all respects
* for all of the code used other than OpenSSL. If you modify
* file(s) with this exception, you may extend this exception to your
* version of the file(s), but you are not obligated to do so. If you
* do not wish to do so, delete this exception statement from your
* version. If you delete this exception statement from all source
* files in the program, then also delete it here.
*/
#ifndef D_LPD_MESSAGE_RECEIVER_H
#define D_LPD_MESSAGE_RECEIVER_H
#include "common.h"
#include <string>
#include <memory>
namespace aria2 {
class SocketCore;
struct LpdMessage;
class LpdMessageReceiver {
private:
std::shared_ptr<SocketCore> socket_;
std::string multicastAddress_;
uint16_t multicastPort_;
std::string localAddress_;
public:
// Currently only IPv4 multicastAddresses are supported.
LpdMessageReceiver
(const std::string& multicastAddress, uint16_t multicastPort);
~LpdMessageReceiver();
// No throw.
bool init(const std::string& localAddr);
// Receives LPD message and returns LpdMessage which contains
// sender(peer) and infohash. If no data is available on socket,
// returns std::shared_ptr<LpdMessage>(). If received data is bad,
// they are just skipped.
std::unique_ptr<LpdMessage> receiveMessage();
const std::shared_ptr<SocketCore>& getSocket() const
{
return socket_;
}
const std::string& getLocalAddress() const
{
return localAddress_;
}
};
} // namespace aria2
#endif // D_LPD_MESSAGE_RECEIVER_H
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
next prev parent reply other threads:[~2015-11-12 17:38 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-02 7:15 [PATCH 0/3] add c-ares and aria2 Efraim Flashner
2015-11-02 7:15 ` [PATCH 1/3] gnu: Add c-ares Efraim Flashner
2015-11-03 13:42 ` Ludovic Courtès
2015-11-02 7:15 ` [PATCH 2/3] gnu: Add aria2 Efraim Flashner
2015-11-02 7:15 ` [PATCH 3/3] gnu: aria2: Build with c-ares Efraim Flashner
2015-11-02 7:17 ` [PATCH 0/3] add c-ares and aria2 Efraim Flashner
2015-11-03 13:35 ` Ludovic Courtès
2015-11-05 9:19 ` Efraim Flashner
2015-11-08 13:33 ` Efraim Flashner
2015-11-12 13:05 ` Ludovic Courtès
2015-11-12 17:38 ` Efraim Flashner [this message]
2015-11-12 20:33 ` Ludovic Courtès
2015-11-12 13:07 ` Ludovic Courtès
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20151112193844.7a3479ae@debian-netbook \
--to=efraim@flashner.co.il \
--cc=guix-devel@gnu.org \
--cc=ludo@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/guix.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.