Changeset 9406 in orxonox.OLD for trunk/src/lib/network/handshake.cc
- Timestamp:
- Jul 24, 2006, 11:09:47 AM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/network/handshake.cc
r9235 r9406 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 35 // register all variable handlers 35 36 orxId_handler = registerVarId( new SynchronizeableInt( &localState.orxId, &remoteState.orxId, "orxonoxId", PERMISSION_ALL ) ); 36 37 version_handler = registerVarId( new SynchronizeableInt( &localState.version, &remoteState.version, "version", PERMISSION_ALL ) ); … … 42 43 errorString_handler = registerVarId( new SynchronizeableString( &localState.errorString, &remoteState.errorString, "errorString", PERMISSION_ALL ) ); 43 44 45 this->nodeTypeHandler = registerVarId( new SynchronizeableInt( &localState.nodeType, &remoteState.nodeType, "nodeType", PERMISSION_ALL ) ); 46 44 47 candel_id = registerVarId( new SynchronizeableInt( &localState.canDel, &remoteState.canDel, "canDel", PERMISSION_ALL ) ); 45 48 46 49 registerVar( new SynchronizeableString( &localState.preferedNickName, &remoteState.preferedNickName, "preferedNickName", PERMISSION_ALL ) ); 50 // now synchronize only two of the available proxy server addresses 51 registerVar( new SynchronizeableIP( &this->proxy1, &this->proxy1, "proxy server 1", PERMISSION_MASTER_SERVER ) ); 52 registerVar( new SynchronizeableIP( &this->proxy2, &this->proxy2, "proxy server 2", PERMISSION_MASTER_SERVER ) ); 53 registerVar( new SynchronizeableInt( &this->redirectProxy, &this->redirectProxy, "proxy server redirection flag", PERMISSION_MASTER_SERVER ) ); 47 54 55 56 // init the local state 48 57 localState.completed = 0; 49 58 localState.error = 0; … … 54 63 localState.orxId = _ORXONOX_ID; 55 64 localState.version = _ORXONOX_VERSION; 65 localState.nodeType = nodeType; 56 66 localState.canDel = 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; 67 80 81 82 this->proxy1 = IP(0, 0); 83 this->proxy2 = IP(0, 0); 84 this->redirectProxy = 0; 85 86 87 // activate the synchronization process 68 88 this->setSynchronized(true); 69 89 PRINTF(0)("Handshake created clientId = %d\n", clientId); 70 90 } 91 71 92 72 93 /** … … 78 99 for ( std::list<int>::iterator it = id.begin(); it != id.end(); it++ ) 79 100 { 80 if ( *it == orxId_handler ) 101 // orxonox id handler 102 if ( *it == this->orxId_handler ) 81 103 { 82 104 if ( remoteState.orxId != _ORXONOX_ID ) … … 87 109 continue; 88 110 } 89 90 111 } 91 112 92 if ( *it == version_handler ) 113 // orxonox version handler 114 if ( *it == this->version_handler ) 93 115 { 94 116 if ( remoteState.version != _ORXONOX_VERSION ) … … 99 121 continue; 100 122 } 101 102 123 } 103 124 125 // node type handler: for each node type there is a specific action to be taken 126 if ( *it == this->nodeTypeHandler) 127 { 128 if ( remoteState.nodeType == NET_MASTER_SERVER ) 129 { 130 continue; 131 } 132 else if( remoteState.nodeType == NET_PROXY_SERVER_ACTIVE) 133 { 134 continue; 135 } 136 else if( remoteState.nodeType == NET_CLIENT) 137 { 138 continue; 139 } 140 } 141 142 // cancel 104 143 if ( *it == candel_id ) 105 144 { 106 145 PRINTF(0)("handshake finished candel changed\n"); 107 146 } 108 109 147 } 110 148 111 if (112 113 remoteState.version == _ORXONOX_VERSION114 )149 // handshake completed 150 if ( remoteState.orxId == _ORXONOX_ID && 151 remoteState.version == _ORXONOX_VERSION ) 152 { 115 153 localState.completed = 1; 154 } 116 155 } 117 156
Note: See TracChangeset
for help on using the changeset viewer.