From mboxrd@z Thu Jan 1 00:00:00 1970 From: Efraim Flashner Subject: Re: [PATCH 0/3] add c-ares and aria2 Date: Thu, 12 Nov 2015 19:38:44 +0200 Message-ID: <20151112193844.7a3479ae@debian-netbook> References: <1446448523-27811-1-git-send-email-efraim@flashner.co.il> <87d1vryzn8.fsf@gnu.org> <20151105111953.19ef0e99@debian-netbook> <20151108153324.096b077d@debian-netbook> <87egfvxt9g.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; boundary="Sig_/5hf6lpLRECgNP4aUE_DsqcR"; protocol="application/pgp-signature" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:52275) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zwvpp-0001eE-R2 for guix-devel@gnu.org; Thu, 12 Nov 2015 12:38:59 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zwvpm-0002fE-Hw for guix-devel@gnu.org; Thu, 12 Nov 2015 12:38:57 -0500 In-Reply-To: <87egfvxt9g.fsf@gnu.org> List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org To: Ludovic =?UTF-8?B?Q291cnTDqHM=?= Cc: guix-devel@gnu.org --Sig_/5hf6lpLRECgNP4aUE_DsqcR Content-Type: multipart/mixed; boundary="MP_/zxBNihbURaLwTGfVjeG_5i=" --MP_/zxBNihbURaLwTGfVjeG_5i= Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline On Thu, 12 Nov 2015 14:05:31 +0100 ludo@gnu.org (Ludovic Court=C3=A8s) wrote: > Efraim Flashner skribis: >=20 > >> In the end rebuilding c-ares with the release tarball and not the gith= ub > >> tarball fixed the issues with aria2 not recognizing c-ares. I wasn't a= ble 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. > >> =20 > > > > 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 =20 >=20 > Could you check what this test does? The =E2=80=9CNo such device=E2=80= =9D 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 recvsock(new SocketCore(SOCK_DGRAM)); new SocketCore(SOCK_DGRAM) occurs only in LpdMessage{Dispatcher,Reciever}Te= st.cc and in SocketCoreTest.cc > > LpdMessageReceiverTest.cc:34:Assertion > > Test name: N5aria222LpdMessageReceiverTestE::testReceiveMessage > > assertion failed > > - Expression: rcv.init("") =20 >=20 > 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 fa= il 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=E2=80=99. I'll keep staring at it, and hopefully it'll make sense soon :) --=20 Efraim Flashner =D7=90=D7=A4=D7=A8=D7=99=D7=9D = =D7=A4=D7=9C=D7=A9=D7=A0=D7=A8 GPG key =3D A28B F40C 3E55 1372 662D 14F7 41AA E7DC CA3D 8351 Confidentiality cannot be guaranteed on emails sent or received unencrypted --MP_/zxBNihbURaLwTGfVjeG_5i= Content-Type: text/x-c++src Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename=LpdMessageDispatcherTest.cc #include "LpdMessageDispatcher.h" #include #include #include #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 =3D "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 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 peer; ssize_t nbytes; int trycnt; for(trycnt =3D 0; trycnt < 5; ++trycnt) { nbytes =3D recvsock->readDataFrom(buf, sizeof(buf), peer); if(nbytes =3D=3D 0) { util::sleep(1); } else { break; } } if(trycnt =3D=3D 5) { CPPUNIT_FAIL("[TIMEOUT] No Multicast packet received."); } buf[nbytes] =3D '\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 --MP_/zxBNihbURaLwTGfVjeG_5i= Content-Type: text/x-c++src Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename=LpdMessageReceiverTest.cc #include "LpdMessageReceiver.h" #include #include #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 sendsock(new SocketCore(SOCK_DGRAM)); sendsock->create(AF_INET); // Mingw32 build needs to set interface explicitly. sendsock->setMulticastInterface(""); sendsock->setMulticastTtl(0); std::string infoHashString =3D "cd41c7fdddfd034a15a04d7ff881216e01c4ceaf"; std::string infoHash =3D fromHex(infoHashString); std::string request =3D 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 =3D rcv.receiveMessage(); CPPUNIT_ASSERT(msg); CPPUNIT_ASSERT_EQUAL(std::string("cd41c7fdddfd034a15a04d7ff881216e01c4cea= f"), util::toHex(msg->infoHash)); CPPUNIT_ASSERT_EQUAL((uint16_t)6000, msg->peer->getPort()); // Bad infohash std::string badInfoHashString =3D "cd41c7fdddfd034a15a04d7ff881216e01c4ce= "; request =3D 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 =3D rcv.receiveMessage(); CPPUNIT_ASSERT(!msg); // Bad port request =3D 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 =3D rcv.receiveMessage(); CPPUNIT_ASSERT(!msg); // No data available msg =3D rcv.receiveMessage(); CPPUNIT_ASSERT(!msg); } } // namespace aria2 --MP_/zxBNihbURaLwTGfVjeG_5i= Content-Type: text/x-chdr Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename=LpdMessageReceiver.h /* * 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 #include namespace aria2 { class SocketCore; struct LpdMessage; class LpdMessageReceiver { private: std::shared_ptr 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(). If received data is bad, // they are just skipped. std::unique_ptr receiveMessage(); const std::shared_ptr& getSocket() const { return socket_; } const std::string& getLocalAddress() const { return localAddress_; } }; } // namespace aria2 #endif // D_LPD_MESSAGE_RECEIVER_H --MP_/zxBNihbURaLwTGfVjeG_5i=-- --Sig_/5hf6lpLRECgNP4aUE_DsqcR Content-Type: application/pgp-signature Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCgAGBQJWRM6kAAoJEPTB05F+rO6TL+EP/2xx8Wr0ltqpATy+hcuAxiay Xzwcg3B9NXkLhPqphV8ILrCY8jw49+PmXeCiS7xi9QeEnfIxUM8x7nyqO29V6cti /Q8GY7Ln+8ULrEo0Xp80aBQUAYII8pGjrVjBu23sH5WAOl1AmXxuzyEMc6Ns8dY9 951pxHALN4DKvNMb2Y8Uf1N1AxnTKW3f/KQLOGYlKWrrdddEbwQIAlpT37FfiSx4 KBeeTGkAFuwYGiZMnELa6tObFTnAIDR7TRX2dz7mX8jeAboMPdI+Rds7h6bYcKdr CpGehFWN3w2H7O8EbveVaTaPSuJMGMPciRKUl74ZZggm2jhnpopb4DKdTjDXYUIY Qt9TdfyE9QF50BwAicdIlbjHrYe/gLZOC3P8aYY7mH7WcRtiaDUePnG2Ku1s3z2i AWwR3cXk3BoxyR3rf1UPagCSASM9MWFdXjXhDumAz4xw2TqNVSvamUaGxnopjG9i 6meF1r5Dg4Fnfi7gWuLPcqbV+MDCAkIWSW5HwrwhJ6xqSNa+tYnS+Q9TXRpkpWU5 DCc6zeUlIm17eZQAw5w87+TSQ1V5zEVz8KK+V4tOxMRp25xLmLN67G/e35hm3/XY nu51YU3e+UJSjCy8y0T7GgJpoTQlUq6aJy262AxS07Im4cywlbZai94NBhAXN7D2 FleXzBFij/fdI/mlkp+z =+OQJ -----END PGP SIGNATURE----- --Sig_/5hf6lpLRECgNP4aUE_DsqcR--