[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#259688: marked as done (libapt-pkg: make it possible to set select () timeout for pkgAcquire::Run)



Your message dated Tue, 22 Nov 2005 20:12:02 +0100
with message-id <20051122191202.GE8326@top.ping.de>
and subject line fixed in unstable
has caused the attached Bug report to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what I am
talking about this indicates a serious mail system misconfiguration
somewhere.  Please contact me immediately.)

Debian bug tracking system administrator
(administrator, Debian Bugs database)

--------------------------------------
Received: (at submit) by bugs.debian.org; 16 Jul 2004 07:02:26 +0000
>From mornfall@lorien.logisys.sk Fri Jul 16 00:02:26 2004
Return-path: <mornfall@lorien.logisys.sk>
Received: from (lorien.logisys.sk) [213.151.217.129] 
	by spohr.debian.org with esmtp (Exim 3.35 1 (Debian))
	id 1BlMjd-0004uZ-00; Fri, 16 Jul 2004 00:02:23 -0700
Received: by lorien.logisys.sk (Postfix, from userid 1000)
	id 474AF40EA60; Fri, 16 Jul 2004 08:51:14 +0200 (CEST)
Content-Type: multipart/mixed; boundary="===============0082958942=="
MIME-Version: 1.0
From: "Peter Rockai (mornfall)" <mornfall@danill.sk>
To: Debian Bug Tracking System <submit@bugs.debian.org>
Subject: libapt-pkg: make it possible to set select () timeout for pkgAcquire::Run
X-Mailer: reportbug 2.61
Date: Fri, 16 Jul 2004 08:51:13 +0200
Message-Id: <20040716065114.474AF40EA60@lorien.logisys.sk>
Delivered-To: submit@bugs.debian.org
X-Spam-Checker-Version: SpamAssassin 2.60-bugs.debian.org_2004_03_25 
	(1.212-2003-09-23-exp) on spohr.debian.org
X-Spam-Status: No, hits=-8.0 required=4.0 tests=BAYES_00,HAS_PACKAGE 
	autolearn=no version=2.60-bugs.debian.org_2004_03_25
X-Spam-Level: 

This is a multi-part MIME message sent by reportbug.

--===============0082958942==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

Package: apt
Version: 0.5.26
Severity: wishlist


Hello!

I am writing an libapt-pkg based frontend and i have ran into a slight
problem with pkgAcquire class. Because of the way i write it
(single-threaded), i need to get more pulses in my pkgAcquireStatus than
usual (about 5 - 10 a second).

One proposed solution is to add an optional parameter to Run (), with
a timeout to be used for select. An ABI-compatible patch is attached.
I somehow dislike this, as it's not the "right" solution for the given
problem...

The alternative solution would be to use the _config object to specify
the timeout and query it from within Run (), but i don't really like it.
On the other hand, this would allow the pkgAcquireStatus to change this
value instead of the caller of Run... Well, i'm not sure. A patch is
attached as well.

The best solution would be adding this timeout as a member variable, but
this is binary incompatible and thus probably infeasible right now.
(This way the pkgAcquireStatus would be able to set the Pulse interval,
which would be about ideal). I can make a patch if needed.

The preferred order is 3, 2, 1, but considering other factors, i think
#2 will be optimal for now. Other ways of fixing the problem would be
welcome though.

Thank you, yours,
    Peter

-- System Information:
Debian Release: testing/unstable
  APT prefers unstable
  APT policy: (500, 'unstable'), (500, 'testing'), (1, 'experimental')
Architecture: i386 (i686)
Kernel: Linux 2.6.6-1-686
Locale: LANG=sk_SK.UTF-8, LC_CTYPE=sk_SK.UTF-8

Versions of packages apt depends on:
ii  libc6                       2.3.2.ds1-13 GNU C Library: Shared libraries an
ii  libgcc1                     1:3.3.4-2    GCC support library
ii  libstdc++5                  1:3.3.4-2    The GNU Standard C++ Library v3

-- no debconf information

--===============0082958942==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="pass-usecs-to-run.diff"

diff -ruN apt-pkg.orig/acquire.cc apt-pkg/acquire.cc
--- apt-pkg.orig/acquire.cc	2004-03-17 06:17:11.000000000 +0100
+++ apt-pkg/acquire.cc	2004-07-16 08:06:50.000000000 +0200
@@ -314,6 +314,10 @@
    manage the actual fetch. */
 pkgAcquire::RunResult pkgAcquire::Run()
 {
+    return Run (500000);
+}
+pkgAcquire::RunResult pkgAcquire::Run(int pulseUsec)
+{
    Running = true;
    
    for (Queue *I = Queues; I != 0; I = I->Next)
@@ -327,7 +331,7 @@
    // Run till all things have been acquired
    struct timeval tv;
    tv.tv_sec = 0;
-   tv.tv_usec = 500000; 
+   tv.tv_usec = pulseUsec;
    while (ToFetch > 0)
    {
       fd_set RFds;
@@ -357,7 +361,7 @@
       // Timeout, notify the log class
       if (Res == 0 || (Log != 0 && Log->Update == true))
       {
-	 tv.tv_usec = 500000;
+	 tv.tv_usec = pulseUsec;
 	 for (Worker *I = Workers; I != 0; I = I->NextAcquire)
 	    I->Pulse();
 	 if (Log != 0 && Log->Pulse(this) == false)
diff -ruN apt-pkg.orig/acquire.h apt-pkg/acquire.h
--- apt-pkg.orig/acquire.h	2001-05-22 06:17:18.000000000 +0200
+++ apt-pkg/acquire.h	2004-07-16 08:04:27.000000000 +0200
@@ -101,6 +101,7 @@
    enum RunResult {Continue,Failed,Cancelled};
 
    RunResult Run();
+   RunResult Run(int PulseUsec);
    void Shutdown();
    
    // Simple iteration mechanism

--===============0082958942==
Content-Type: text/x-c; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="use-usec-from-config-in-run.diff"

diff -ruN apt-pkg.orig/acquire.cc apt-pkg/acquire.cc
--- apt-pkg.orig/acquire.cc	2004-03-17 06:17:11.000000000 +0100
+++ apt-pkg/acquire.cc	2004-07-16 08:40:34.000000000 +0200
@@ -22,6 +22,7 @@
 #include <apt-pkg/configuration.h>
 #include <apt-pkg/error.h>
 #include <apt-pkg/strutl.h>
+#include <apt-pkg/configuration.h>
 
 #include <apti18n.h>
 
@@ -327,7 +328,7 @@
    // Run till all things have been acquired
    struct timeval tv;
    tv.tv_sec = 0;
-   tv.tv_usec = 500000; 
+   long tv_usec = tv.tv_usec = _config->FindI("APT::Fetcher::Select-Timeout-Usec", 500000);
    while (ToFetch > 0)
    {
       fd_set RFds;
@@ -357,7 +358,7 @@
       // Timeout, notify the log class
       if (Res == 0 || (Log != 0 && Log->Update == true))
       {
-	 tv.tv_usec = 500000;
+	 tv.tv_usec = tv_usec;
 	 for (Worker *I = Workers; I != 0; I = I->NextAcquire)
 	    I->Pulse();
 	 if (Log != 0 && Log->Pulse(this) == false)

--===============0082958942==--

---------------------------------------
Received: (at 259688-done) by bugs.debian.org; 22 Nov 2005 19:13:01 +0000
>From sir.mvo@gmx.de Tue Nov 22 11:13:01 2005
Return-path: <sir.mvo@gmx.de>
Received: from mail.gmx.de ([213.165.64.20] helo=mail.gmx.net)
	by spohr.debian.org with smtp (Exim 4.50)
	id 1EedZc-0006JI-Pg
	for 259688-done@bugs.debian.org; Tue, 22 Nov 2005 11:13:01 -0800
Received: (qmail invoked by alias); 22 Nov 2005 19:12:29 -0000
Received: from ip181.135.1511I-CUD12K-01.ish.de (EHLO top.ping.de) [62.143.135.181]
  by mail.gmx.net (mp031) with SMTP; 22 Nov 2005 20:12:29 +0100
X-Authenticated: #18895133
Received: by top.ping.de (Postfix, from userid 1000)
	id 5E6C46F00B; Tue, 22 Nov 2005 20:12:02 +0100 (CET)
Date: Tue, 22 Nov 2005 20:12:02 +0100
From: Michael Vogt <mvogt@acm.org>
To: 259688-done@bugs.debian.org
Subject: fixed in unstable
Message-ID: <20051122191202.GE8326@top.ping.de>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
User-Agent: Mutt/1.5.9i
X-Y-GMX-Trusted: 0
X-Spam-Checker-Version: SpamAssassin 2.60-bugs.debian.org_2005_01_02 
	(1.212-2003-09-23-exp) on spohr.debian.org
X-Spam-Level: 
X-Spam-Status: No, hits=-2.5 required=4.0 tests=BAYES_00,RCVD_IN_SORBS 
	autolearn=no version=2.60-bugs.debian.org_2005_01_02

This bug is fixed in the current unstable version of apt (Run() has a
pulse-interval now).

-- 
Linux is not The Answer. Yes is the answer. Linux is The Question. - Neo



Reply to: