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:
@@ -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
|
||||
{
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user