|
Bugzilla – Full Text Bug Listing |
| Summary: | SetConnectCallback is not called when connection failed? | ||
|---|---|---|---|
| Product: | ns-3 | Reporter: | susie <sumajing> |
| Component: | internet | Assignee: | Adrian S.-W. Tam <adrian.sw.tam> |
| Status: | RESOLVED FIXED | ||
| Severity: | normal | CC: | tomh |
| Priority: | P5 | ||
| Version: | ns-3.9 | ||
| Hardware: | All | ||
| OS: | Linux | ||
Then I add " NotifyConnectionFailed (); " to the function ,then it seems correct.
case APP_NOTIFY:
NS_LOG_LOGIC ("TcpSocketImpl " << this <<" Action APP_NOTIFY");
NotifyConnectionFailed (); //added by susie
break;
Shall I do this?
Need to confirm this is still a bug. The original bug report was spotting the fact that TcpSocketImpl did not call the Callback function upon failure. This is no longer valid in the TcpSocketBase implementation, and the callback is invoked in TcpSocketBase::DoRetransmit() when connection retries are used up. Thus this bug is closed. |
I'm writing a BitTorrent application, but I find the callback SetConnectCallback's connectionFailed function is not called when the destination address and port doesn't exist. I try to use the return value if Connect function to decide whether connection success, but it doesn't work. My code is: Ptr<Socket> peer_socket = Socket::CreateSocket (local,TcpSocketFactory::GetTypeId ()); peer_socket->Connect(InetSocketAddress( remotePeer->m_ip, remotePeer->m_port )); peer_socket->SetConnectCallback(MakeCallback(&Peer::PeerConnectionSucceeded,this) , MakeCallback(&Peer::PeerConnectionFailed, this)); And I read ns-3.9/src/internet-stack/tcp-socket-impl.cc , I find bool TcpSocketImpl::ProcessAction (Actions_t a) case APP_NOTIFY: NS_LOG_LOGIC ("TcpSocketImpl " << this <<" Action APP_NOTIFY"); break; Does tcp-socket-impl.cc do nothing when connect failed ? or is there something wrong with my code? Thanks for your help!