~ubuntu-branches/debian/experimental/nzbget/experimental

« back to all changes in this revision

Viewing changes to ServerPool.h

  • Committer: Package Import Robot
  • Author(s): Andreas Moog
  • Date: 2013-07-18 14:50:28 UTC
  • mfrom: (1.1.1)
  • Revision ID: package-import@ubuntu.com-20130718145028-qhxse81w1sj5w424
Tags: 11.0+dfsg-1
* New upstream release (Closes: #701896)
* Repackage original tarball to remove copies of jquery and twitter-
  bootstrap
* debian/watch: Update for new versioning scheme
* debian/patches: Remove all old patches, add one patch:
  - dont-embed-libraries.patch: Don't install embedded jquery and bootstrap 
    libraries
* debian/combat: Upgrade to debhelper combat 9
* debian/control:
  - Fix Vcs-Git field
  - Adjust debhelper version for combat level 9
  - Add jquery and bootstrap to depends for integrated webserver
  - Add python to recommends for post-processing scripts
  - Bump build-depends on libpar2-dev to support the cancel function
* debian/links:
  - Use the system jquery and bootstrap libraries
* debian/rules:
  - Add get-orig-source target to build modified upstream tarball
* Adjust sample nzbget.conf:
  - Only listen to 127.0.0.1 instead of 0.0.0.0
  - Use nzbget.conf as template for webui configuration
* Adjust sample nzbgetd init file:
  - Point to correct location of nzbget binary

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
 *  This file is part of nzbget
3
3
 *
4
4
 *  Copyright (C) 2004 Sven Henkel <sidddy@users.sourceforge.net>
5
 
 *  Copyright (C) 2007-2009 Andrei Prygounkov <hugbug@users.sourceforge.net>
 
5
 *  Copyright (C) 2007-2009 Andrey Prygunkov <hugbug@users.sourceforge.net>
6
6
 *
7
7
 *  This program is free software; you can redistribute it and/or modify
8
8
 *  it under the terms of the GNU General Public License as published by
18
18
 *  along with this program; if not, write to the Free Software
19
19
 *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
20
20
 *
21
 
 * $Revision: 323 $
22
 
 * $Date: 2009-05-27 23:09:08 +0200 (Wed, 27 May 2009) $
 
21
 * $Revision: 599 $
 
22
 * $Date: 2013-03-14 23:30:59 +0100 (Thu, 14 Mar 2013) $
23
23
 *
24
24
 */
25
25
 
36
36
 
37
37
class ServerPool
38
38
{
 
39
public:
 
40
        typedef std::vector<NewsServer*>                Servers;
 
41
 
39
42
private:
40
43
        class PooledConnection : public NNTPConnection
41
44
        {
50
53
                void                    SetFreeTimeNow() { m_tFreeTime = ::time(NULL); }
51
54
        };
52
55
 
53
 
        typedef std::vector<NewsServer*>                Servers;
54
56
        typedef std::vector<int>                                Levels;
55
57
        typedef std::vector<PooledConnection*>  Connections;
56
58
 
61
63
        Mutex                           m_mutexConnections;
62
64
        int                                     m_iTimeout;
63
65
 
 
66
        void                            NormalizeLevels();
 
67
        static bool                     CompareServers(NewsServer* pServer1, NewsServer* pServer2);
 
68
 
64
69
public:
65
70
                                                ServerPool();
66
71
                                                ~ServerPool();
68
73
        void                            AddServer(NewsServer* pNewsServer);
69
74
        void                            InitConnections();
70
75
        int                                     GetMaxLevel() { return m_iMaxLevel; }
71
 
        NNTPConnection*         GetConnection(int iLevel);
 
76
        Servers*                        GetServers() { return &m_Servers; } // Only for read access (no lockings)
 
77
        NNTPConnection*         GetConnection(int iLevel, NewsServer* pWantServer, Servers* pIgnoreServers);
72
78
        void                            FreeConnection(NNTPConnection* pConnection, bool bUsed);
73
79
        void                            CloseUnusedConnections();
74
80