Changeset 7744 for source/ariba/communication
- Timestamp:
- Mar 11, 2010, 9:28:24 AM (15 years ago)
- Location:
- source/ariba/communication
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
source/ariba/communication/BaseCommunication.cpp
r7496 r7744 38 38 39 39 #include "BaseCommunication.h" 40 40 41 #include "networkinfo/AddressDiscovery.h" 42 #include "ariba/utility/types/PeerID.h" 41 43 42 44 #ifdef UNDERLAY_OMNET … … 52 54 namespace ariba { 53 55 namespace communication { 56 57 using ariba::utility::PeerID; 54 58 55 59 use_logging_cpp(BaseCommunication); … … 100 104 currentSeqnum = 0; 101 105 106 // set local peer id 107 localDescriptor.getPeerId() = PeerID::random(); 108 logging_info( "Using PeerID: " << localDescriptor.getPeerId() ); 109 102 110 // creating transports 103 111 logging_info( "Creating transports ..." ); … … 114 122 115 123 logging_info( "Searching for local locators ..." ); 116 if(localDescriptor.getEndpoints().to_string().length() == 0) 117 AddressDiscovery::discover_endpoints( localDescriptor.getEndpoints() ); 124 /** 125 * DONT DO THAT: if(localDescriptor.getEndpoints().to_string().length() == 0) 126 * since addresses are used to initialize transport addresses 127 */ 128 AddressDiscovery::discover_endpoints( localDescriptor.getEndpoints() ); 118 129 logging_info( "Done. Local endpoints = " << localDescriptor.toString() ); 119 130 … … 177 188 AribaBaseMsg baseMsg( AribaBaseMsg::typeLinkRequest, linkid ); 178 189 baseMsg.getLocalDescriptor() = localDescriptor; 190 baseMsg.getRemoteDescriptor().getPeerId() = descriptor.getPeerId(); 179 191 180 192 // serialize and send message … … 338 350 logging_debug( "Received link open request" ); 339 351 352 /// not the correct peer id-> skip request 353 if (!msg->getRemoteDescriptor().getPeerId().isUnspecified() 354 && msg->getRemoteDescriptor().getPeerId() != localDescriptor.getPeerId()) { 355 logging_info("Received link request for " 356 << msg->getRemoteDescriptor().getPeerId().toString() 357 << "but i'm " 358 << localDescriptor.getPeerId() 359 << ": Ignoring!"); 360 break; 361 } 362 340 363 /// only answer the first request 341 364 if (!queryRemoteLink(msg->getLocalLink()).isUnspecified()) { -
source/ariba/communication/EndpointDescriptor.h
r6919 r7744 43 43 #include <set> 44 44 #include "ariba/utility/serialization.h" 45 #include "ariba/utility/types/PeerID.h" 45 46 #include "ariba/utility/addressing/endpoint_set.hpp" 46 47 … … 51 52 using namespace std; 52 53 using namespace ariba::addressing; 54 using ariba::utility::PeerID; 53 55 54 56 class EndpointDescriptor: public VSerializeable { VSERIALIZEABLE … … 120 122 } 121 123 124 /// returns a reference to the peer id 125 PeerID& getPeerId() { 126 return peerId; 127 } 128 129 130 /// returns a reference to the constant peer id 131 const PeerID& getPeerId() const { 132 return peerId; 133 } 122 134 private: 123 135 endpoint_set endpoints; 136 PeerID peerId; 124 137 }; 125 138 … … 127 140 128 141 sznBeginDefault( ariba::communication::EndpointDescriptor, X ){ 129 // serialize endpoints 142 143 // serialize peer id 144 X && &peerId; 145 146 // serialize end-points 130 147 uint16_t len = endpoints.to_bytes_size(); 131 148 X && len; -
source/ariba/communication/networkinfo/AddressDiscovery.cpp
r6919 r7744 107 107 if (addr==NULL) continue; 108 108 109 // ignore tun devices 110 string device = string(i->ifa_name); 111 if(device.find_first_of("tun") == 0) continue; 112 109 113 if (addr->sa_family == AF_INET) { 110 114 // look for ipv4
Note:
See TracChangeset
for help on using the changeset viewer.