Undo changes to the packet sink to accept incoming connections; change the default behavior of the socket connection request notifier instead

This commit is contained in:
Raj Bhattacharjea
2008-03-13 14:22:26 -04:00
parent 4d6e41a185
commit 175518d248
3 changed files with 7 additions and 10 deletions

View File

@@ -83,9 +83,9 @@ void PacketSink::StartApplication() // Called at time specified by Start
m_socket->SetRecvCallback (MakeCallback(&PacketSink::Receive, this));
m_socket->SetAcceptCallback (
MakeCallback (&PacketSink::AcceptConnectionRequest, this),
MakeNullCallback<bool, Ptr<Socket>, const Address &> (),
MakeNullCallback<void, Ptr<Socket>, const Address&> (),
MakeCallback (&PacketSink::CloseConnection, this) );
MakeCallback(&PacketSink::CloseConnection, this) );
}
void PacketSink::StopApplication() // Called at time specified by Stop
@@ -116,11 +116,6 @@ void PacketSink::CloseConnection (Ptr<Socket> socket)
socket->Close ();
}
bool PacketSink::AcceptConnectionRequest (Ptr<Socket> socket, const Address &from)
{
return true;
}
Ptr<TraceResolver>
PacketSink::GetTraceResolver (void) const
{

View File

@@ -79,7 +79,6 @@ private:
virtual void Receive (Ptr<Socket> socket, Ptr<Packet> packet, const Address& from);
virtual void CloseConnection (Ptr<Socket> socket);
virtual bool AcceptConnectionRequest (Ptr<Socket> socket, const Address &from);
Ptr<Socket> m_socket; // Associated socket
Address m_local; // Local address to bind to

View File

@@ -164,8 +164,11 @@ Socket::NotifyConnectionRequest (const Address &from)
}
else
{
// refuse all incomming connections by default.
return false;
// accept all incoming connections by default.
// this way people writing code don't have to do anything
// special like register a callback that returns true
// just to get incoming connections
return true;
}
}