~ubuntu-branches/ubuntu/quantal/aria2/quantal

« back to all changes in this revision

Viewing changes to src/PeerListenCommand.cc

  • Committer: Package Import Robot
  • Author(s): Kartik Mistry
  • Date: 2011-11-08 20:25:08 UTC
  • mfrom: (2.5.7 sid)
  • Revision ID: package-import@ubuntu.com-20111108202508-scfph8rj6tz0cckk
Tags: 1.13.0-1
* New upstream version:
  + Depends on libgcrypt11 (>= 1.5.0-3) (Closes: #642989)

Show diffs side-by-side

added added

removed removed

Lines of Context:
70
70
  std::vector<int32_t> randPorts = seq.flush();
71
71
  std::random_shuffle(randPorts.begin(), randPorts.end(),
72
72
                      *SimpleRandomizer::getInstance().get());
73
 
  
 
73
  const int ipv = (family_ == AF_INET) ? 4 : 6;
74
74
  for(std::vector<int32_t>::const_iterator portItr = randPorts.begin(),
75
75
        eoi = randPorts.end(); portItr != eoi; ++portItr) {
76
76
    if(!(0 < (*portItr) && (*portItr) <= 65535)) {
81
81
      socket_->bind(A2STR::NIL, port, family_);
82
82
      socket_->beginListen();
83
83
      socket_->setNonBlockingMode();
84
 
      A2_LOG_NOTICE(fmt("IPv%d BitTorrent: listening to port %d",
85
 
                        family_ == AF_INET?4:6, port));
 
84
      A2_LOG_NOTICE(fmt("IPv%d BitTorrent: listening to port %u", ipv, port));
86
85
      return true;
87
86
    } catch(RecoverableException& ex) {
88
 
      A2_LOG_ERROR(fmt("Failed to setup IPv%d BitTorrent server socket",
89
 
                       family_ == AF_INET?4:6));
90
 
      A2_LOG_ERROR_EX(fmt(MSG_BIND_FAILURE,
91
 
                          getCuid(), port),
92
 
                      ex);
 
87
      A2_LOG_ERROR_EX(fmt("IPv%d BitTorrent: failed to bind port %u",
 
88
                          ipv, port), ex);
93
89
      socket_->closeConnection();
94
90
    }
95
91
  }