17 void NetServer::checkAcctMsg(
SocketSet &sets )
21 unsigned char cmd = 0;
24 if ( !acct_sock || acct_sock->
isActive() ) {
29 if (acct_sock && acct_sock->
recvstr( p ) != 0 && p.length() != 0) {
44 std::map< std::string, WaitListEntry >::iterator iter = waitList.find( username );
45 if (waitList.end() != iter) {
46 WaitListEntry entry( (*iter).second );
50 COUT<<
"Got response for TCP client"<<endl;
53 COUT<<
"Got response for client IP : "<<ipadr<<endl;
55 if (entry.type == (
int) WaitListEntry::CONNECTING && cmd !=
ACCT_SUCCESS && cmd != 0) {
56 waitList.erase( iter );
62 COUT<<
">>> NEW LOGIN =( serial #"<<serial<<
" )= --------------------------------------"<<endl;
64 this->loginAccept( p, clt, 1, flags );
65 COUT<<
"<<< NEW LOGIN ----------------------------------------------------------------"<<endl;
69 COUT<<
">>> LOGIN ACCEPTED =( serial #"<<serial<<
" )= --------------------------------------"<<endl;
70 loginAccept( p, clt, 0, flags );
71 COUT<<
"<<< LOGIN ACCEPTED -----------------------------------------------------------"<<endl;
74 COUT<<
">>> LOGIN ERROR =( DENIED )= --------------------------------------"<<endl;
76 this->sendLoginError( clt );
77 COUT<<
"<<< LOGIN ERROR ---------------------------------------------------"<<endl;
80 COUT<<
">>> LOGIN ALREADY =( ALREADY LOGGED IN -> serial #"<<serial
81 <<
" )= --------------------------------------"<<endl;
83 this->sendLoginAlready( clt );
84 COUT<<
"<<< LOGIN ALREADY --------------------------------------------------------------"<<endl;
87 COUT<<
">>> UNKNOWN COMMAND =( "<<(
unsigned int) cmd<<
" )= --------------------------------------"
88 <<endl<<
"Full datastream was:"<<p<<endl;
90 }
else if (entry.type == (
int) WaitListEntry::JUMPING) {
91 waitList.erase( iter );
92 sendJumpFinal( clt, server, (
unsigned short) ( atoi( port.c_str() ) ) );
96 cerr<<
"Connection to account server lost !!"<<endl;
111 using namespace VSFileSystem;
114 string xmlstr, savestr;
119 string dynuniv_path =
"dynaverse.dat";
123 cerr<<
"FATAL ERROR: Error opening dynamic universe file"<<endl;
125 string dyn_univ = globalsave->WriteDynamicUniverse();
134 string xmlstr, savestr;
144 clt = getClientFromSerial( un->
GetSerial() );
146 cerr<<
"Error client/unit for "<<(clt ? clt->callsign :
"")<<
", serial "<<(un ? un->
GetSerial() : 0)
147 <<
" not found in save process !!!!"<<endl;
154 if ( savestr.empty() || xmlstr.empty() )
160 clt->savegame.clear();
161 clt->savegame.push_back( savestr );
162 clt->savegame.push_back( xmlstr );
169 if ( !acct_sock->
sendstr( snetbuf ) ) {
170 COUT<<
"ERROR sending SAVE to account server for "<<clt->callsign<<
" ("<<un->
GetSerial()<<
")"<<endl;
178 SENDRELIABLE, NULL, clt->tcp_sock, __FILE__, __LINE__ );