--- a/examples/tcp-large-transfer.cc Mon Jun 16 14:17:27 2008 +0100
+++ b/examples/tcp-large-transfer.cc Mon Jun 16 16:25:52 2008 -0700
@@ -87,7 +87,7 @@
// Users may find it convenient to turn on explicit debugging
// for selected modules; the below lines suggest how to do this
// LogComponentEnable("TcpL4Protocol", LOG_LEVEL_ALL);
- // LogComponentEnable("TcpSocket", LOG_LEVEL_ALL);
+ // LogComponentEnable("TcpSocketImpl", LOG_LEVEL_ALL);
// LogComponentEnable("PacketSink", LOG_LEVEL_ALL);
// LogComponentEnable("TcpLargeTransfer", LOG_LEVEL_ALL);
@@ -182,8 +182,7 @@
// NS_LOG_LOGIC("Starting flow at time " << Simulator::Now ().GetSeconds ());
localSocket->Connect (InetSocketAddress (servAddress, servPort));//connect
localSocket->SetConnectCallback (MakeCallback (&CloseConnection),
- Callback<void, Ptr<Socket> > (),
- Callback<void, Ptr<Socket> > ());
+ Callback<void, Ptr<Socket> > ());
//we want to close as soon as the connection is established
//the tcp state machine and outgoing buffer will assure that
//all of the data is delivered
--- a/src/applications/packet-sink/packet-sink.cc Mon Jun 16 14:17:27 2008 +0100
+++ b/src/applications/packet-sink/packet-sink.cc Mon Jun 16 16:25:52 2008 -0700
@@ -67,6 +67,10 @@
void
PacketSink::DoDispose (void)
{
+ if (m_socket != 0)
+ {
+ m_socket->Close ();
+ }
m_socket = 0;
// chain up
@@ -88,8 +92,7 @@
m_socket->SetRecvCallback (MakeCallback(&PacketSink::HandleRead, this));
m_socket->SetAcceptCallback (
MakeNullCallback<bool, Ptr<Socket>, const Address &> (),
- MakeNullCallback<void, Ptr<Socket>, const Address&> (),
- MakeCallback(&PacketSink::CloseConnection, this) );
+ MakeNullCallback<void, Ptr<Socket>, const Address&> ());
}
void PacketSink::StopApplication() // Called at time specified by Stop
@@ -117,9 +120,4 @@
}
}
-void PacketSink::CloseConnection (Ptr<Socket> socket)
-{
- socket->Close ();
-}
-
} // Namespace ns3
--- a/src/applications/packet-sink/packet-sink.h Mon Jun 16 14:17:27 2008 +0100
+++ b/src/applications/packet-sink/packet-sink.h Mon Jun 16 16:25:52 2008 -0700
@@ -80,9 +80,7 @@
virtual void StartApplication (void); // Called at time specified by Start
virtual void StopApplication (void); // Called at time specified by Stop
- virtual void HandleRead (Ptr<Socket> socket);
-
- virtual void CloseConnection (Ptr<Socket> socket);
+ void HandleRead (Ptr<Socket> socket);
Ptr<Socket> m_socket; // Associated socket
Address m_local; // Local address to bind to
--- a/src/internet-stack/tcp-socket-impl.cc Mon Jun 16 14:17:27 2008 +0100
+++ b/src/internet-stack/tcp-socket-impl.cc Mon Jun 16 16:25:52 2008 -0700
@@ -620,7 +620,6 @@
NS_LOG_LOGIC ("TcpSocketImpl " << this << " transition to CLOSED from "
<< m_state << " event " << e << " closeNot " << m_closeNotified
<< " action " << stateAction.action);
- NotifyCloseCompleted ();
m_closeNotified = true;
NS_LOG_LOGIC ("TcpSocketImpl " << this << " calling Closed from PE"
<< " origState " << saveState
@@ -854,7 +853,6 @@
{
NS_LOG_LOGIC ("TCP " << this
<< " calling AppCloseRequest");
- NotifyCloseRequested();
m_closeRequestNotified = true;
}
NS_LOG_LOGIC ("TcpSocketImpl " << this
@@ -1298,7 +1296,7 @@
}
if (!m_pendingData)
{
- if (m_state == FIN_WAIT_1 || m_state == FIN_WAIT_2)
+ if (m_state == FIN_WAIT_1)
{ // Must have lost FIN, re-send
SendEmptyPacket (TcpHeader::FIN);
}
--- a/src/internet-stack/udp-socket-impl.cc Mon Jun 16 14:17:27 2008 +0100
+++ b/src/internet-stack/udp-socket-impl.cc Mon Jun 16 16:25:52 2008 -0700
@@ -199,7 +199,6 @@
UdpSocketImpl::Close(void)
{
NS_LOG_FUNCTION_NOARGS ();
- NotifyCloseCompleted ();
return 0;
}
--- a/src/node/packet-socket.cc Mon Jun 16 14:17:27 2008 +0100
+++ b/src/node/packet-socket.cc Mon Jun 16 16:25:52 2008 -0700
@@ -184,7 +184,6 @@
return -1;
}
m_state = STATE_CLOSED;
- NotifyCloseCompleted ();
return 0;
}
--- a/src/node/socket.cc Mon Jun 16 14:17:27 2008 +0100
+++ b/src/node/socket.cc Mon Jun 16 16:25:52 2008 -0700
@@ -51,34 +51,23 @@
}
void
-Socket::SetCloseCallback (Callback<void,Ptr<Socket> > closeCompleted)
-{
- NS_LOG_FUNCTION_NOARGS ();
- m_closeCompleted = closeCompleted;
-}
-
-void
Socket::SetConnectCallback (
Callback<void, Ptr<Socket> > connectionSucceeded,
- Callback<void, Ptr<Socket> > connectionFailed,
- Callback<void, Ptr<Socket> > halfClose)
+ Callback<void, Ptr<Socket> > connectionFailed)
{
NS_LOG_FUNCTION_NOARGS ();
m_connectionSucceeded = connectionSucceeded;
m_connectionFailed = connectionFailed;
- m_halfClose = halfClose;
}
void
Socket::SetAcceptCallback (
Callback<bool, Ptr<Socket>, const Address &> connectionRequest,
- Callback<void, Ptr<Socket>, const Address&> newConnectionCreated,
- Callback<void, Ptr<Socket> > closeRequested)
+ Callback<void, Ptr<Socket>, const Address&> newConnectionCreated)
{
NS_LOG_FUNCTION_NOARGS ();
m_connectionRequest = connectionRequest;
m_newConnectionCreated = newConnectionCreated;
- m_closeRequested = closeRequested;
}
bool
@@ -110,15 +99,6 @@
return Send (p, 0);
}
-void
-Socket::NotifyCloseUnblocks (void)
-{
- NS_LOG_FUNCTION_NOARGS ();
- if (!m_closeUnblocks.IsNull ())
- {
- m_closeUnblocks (this);
- }
-}
int Socket::Listen (uint32_t queueLimit)
{
@@ -199,15 +179,6 @@
return p->GetSize ();
}
-void
-Socket::NotifyCloseCompleted (void)
-{
- NS_LOG_FUNCTION_NOARGS ();
- if (!m_closeCompleted.IsNull ())
- {
- m_closeCompleted (this);
- }
-}
void
Socket::NotifyConnectionSucceeded (void)
@@ -229,16 +200,6 @@
}
}
-void
-Socket::NotifyHalfClose (void)
-{
- NS_LOG_FUNCTION_NOARGS ();
- if (!m_halfClose.IsNull ())
- {
- m_halfClose (this);
- }
-}
-
bool
Socket::NotifyConnectionRequest (const Address &from)
{
@@ -268,16 +229,6 @@
}
void
-Socket::NotifyCloseRequested (void)
-{
- NS_LOG_FUNCTION_NOARGS ();
- if (!m_closeRequested.IsNull ())
- {
- m_closeRequested (this);
- }
-}
-
-void
Socket::NotifyDataSent (uint32_t size)
{
NS_LOG_FUNCTION_NOARGS ();
--- a/src/node/socket.h Mon Jun 16 14:17:27 2008 +0100
+++ b/src/node/socket.h Mon Jun 16 16:25:52 2008 -0700
@@ -102,12 +102,6 @@
* \returns the node this socket is associated with.
*/
virtual Ptr<Node> GetNode (void) const = 0;
-
- /**
- * \param closeCompleted Callback invoked when the close operation is
- * completed.
- */
- void SetCloseCallback (Callback<void, Ptr<Socket> > closeCompleted);
/**
* \param connectionSucceeded this callback is invoked when the
* connection request initiated by the user is successfully
@@ -117,13 +111,9 @@
* connection request initiated by the user is unsuccessfully
* completed. The callback is passed back a pointer to the
* same socket object.
- * \param halfClose XXX When exactly is this callback invoked? If
- * it invoked when the other side closes the connection ?
- * Or when I call Close ?
*/
void SetConnectCallback (Callback<void, Ptr<Socket> > connectionSucceeded,
- Callback<void, Ptr<Socket> > connectionFailed,
- Callback<void, Ptr<Socket> > halfClose);
+ Callback<void, Ptr<Socket> > connectionFailed);
/**
* \brief Accept connection requests from remote hosts
* \param connectionRequest Callback for connection request from peer.
@@ -140,14 +130,11 @@
* back to the user through this callback. This user callback is
* passed a pointer to the new socket, and the ip address and
* port number of the connection originator.
- * \param closeRequested Callback for connection close request from peer.
- * XXX: when is this callback invoked ?
*/
void SetAcceptCallback (Callback<bool, Ptr<Socket>,
const Address &> connectionRequest,
Callback<void, Ptr<Socket>,
- const Address&> newConnectionCreated,
- Callback<void, Ptr<Socket> > closeRequested);
+ const Address&> newConnectionCreated);
/**
* \brief Notify application when a packet has been sent from transport
* protocol (non-standard socket call)
@@ -509,24 +496,16 @@
Address &fromAddress);
protected:
- void NotifyCloseUnblocks (void);
- void NotifyCloseCompleted (void);
void NotifyConnectionSucceeded (void);
void NotifyConnectionFailed (void);
- void NotifyHalfClose (void);
bool NotifyConnectionRequest (const Address &from);
void NotifyNewConnectionCreated (Ptr<Socket> socket, const Address &from);
- void NotifyCloseRequested (void);
void NotifyDataSent (uint32_t size);
void NotifySend (uint32_t spaceAvailable);
void NotifyDataRecv (void);
- Callback<void, Ptr<Socket> > m_closeUnblocks;
- Callback<void,Ptr<Socket> > m_closeCompleted;
Callback<void, Ptr<Socket> > m_connectionSucceeded;
Callback<void, Ptr<Socket> > m_connectionFailed;
- Callback<void, Ptr<Socket> > m_halfClose;
- Callback<void, Ptr<Socket> > m_closeRequested;
Callback<bool, Ptr<Socket>, const Address &> m_connectionRequest;
Callback<void, Ptr<Socket>, const Address&> m_newConnectionCreated;
Callback<void, Ptr<Socket>, uint32_t> m_dataSent;