Left: | ||
Right: |
LEFT | RIGHT |
---|---|
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ | 1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
2 /* | 2 /* |
3 * Copyright (c) 2007 INRIA | 3 * Copyright (c) 2007 INRIA |
4 * | 4 * |
5 * This program is free software; you can redistribute it and/or modify | 5 * This program is free software; you can redistribute it and/or modify |
6 * it under the terms of the GNU General Public License version 2 as | 6 * it under the terms of the GNU General Public License version 2 as |
7 * published by the Free Software Foundation; | 7 * published by the Free Software Foundation; |
8 * | 8 * |
9 * This program is distributed in the hope that it will be useful, | 9 * This program is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
59 MakeCallbackChecker ()) | 59 MakeCallbackChecker ()) |
60 .AddAttribute ("IcmpCallback6", "Callback invoked whenever an icmpv6 error i s received on this socket.", | 60 .AddAttribute ("IcmpCallback6", "Callback invoked whenever an icmpv6 error i s received on this socket.", |
61 CallbackValue (), | 61 CallbackValue (), |
62 MakeCallbackAccessor (&UdpSocketImpl::m_icmpCallback6), | 62 MakeCallbackAccessor (&UdpSocketImpl::m_icmpCallback6), |
63 MakeCallbackChecker ()) | 63 MakeCallbackChecker ()) |
64 ; | 64 ; |
65 return tid; | 65 return tid; |
66 } | 66 } |
67 | 67 |
68 UdpSocketImpl::UdpSocketImpl () | 68 UdpSocketImpl::UdpSocketImpl () |
69 : m_endPoint (0), | 69 : m_endPoint (0), |
Tommaso Pecorella
2012/02/15 16:47:57
Uninitialized variable:
m_endPoint6 (0),
Mandato
| |
70 m_endPoint6 (0), | |
70 m_node (0), | 71 m_node (0), |
71 m_udp (0), | 72 m_udp (0), |
72 m_errno (ERROR_NOTERROR), | 73 m_errno (ERROR_NOTERROR), |
73 m_shutdownSend (false), | 74 m_shutdownSend (false), |
74 m_shutdownRecv (false), | 75 m_shutdownRecv (false), |
75 m_connected (false), | 76 m_connected (false), |
76 m_rxAvailable (0) | 77 m_rxAvailable (0) |
77 { | 78 { |
78 NS_LOG_FUNCTION_NOARGS (); | 79 NS_LOG_FUNCTION_NOARGS (); |
79 m_allowBroadcast = false; | 80 m_allowBroadcast = false; |
(...skipping 12 matching lines...) Expand all Loading... | |
92 * Note that this piece of code is a bit tricky: | 93 * Note that this piece of code is a bit tricky: |
93 * when DeAllocate is called, it will call into | 94 * when DeAllocate is called, it will call into |
94 * Ipv4EndPointDemux::Deallocate which triggers | 95 * Ipv4EndPointDemux::Deallocate which triggers |
95 * a delete of the associated endPoint which triggers | 96 * a delete of the associated endPoint which triggers |
96 * in turn a call to the method UdpSocketImpl::Destroy below | 97 * in turn a call to the method UdpSocketImpl::Destroy below |
97 * will will zero the m_endPoint field. | 98 * will will zero the m_endPoint field. |
98 */ | 99 */ |
99 NS_ASSERT (m_endPoint != 0); | 100 NS_ASSERT (m_endPoint != 0); |
100 m_udp->DeAllocate (m_endPoint); | 101 m_udp->DeAllocate (m_endPoint); |
101 NS_ASSERT (m_endPoint == 0); | 102 NS_ASSERT (m_endPoint == 0); |
102 } | 103 } |
Tommaso Pecorella
2012/02/17 01:06:31
Here is the *#@! memory leak.
The function call c
| |
103 m_udp = 0; | 104 m_udp = 0; |
104 } | 105 } |
105 | 106 |
106 void· | 107 void· |
107 UdpSocketImpl::SetNode (Ptr<Node> node) | 108 UdpSocketImpl::SetNode (Ptr<Node> node) |
108 { | 109 { |
109 NS_LOG_FUNCTION_NOARGS (); | 110 NS_LOG_FUNCTION_NOARGS (); |
110 m_node = node; | 111 m_node = node; |
111 | 112 |
112 } | 113 } |
(...skipping 695 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
808 1) sanity check interface | 809 1) sanity check interface |
809 2) determine address family of groupAddress | 810 2) determine address family of groupAddress |
810 3) delete from local list of (interface, groupAddress); raise a LOG_WARN | 811 3) delete from local list of (interface, groupAddress); raise a LOG_WARN |
811 if not already present (but return 0)· | 812 if not already present (but return 0)· |
812 5) call ipv4->MulticastLeaveGroup () or Ipv6->MulticastLeaveGroup () | 813 5) call ipv4->MulticastLeaveGroup () or Ipv6->MulticastLeaveGroup () |
813 */ | 814 */ |
814 return 0; | 815 return 0; |
815 } | 816 } |
816 | 817 |
817 void | 818 void |
818 UdpSocketImpl::BindToNetDevice (Ptr<NetDevice> netdevice) | 819 UdpSocketImpl::BindToNetDevice (Ptr<NetDevice> netdevice) |
Tommaso Pecorella
2012/02/17 02:15:00
This only works on IPv4. It should work on IPv6 as
| |
819 { | 820 { |
820 NS_LOG_FUNCTION (netdevice); | 821 NS_LOG_FUNCTION (netdevice); |
821 Socket::BindToNetDevice (netdevice); // Includes sanity check | 822 Socket::BindToNetDevice (netdevice); // Includes sanity check |
822 if (m_endPoint == 0) | 823 if (m_endPoint == 0) |
823 { | 824 { |
824 if (Bind () == -1) | 825 if (Bind () == -1) |
825 { | 826 { |
826 NS_ASSERT (m_endPoint == 0); | 827 NS_ASSERT (m_endPoint == 0); |
827 return; | 828 return; |
828 } | 829 } |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1012 } | 1013 } |
1013 | 1014 |
1014 bool | 1015 bool |
1015 UdpSocketImpl::GetAllowBroadcast () const | 1016 UdpSocketImpl::GetAllowBroadcast () const |
1016 { | 1017 { |
1017 return m_allowBroadcast; | 1018 return m_allowBroadcast; |
1018 } | 1019 } |
1019 | 1020 |
1020 | 1021 |
1021 } // namespace ns3 | 1022 } // namespace ns3 |
LEFT | RIGHT |