Changeset 9347 in orxonox.OLD for branches/proxy/src/lib/network/handshake.cc
- Timestamp:
- Jul 20, 2006, 11:43:27 AM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/proxy/src/lib/network/handshake.cc
r9235 r9347 10 10 11 11 ### File Specific: 12 main-programmer: christoph13 co-programmer: 12 main-programmer: Christoph Renner (rennerc@ee.ethz.ch) 13 co-programmer: Patirck Boenzli (boenzlip@orxonox.ethz.ch) 14 14 */ 15 15 16 16 17 /* this is for debug output. It just says, that all calls to PRINT() belong to the DEBUG_MODULE_NETWORK module18 For more information refere to https://www.orxonox.net/cgi-bin/trac.cgi/wiki/DebugOutput19 */20 17 #define DEBUG_MODULE_NETWORK 21 18 … … 25 22 #include "debug.h" 26 23 27 Handshake::Handshake( bool server, int clientId, int networkGameManagerId, int messageManagerId ) 24 25 26 27 28 Handshake::Handshake( int nodeType, int clientId, int networkGameManagerId, int messageManagerId ) 28 29 : Synchronizeable() 29 30 { … … 31 32 this->setClassID(CL_HANDSHAKE, "Handshake"); 32 33 33 this->setIsServer(server); 34 34 // register all variable handlers 35 35 orxId_handler = registerVarId( new SynchronizeableInt( &localState.orxId, &remoteState.orxId, "orxonoxId", PERMISSION_ALL ) ); 36 36 version_handler = registerVarId( new SynchronizeableInt( &localState.version, &remoteState.version, "version", PERMISSION_ALL ) ); … … 42 42 errorString_handler = registerVarId( new SynchronizeableString( &localState.errorString, &remoteState.errorString, "errorString", PERMISSION_ALL ) ); 43 43 44 this->nodeTypeHandler = registerVarId( new SynchronizeableInt( &localState.nodeType, &remoteState.nodeType, "nodeType", PERMISSION_ALL ) ); 45 44 46 candel_id = registerVarId( new SynchronizeableInt( &localState.canDel, &remoteState.canDel, "canDel", PERMISSION_ALL ) ); 45 47 46 48 registerVar( new SynchronizeableString( &localState.preferedNickName, &remoteState.preferedNickName, "preferedNickName", PERMISSION_ALL ) ); 49 // now synchronize only two of the available proxy server addresses 50 registerVar( new SynchronizeableIP( &localState.proxy1, &remoteState.proxy1, "proxy server 1", PERMISSION_ALL ) ); 51 registerVar( new SynchronizeableIP( &localState.proxy2, &remoteState.proxy1, "proxy server 2", PERMISSION_ALL ) ); 47 52 53 // init the local state 48 54 localState.completed = 0; 49 55 localState.error = 0; … … 54 60 localState.orxId = _ORXONOX_ID; 55 61 localState.version = _ORXONOX_VERSION; 62 localState.nodeType = nodeType; 56 63 localState.canDel = 0; 64 localState.redirectProxy = 0; 65 localState.proxy1 = IP(0, 0); 66 localState.proxy2 = IP (0, 0); 57 67 68 69 // init the remote state 58 70 remoteState.completed = 0; 59 71 remoteState.error = 0; … … 64 76 remoteState.orxId = 0; 65 77 remoteState.version = 0; 78 remoteState.nodeType = NET_CLIENT; 66 79 remoteState.canDel = 0; 80 remoteState.redirectProxy = 0; 81 remoteState.proxy1 = IP(0, 0); 82 remoteState.proxy2 = IP(0, 0); 67 83 84 // activate the synchronization process 68 85 this->setSynchronized(true); 69 86 PRINTF(0)("Handshake created clientId = %d\n", clientId); 70 87 } 88 71 89 72 90 /** … … 78 96 for ( std::list<int>::iterator it = id.begin(); it != id.end(); it++ ) 79 97 { 80 if ( *it == orxId_handler ) 98 // orxonox id handler 99 if ( *it == this->orxId_handler ) 81 100 { 82 101 if ( remoteState.orxId != _ORXONOX_ID ) … … 87 106 continue; 88 107 } 89 90 108 } 91 109 92 if ( *it == version_handler ) 110 // orxonox version handler 111 if ( *it == this->version_handler ) 93 112 { 94 113 if ( remoteState.version != _ORXONOX_VERSION ) … … 99 118 continue; 100 119 } 101 102 120 } 103 121 122 // node type handler: for each node type there is a specific action to be taken 123 if ( *it == this->nodeTypeHandler) 124 { 125 if ( remoteState.nodeType == NET_MASTER_SERVER ) 126 { 127 continue; 128 } 129 else if( remoteState.nodeType == NET_PROXY_SERVER_ACTIVE) 130 { 131 continue; 132 } 133 else if( remoteState.nodeType == NET_CLIENT) 134 { 135 continue; 136 } 137 } 138 139 // cancel 104 140 if ( *it == candel_id ) 105 141 { … … 109 145 } 110 146 111 if (112 113 remoteState.version == _ORXONOX_VERSION114 )147 // handshake completed 148 if ( remoteState.orxId == _ORXONOX_ID && 149 remoteState.version == _ORXONOX_VERSION ) 150 { 115 151 localState.completed = 1; 152 } 116 153 } 117 154
Note: See TracChangeset
for help on using the changeset viewer.