~ubuntu-branches/ubuntu/trusty/wvstreams/trusty

« back to all changes in this revision

Viewing changes to urlget/wvhttppool.cc

  • Committer: Bazaar Package Importer
  • Author(s): Peter Eisentraut
  • Date: 2008-04-05 14:47:52 UTC
  • mfrom: (0.1.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20080405144752-gka8v86xuo52fmto
Tags: 4.4.1-0.2
* Non-maintainer upload.
* Fixed dependency information LSB header in init.d script
  (closes: #470067)

Show diffs side-by-side

added added

removed removed

Lines of Context:
98
98
 
99
99
 
100
100
WvHttpPool::WvHttpPool() 
101
 
    : log("HTTP Pool", WvLog::Debug), conns(10), pipeline_incompatible(50)
 
101
    : log("HTTP Pool", WvLog::Debug), conns(10),
 
102
      pipeline_incompatible(50)
102
103
{
103
104
    log("Pool initializing.\n");
104
105
    num_streams_created = 0;
119
120
}
120
121
 
121
122
 
122
 
bool WvHttpPool::pre_select(SelectInfo &si)
 
123
void WvHttpPool::pre_select(SelectInfo &si)
 
124
{
 
125
    //    log(WvLog::Debug5, "pre_select: main:%s conns:%s urls:%s\n",
 
126
    //         count(), conns.count(), urls.count());
 
127
 
 
128
    WvIStreamList::pre_select(si);
 
129
 
 
130
    WvUrlStreamDict::Iter ci(conns);
 
131
    for (ci.rewind(); ci.next(); )
 
132
    {
 
133
        if (!ci->isok())
 
134
            si.msec_timeout = 0;
 
135
    }
 
136
    
 
137
    WvUrlRequestList::Iter i(urls);
 
138
    for (i.rewind(); i.next(); )
 
139
    {
 
140
        if (!i->instream)
 
141
        {
 
142
            log(WvLog::Debug4, "Checking dns for '%s'\n", i->url.gethost());
 
143
            if (i->url.resolve())
 
144
                si.msec_timeout = 0;
 
145
            else
 
146
                dns.pre_select(i->url.gethost(), si);    
 
147
        }
 
148
    }
 
149
}
 
150
 
 
151
 
 
152
bool WvHttpPool::post_select(SelectInfo &si)
123
153
{
124
154
    bool sure = false;
125
155
 
126
156
    WvUrlStreamDict::Iter ci(conns);
127
157
    for (ci.rewind(); ci.next(); )
128
158
    {
129
 
        //      if (!ci->isok() || urls.isempty())
130
159
        if (!ci->isok())
131
160
        {
 
161
            log(WvLog::Debug4, "Selecting true because of a dead stream.\n");
132
162
            unconnect(ci.ptr());
133
163
            ci.rewind();
134
 
            log(WvLog::Debug3, "Selecting true because of a dead stream.\n");
135
164
            sure = true;
136
165
        }
137
166
    }
138
167
 
139
 
    //    log(WvLog::Debug5, "pre_select: main:%s conns:%s urls:%s\n",
140
 
    //         count(), conns.count(), urls.count());
141
 
 
142
168
    WvUrlRequestList::Iter i(urls);
143
169
    for (i.rewind(); i.next(); )
144
170
    {
163
189
        if (!i->instream)
164
190
        {
165
191
            log(WvLog::Debug4, "Checking dns for '%s'\n", i->url.gethost());
166
 
            if (i->url.resolve() || dns.pre_select(i->url.gethost(), si))
 
192
            if (i->url.resolve() || dns.post_select(i->url.gethost(), si))
167
193
            {
168
194
                log(WvLog::Debug4, "Selecting true because of '%s'\n", i->url);
169
195
                sure = true;
171
197
        }
172
198
    }
173
199
 
174
 
    if (WvIStreamList::pre_select(si))
175
 
    {
176
 
        //log("Selecting true because of list members.\n");
177
 
        sure = true;
178
 
    }
179
 
 
180
 
    return sure;
 
200
    return WvIStreamList::post_select(si) || sure;
181
201
}
182
202
 
183
203