- Timestamp:
- Jul 20, 2006, 3:49:57 PM (18 years ago)
- Location:
- branches/proxy/src/lib/network
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/proxy/src/lib/network/handshake.cc
r9353 r9360 48 48 registerVar( new SynchronizeableString( &localState.preferedNickName, &remoteState.preferedNickName, "preferedNickName", PERMISSION_ALL ) ); 49 49 // now synchronize only two of the available proxy server addresses 50 proxy1Handler = registerVarId( new SynchronizeableIP( &localState.proxy1, &remoteState.proxy1, "proxy server 1", PERMISSION_ALL ) ); 51 proxy2Handler = registerVarId( new SynchronizeableIP( &localState.proxy2, &remoteState.proxy2, "proxy server 2", PERMISSION_ALL ) ); 50 // registerVar( new SynchronizeableIP( &this->proxy1, &this->proxy1, "proxy server 1", PERMISSION_ALL ) ); 51 // registerVar( new SynchronizeableIP( &this->proxy2, &this->proxy2, "proxy server 2", PERMISSION_ALL ) ); 52 registerVar( new SynchronizeableInt( this->proxy1.hostRef(), this->proxy1.hostRef(), "proxy server 1", PERMISSION_ALL)); 53 registerVar( new SynchronizeableInt( this->proxy1.portRef(), this->proxy1.portRef(), "proxy server 1", PERMISSION_ALL)); 54 registerVar( new SynchronizeableInt( this->proxy2.hostRef(), this->proxy2.hostRef(), "proxy server 2", PERMISSION_ALL)); 55 registerVar( new SynchronizeableInt( this->proxy2.portRef(), this->proxy2.portRef(), "proxy server 2", PERMISSION_ALL)); 52 56 53 57 // init the local state … … 62 66 localState.nodeType = nodeType; 63 67 localState.canDel = 0; 64 localState.redirectProxy = 0;65 localState.proxy1 = IP(0, 0);66 localState.proxy2 = IP (0, 0);67 68 68 69 … … 78 79 remoteState.nodeType = NET_CLIENT; 79 80 remoteState.canDel = 0; 80 remoteState.redirectProxy = 0;81 remoteState.proxy1 = IP(0, 0);82 remoteState.proxy2 = IP(0, 0);83 81 84 82 85 this->proxyAddressesSynched = 0; 83 this->proxyAddressesSynched = 2; 84 this->proxy1 = IP(0, 0); 85 this->proxy2 = IP(0, 0); 86 this->redirectProxy = 0; 86 87 87 88 … … 151 152 { 152 153 this->proxyAddressesSynched++; 153 PRINTF(0)("got proxy1: %i, %i\n", this-> remoteState.proxy1.host(), this->remoteState.proxy1.port());154 PRINTF(0)("got proxy1: %i, %i\n", this->proxy1.host(), this->proxy1.port()); 154 155 } 155 156 … … 158 159 { 159 160 this->proxyAddressesSynched++; 160 PRINTF(0)("got proxy2: %i, %i\n", this-> remoteState.proxy2.host(), this->remoteState.proxy2.port());161 PRINTF(0)("got proxy2: %i, %i\n", this->proxy2.host(), this->proxy2.port()); 161 162 } 162 163 -
branches/proxy/src/lib/network/handshake.h
r9350 r9360 14 14 #include "ip.h" 15 15 #include "synchronizeable.h" 16 #include "shared_network_data.h" 16 17 17 18 //!< a struct to save the handshakes to … … 35 36 //additional data 36 37 std::string preferedNickName; //!< prefered nick name 37 38 int redirectProxy; //!< true if the client should reconnect to a proxy server (either 1 or 2 )39 IP proxy1; //!< ip address of the first proxy (0.0.0.0 of not available)40 IP proxy2; //!< ip address of the second proxy (0.0.0.0 of not available)41 38 }; 42 39 … … 81 78 82 79 /** @returns if true the local client should reconnect to a proxy server from the proxy server list */ 83 inline bool redirect() { return this->re moteState.redirectProxy;}80 inline bool redirect() { return this->redirectProxy;} 84 81 /** @param flag: indicating if the client should be redirected */ 85 inline void setRedirect(bool flag) { this-> localState.redirectProxy = flag; }82 inline void setRedirect(bool flag) { this->redirectProxy = flag; } 86 83 87 84 /** @param address: the address of the proxy server 1 if any */ 88 inline void setProxy1Address(IP address) { this->localState.proxy1 = address; }85 inline void setProxy1Address(IP address) { if( !SharedNetworkData::getInstance()->isMasterServer()) return; this->proxy1 = address; } 89 86 /** @returns the address of the proxy server 1 if any */ 90 inline IP getProxy1Address() { return this-> remoteState.proxy1; }87 inline IP getProxy1Address() { return this->proxy1; } 91 88 /** @param address: the address of the proxy server 2 if any */ 92 inline void setProxy2Address(IP address) { this-> localState.proxy2 = address; }89 inline void setProxy2Address(IP address) { this->proxy2 = address; } 93 90 /** @returns the address of the proxy server 2 if any */ 94 inline IP getProxy2Address() { return this-> remoteState.proxy2; }91 inline IP getProxy2Address() { return this->proxy2; } 95 92 96 93 … … 119 116 120 117 int proxyAddressesSynched; //!< number of addresses synched 121 118 int redirectProxy; //!< true if the client should reconnect to a proxy server 119 IP proxy1; //!< ip address of the first proxy (0.0.0.0 of not available) 120 IP proxy2; //!< ip address of the second proxy (0.0.0.0 of not available) 122 121 }; 123 122 -
branches/proxy/src/lib/network/ip.cc
r9347 r9360 256 256 257 257 /// default port definition. 258 short IP::_defaultPort = 9999;258 int IP::_defaultPort = 9999; 259 259 260 260 /** … … 262 262 * @param defaultPort The default port. 263 263 */ 264 void IP::setDefaultPort( short defaultPort)264 void IP::setDefaultPort(int defaultPort) 265 265 { 266 266 IP::_defaultPort = defaultPort; -
branches/proxy/src/lib/network/ip.h
r9347 r9360 36 36 /** @returns the IP */ 37 37 int host() const { return this->_ip; }; 38 int* hostRef() { return &this->_ip; } 38 39 /** @returns the Port */ 39 short port() const { return this->_port; }; 40 int port() const { return this->_port; }; 41 int* portRef() { return &this->_port; }; 42 40 43 inline IPaddress getSDLNotation() { IPaddress sdlIP; sdlIP.host = this->_ip; sdlIP.port = this->_port; return sdlIP; } 41 44 … … 52 55 static std::string ipToString(int ip, int port = -1); 53 56 54 static void setDefaultPort( short defaultPort);55 static short defaultPort(short defaultPort) { return IP::_defaultPort; };57 static void setDefaultPort(int defaultPort); 58 static int defaultPort(int defaultPort) { return IP::_defaultPort; }; 56 59 57 60 private: 58 61 int _ip; //!< The IP in int form. 59 short _port; //!< The Port number of the IP62 int _port; //!< The Port number of the IP 60 63 61 static short _defaultPort; //!< Default Port64 static int _defaultPort; //!< Default Port 62 65 }; 63 66 -
branches/proxy/src/lib/network/network_stream.cc
r9357 r9360 488 488 if ( it->second.handshake->ok() ) 489 489 { 490 // the server gave it free for deletion 490 491 if ( !it->second.handshake->allowDel() ) 491 492 { … … 568 569 PRINTF(0)("Client is redirected to the other proxy servers\n"); 569 570 PRINTF(0)("===============================================\n"); 571 572 return; 570 573 571 574 PeerInfo* pInfo = &this->peers[userId]; -
branches/proxy/src/lib/network/synchronizeable_var/synchronizeable_ip.cc
r9349 r9360 51 51 n += res; 52 52 53 53 54 res = Converter::intToByteArray( (int)vPtrIn->port(), buf, maxLength); 54 55 assert(res > 0); … … 89 90 90 91 printf(" %s old: %i, %i -- new: %i, %i\n", name.c_str(), oldVal.host(), oldVal.port(), this->vPtrOut->host(), this->vPtrOut->port()); 91 setHasChanged( *this->vPtrOut != oldVal);92 this->setHasChanged( *this->vPtrOut != oldVal); 92 93 93 assert( n == 2 * INTSIZE);94 // assert( n == 2 * INTSIZE); 94 95 95 96 return n;
Note: See TracChangeset
for help on using the changeset viewer.