From 175518d2481afbaa8e9013a520eae2e5c4b41ebe Mon Sep 17 00:00:00 2001 From: Raj Bhattacharjea Date: Thu, 13 Mar 2008 14:22:26 -0400 Subject: [PATCH] Undo changes to the packet sink to accept incoming connections; change the default behavior of the socket connection request notifier instead --- src/applications/packet-sink/packet-sink.cc | 9 ++------- src/applications/packet-sink/packet-sink.h | 1 - src/node/socket.cc | 7 +++++-- 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/src/applications/packet-sink/packet-sink.cc b/src/applications/packet-sink/packet-sink.cc index b7f03c820..c97bd8596 100644 --- a/src/applications/packet-sink/packet-sink.cc +++ b/src/applications/packet-sink/packet-sink.cc @@ -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, const Address &> (), MakeNullCallback, 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->Close (); } -bool PacketSink::AcceptConnectionRequest (Ptr socket, const Address &from) -{ - return true; -} - Ptr PacketSink::GetTraceResolver (void) const { diff --git a/src/applications/packet-sink/packet-sink.h b/src/applications/packet-sink/packet-sink.h index 55a8708bd..844effcba 100644 --- a/src/applications/packet-sink/packet-sink.h +++ b/src/applications/packet-sink/packet-sink.h @@ -79,7 +79,6 @@ private: virtual void Receive (Ptr socket, Ptr packet, const Address& from); virtual void CloseConnection (Ptr socket); - virtual bool AcceptConnectionRequest (Ptr socket, const Address &from); Ptr m_socket; // Associated socket Address m_local; // Local address to bind to diff --git a/src/node/socket.cc b/src/node/socket.cc index 99e61b831..b909aa1e2 100644 --- a/src/node/socket.cc +++ b/src/node/socket.cc @@ -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; } }