network: clarify socket creation error message

This commit is contained in:
Tommaso Pecorella
2023-10-02 23:01:19 +02:00
parent 59246fb83d
commit 2d0a2f564a

View File

@@ -73,9 +73,11 @@ Socket::CreateSocket(Ptr<Node> node, TypeId tid)
{
NS_LOG_FUNCTION(node << tid);
Ptr<Socket> s;
NS_ASSERT(node);
NS_ASSERT_MSG(node, "CreateSocket: node is null.");
Ptr<SocketFactory> socketFactory = node->GetObject<SocketFactory>(tid);
NS_ASSERT(socketFactory);
NS_ASSERT_MSG(socketFactory,
"CreateSocket: can not create a "
<< tid.GetName() << " - perhaps the node is missing the required protocol.");
s = socketFactory->CreateSocket();
NS_ASSERT(s);
return s;