~ubuntu-branches/ubuntu/oneiric/libtorrent-rasterbar/oneiric

« back to all changes in this revision

Viewing changes to src/http_connection.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Andrew Starr-Bochicchio
  • Date: 2010-08-10 12:57:25 UTC
  • mfrom: (1.3.8 upstream)
  • Revision ID: james.westby@ubuntu.com-20100810125725-i2o9iblow20w7qde
Tags: 0.15.1-0ubuntu1
* New upstream point release.

* New package libtorrent-rasterbar6 (bump up library soname). (LP: #615950)
 - Must Conflict/Replace libtorrent-rasterbar5 (= 0.15.0-0ubuntu1) or it will
   fail to install trying to overwrite '/usr/lib/libtorrent-rasterbar.so.6.0.0'

* Sync on git.debian.org/collab-maint/libtorrent-rasterbar.git:
 - debian/{control,rules}: Bump debhelper build-dep to (>= 7.4.10)
   and pass to dh in order to enable parallel build support.
 - debian/watch: Use googlecode.debian.net redirector.

Show diffs side-by-side

added added

removed removed

Lines of Context:
42
42
#include <string>
43
43
#include <algorithm>
44
44
 
45
 
using boost::bind;
46
 
 
47
45
namespace libtorrent {
48
46
 
49
47
enum { max_bottled_buffer = 1024 * 1024 };
151
149
        m_timeout = timeout;
152
150
        error_code ec;
153
151
        m_timer.expires_from_now(m_timeout, ec);
154
 
        m_timer.async_wait(bind(&http_connection::on_timeout
 
152
        m_timer.async_wait(boost::bind(&http_connection::on_timeout
155
153
                , boost::weak_ptr<http_connection>(shared_from_this()), _1));
156
154
        m_called = false;
157
155
        m_parser.reset();
174
172
                && m_ssl == ssl && m_bind_addr == bind_addr)
175
173
        {
176
174
                async_write(m_sock, asio::buffer(sendbuffer)
177
 
                        , bind(&http_connection::on_write, shared_from_this(), _1));
 
175
                        , boost::bind(&http_connection::on_write, shared_from_this(), _1));
178
176
        }
179
177
        else
180
178
        {
230
228
                }
231
229
 
232
230
                tcp::resolver::query query(hostname, port);
233
 
                m_resolver.async_resolve(query, bind(&http_connection::on_resolve
 
231
                m_resolver.async_resolve(query, boost::bind(&http_connection::on_resolve
234
232
                        , shared_from_this(), _1, _2));
235
233
                m_hostname = hostname;
236
234
                m_port = port;
273
271
                        error_code ec;
274
272
                        c->m_sock.close(ec);
275
273
                        c->m_timer.expires_at(c->m_last_receive + c->m_timeout, ec);
276
 
                        c->m_timer.async_wait(bind(&http_connection::on_timeout, p, _1));
 
274
                        c->m_timer.async_wait(boost::bind(&http_connection::on_timeout, p, _1));
277
275
                }
278
276
                else
279
277
                {
286
284
        if (!c->m_sock.is_open()) return;
287
285
        error_code ec;
288
286
        c->m_timer.expires_at(c->m_last_receive + c->m_timeout, ec);
289
 
        c->m_timer.async_wait(bind(&http_connection::on_timeout, p, _1));
 
287
        c->m_timer.async_wait(boost::bind(&http_connection::on_timeout, p, _1));
290
288
}
291
289
 
292
290
void http_connection::close()
347
345
        tcp::endpoint target = m_endpoints.front();
348
346
        m_endpoints.pop_front();
349
347
 
350
 
        m_cc.enqueue(bind(&http_connection::connect, shared_from_this(), _1, target)
351
 
                , bind(&http_connection::on_connect_timeout, shared_from_this())
 
348
        m_cc.enqueue(boost::bind(&http_connection::connect, shared_from_this(), _1, target)
 
349
                , boost::bind(&http_connection::on_connect_timeout, shared_from_this())
352
350
                , m_timeout, m_priority);
353
351
}
354
352
 
372
370
        { 
373
371
                if (m_connect_handler) m_connect_handler(*this);
374
372
                async_write(m_sock, asio::buffer(sendbuffer)
375
 
                        , bind(&http_connection::on_write, shared_from_this(), _1));
 
373
                        , boost::bind(&http_connection::on_write, shared_from_this(), _1));
376
374
        }
377
375
        else if (!m_endpoints.empty() && !m_abort)
378
376
        {
442
440
        }
443
441
        m_sock.async_read_some(asio::buffer(&m_recvbuffer[0] + m_read_pos
444
442
                , amount_to_read)
445
 
                , bind(&http_connection::on_read
446
 
                , shared_from_this(), _1, _2));
 
443
                , boost::bind(&http_connection::on_read
 
444
                        , shared_from_this(), _1, _2));
447
445
}
448
446
 
449
447
void http_connection::on_read(error_code const& e
594
592
        }
595
593
        m_sock.async_read_some(asio::buffer(&m_recvbuffer[0] + m_read_pos
596
594
                , amount_to_read)
597
 
                , bind(&http_connection::on_read
598
 
                , me, _1, _2));
 
595
                , boost::bind(&http_connection::on_read
 
596
                        , me, _1, _2));
599
597
}
600
598
 
601
599
void http_connection::on_assign_bandwidth(error_code const& e)
622
620
 
623
621
        m_sock.async_read_some(asio::buffer(&m_recvbuffer[0] + m_read_pos
624
622
                , amount_to_read)
625
 
                , bind(&http_connection::on_read
626
 
                , shared_from_this(), _1, _2));
 
623
                , boost::bind(&http_connection::on_read
 
624
                        , shared_from_this(), _1, _2));
627
625
 
628
626
        error_code ec;
629
627
        m_limiter_timer_active = true;
630
628
        m_limiter_timer.expires_from_now(milliseconds(250), ec);
631
 
        m_limiter_timer.async_wait(bind(&http_connection::on_assign_bandwidth
 
629
        m_limiter_timer.async_wait(boost::bind(&http_connection::on_assign_bandwidth
632
630
                , shared_from_this(), _1));
633
631
}
634
632
 
641
639
                error_code ec;
642
640
                m_limiter_timer_active = true;
643
641
                m_limiter_timer.expires_from_now(milliseconds(250), ec);
644
 
                m_limiter_timer.async_wait(bind(&http_connection::on_assign_bandwidth
 
642
                m_limiter_timer.async_wait(boost::bind(&http_connection::on_assign_bandwidth
645
643
                        , shared_from_this(), _1));
646
644
        }
647
645
        m_rate_limit = limit;