From 956328e80741c88cdae6d98b07be4171c98f4e26 Mon Sep 17 00:00:00 2001 From: brain Date: Mon, 30 May 2005 05:23:22 +0000 Subject: Added docs for base: BoolSet git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@1565 e03df62e-2008-0410-955e-edbf42e46eb7 --- docs/module-doc/servers_8cpp-source.html | 573 ++++++++++++++++--------------- 1 file changed, 303 insertions(+), 270 deletions(-) (limited to 'docs/module-doc/servers_8cpp-source.html') diff --git a/docs/module-doc/servers_8cpp-source.html b/docs/module-doc/servers_8cpp-source.html index 7b6994181..297f887fa 100644 --- a/docs/module-doc/servers_8cpp-source.html +++ b/docs/module-doc/servers_8cpp-source.html @@ -262,279 +262,312 @@ 00255 // Checks to see if we can still reach a server at all (e.g. is it in ANY routing table?) 00256 bool IsRoutable(std::string servername) 00257 { -00258 for (int x = 0; x < 32; x++) if (me[x]) -00259 { -00260 ircd_connector* cn = me[x]->FindHost(servername.c_str()); -00261 if (cn) -00262 { -00263 if (cn->GetState() == STATE_DISCONNECTED) -00264 { -00265 for (int k = 0; k < me[x]->connectors.size(); k++) -00266 { -00267 for (int m = 0; m < me[x]->connectors[k].routes.size(); m++) -00268 { -00269 if (!strcasecmp(me[x]->connectors[k].routes[m].c_str(),servername.c_str())) -00270 { -00271 return true; -00272 } -00273 } -00274 } -00275 return false; -00276 } -00277 else return true; -00278 } -00279 } -00280 return false; -00281 } -00282 -00283 -00284 void serverrec::FlushWriteBuffers() -00285 { -00286 for (int i = 0; i < this->connectors.size(); i++) -00287 { -00288 // don't try and ping a NOAUTH_OUTBOUND state, its not authed yet! -00289 if ((this->connectors[i].GetState() == STATE_NOAUTH_OUTBOUND) && (TIME > this->connectors[i].age+30)) +00258 int c = 0; +00259 for (int x = 0; x < 32; x++) +00260 if (me[x]) +00261 { +00262 for (int i = 0; i < me[x]->connectors.size(); i++) +00263 { +00264 if ((me[x]->connectors[i].GetServerName() == servername) && (me[x]->connectors[i].GetState() != STATE_DISCONNECTED)) +00265 { +00266 c++; +00267 } +00268 } +00269 } +00270 return (c != 0); +00271 } +00272 +00273 +00274 void serverrec::FlushWriteBuffers() +00275 { +00276 char buffer[MAXBUF]; +00277 for (int i = 0; i < this->connectors.size(); i++) +00278 { +00279 // don't try and ping a NOAUTH_OUTBOUND state, its not authed yet! +00280 if ((this->connectors[i].GetState() == STATE_NOAUTH_OUTBOUND) && (TIME > this->connectors[i].age+30)) +00281 { +00282 // however if we reach this timer its connected timed out :) +00283 WriteOpers("*** Connection to %s timed out",this->connectors[i].GetServerName().c_str()); +00284 snprintf(buffer,MAXBUF,"& %s",this->connectors[i].GetServerName().c_str()); +00285 NetSendToAllExcept(this->connectors[i].GetServerName().c_str(),buffer); +00286 DoSplit(this->connectors[i].GetServerName().c_str()); +00287 return; +00288 } +00289 if ((this->connectors[i].GetState() == STATE_NOAUTH_INBOUND) && (TIME > this->connectors[i].age+30)) 00290 { -00291 // however if we reach this timer its connected timed out :) -00292 WriteOpers("*** Connection to %s timed out",this->connectors[i].GetServerName().c_str()); -00293 DoSplit(this->connectors[i].GetServerName().c_str()); -00294 return; -00295 } -00296 else if ((this->connectors[i].GetState() == STATE_NOAUTH_INBOUND) && (TIME > this->connectors[i].age+30)) -00297 { -00298 WriteOpers("*** Connection from %s timed out",this->connectors[i].GetServerName().c_str()); -00299 DoSplit(this->connectors[i].GetServerName().c_str()); -00300 return; -00301 } -00302 else if (this->connectors[i].GetState() != STATE_DISCONNECTED) -00303 { -00304 if (!this->connectors[i].CheckPing()) -00305 { -00306 WriteOpers("*** Lost single connection to %s: Ping timeout",this->connectors[i].GetServerName().c_str()); -00307 this->connectors[i].CloseConnection(); -00308 this->connectors[i].SetState(STATE_DISCONNECTED); -00309 if (!IsRoutable(this->connectors[i].GetServerName())) -00310 { -00311 WriteOpers("*** Server %s is no longer routable, disconnecting.",this->connectors[i].GetServerName().c_str()); -00312 DoSplit(this->connectors[i].GetServerName().c_str()); -00313 } -00314 has_been_netsplit = true; -00315 } -00316 } -00317 if (this->connectors[i].HasBufferedOutput()) -00318 { -00319 if (!this->connectors[i].FlushWriteBuf()) -00320 { -00321 // if we're here the write() caused an error, we cannot proceed -00322 WriteOpers("*** Lost single connection to %s, link inactive and retrying: %s",this->connectors[i].GetServerName().c_str(),this->connectors[i].GetWriteError().c_str()); -00323 this->connectors[i].CloseConnection(); -00324 this->connectors[i].SetState(STATE_DISCONNECTED); -00325 if (!IsRoutable(this->connectors[i].GetServerName())) -00326 { -00327 WriteOpers("*** Server %s is no longer routable, disconnecting.",this->connectors[i].GetServerName().c_str()); -00328 DoSplit(this->connectors[i].GetServerName().c_str()); -00329 } -00330 has_been_netsplit = true; -00331 } -00332 } -00333 } -00334 } -00335 -00336 bool serverrec::SendPacket(char *message, const char* sendhost) -00337 { -00338 if ((!message) || (!sendhost)) -00339 return true; -00340 -00341 ircd_connector* cn = this->FindHost(sendhost); -00342 -00343 if (!strchr(message,'\n')) -00344 { -00345 strlcat(message,"\n",MAXBUF); -00346 } -00347 -00348 if (cn) -00349 { -00350 log(DEBUG,"main: serverrec::SendPacket() sent '%s' to %s",message,cn->GetServerName().c_str()); -00351 -00352 if (cn->GetState() == STATE_DISCONNECTED) -00353 { -00354 // fix: can only route one hop to avoid a loop -00355 if (strncmp(message,"R ",2)) -00356 { -00357 log(DEBUG,"Not a double reroute"); -00358 // this route is down, we must re-route the packet through an available point in the mesh. -00359 for (int k = 0; k < this->connectors.size(); k++) -00360 { -00361 log(DEBUG,"Check connector %d: %s",k,this->connectors[k].GetServerName().c_str()); -00362 // search for another point in the mesh which can 'reach' where we want to go -00363 for (int m = 0; m < this->connectors[k].routes.size(); m++) -00364 { -00365 if (!strcasecmp(this->connectors[k].routes[m].c_str(),sendhost)) -00366 { -00367 log(DEBUG,"Found alternative route for packet: %s",this->connectors[k].GetServerName().c_str()); -00368 char buffer[MAXBUF]; -00369 snprintf(buffer,MAXBUF,"R %s %s",sendhost,message); -00370 this->SendPacket(buffer,this->connectors[k].GetServerName().c_str()); -00371 return true; -00372 } -00373 } -00374 } -00375 } -00376 char buffer[MAXBUF]; -00377 snprintf(buffer,MAXBUF,"& %s",sendhost); -00378 WriteOpers("*** All connections to %s lost.",sendhost); -00379 NetSendToAllExcept(sendhost,buffer); -00380 DoSplit(sendhost); -00381 return false; -00382 } -00383 -00384 // returns false if the packet could not be sent (e.g. target host down) -00385 if (!cn->AddWriteBuf(message)) -00386 { -00387 // if we're here, there was an error pending, and the send cannot proceed -00388 log(DEBUG,"cn->AddWriteBuf() failed for serverrec::SendPacket(): %s",cn->GetWriteError().c_str()); -00389 log(DEBUG,"Disabling connector: %s",cn->GetServerName().c_str()); -00390 cn->CloseConnection(); -00391 cn->SetState(STATE_DISCONNECTED); -00392 WriteOpers("*** Lost single connection to %s, link inactive and retrying: %s",cn->GetServerName().c_str(),cn->GetWriteError().c_str()); -00393 // retry the packet along a new route so either arrival OR failure are gauranteed (bugfix) -00394 return this->SendPacket(message,sendhost); -00395 } -00396 if (!cn->FlushWriteBuf()) -00397 { -00398 // if we're here the write() caused an error, we cannot proceed -00399 log(DEBUG,"cn->FlushWriteBuf() failed for serverrec::SendPacket(): %s",cn->GetWriteError().c_str()); -00400 log(DEBUG,"Disabling connector: %s",cn->GetServerName().c_str()); -00401 cn->CloseConnection(); -00402 cn->SetState(STATE_DISCONNECTED); -00403 WriteOpers("*** Lost single connection to %s, link inactive and retrying: %s",cn->GetServerName().c_str(),cn->GetWriteError().c_str()); -00404 // retry the packet along a new route so either arrival OR failure are gauranteed -00405 return this->SendPacket(message,sendhost); -00406 } -00407 return true; -00408 } -00409 } -00410 -00411 bool already_have_sum(std::string sum) -00412 { -00413 for (int i = 0; i < xsums.size(); i++) -00414 { -00415 if (xsums[i] == sum) -00416 { -00417 return true; -00418 } -00419 } -00420 if (xsums.size() >= 128) -00421 { -00422 xsums.pop_front(); -00423 } -00424 xsums.push_back(sum); -00425 return false; -00426 } -00427 -00428 // receives a packet from any where there is data waiting, first come, first served -00429 // fills the message and host values with the host where the data came from. -00430 -00431 bool serverrec::RecvPacket(std::deque<std::string> &messages, char* recvhost,std::deque<std::string> &sums) -00432 { -00433 char data[65536]; -00434 memset(data, 0, 65536); -00435 for (int i = 0; i < this->connectors.size(); i++) -00436 { -00437 if (this->connectors[i].GetState() != STATE_DISCONNECTED) -00438 { -00439 // returns false if the packet could not be sent (e.g. target host down) -00440 int rcvsize = 0; +00291 WriteOpers("*** Connection from %s timed out",this->connectors[i].GetServerName().c_str()); +00292 snprintf(buffer,MAXBUF,"& %s",this->connectors[i].GetServerName().c_str()); +00293 NetSendToAllExcept(this->connectors[i].GetServerName().c_str(),buffer); +00294 DoSplit(this->connectors[i].GetServerName().c_str()); +00295 return; +00296 } +00297 if (this->connectors[i].GetState() != STATE_DISCONNECTED) +00298 { +00299 if (!this->connectors[i].CheckPing()) +00300 { +00301 WriteOpers("*** Lost single connection to %s: Ping timeout",this->connectors[i].GetServerName().c_str()); +00302 this->connectors[i].CloseConnection(); +00303 this->connectors[i].SetState(STATE_DISCONNECTED); +00304 if (!IsRoutable(this->connectors[i].GetServerName())) +00305 { +00306 WriteOpers("*** Server %s is no longer routable, disconnecting.",this->connectors[i].GetServerName().c_str()); +00307 snprintf(buffer,MAXBUF,"& %s",this->connectors[i].GetServerName().c_str()); +00308 NetSendToAllExcept(this->connectors[i].GetServerName().c_str(),buffer); +00309 DoSplit(this->connectors[i].GetServerName().c_str()); +00310 } +00311 has_been_netsplit = true; +00312 } +00313 } +00314 if ((this->connectors[i].GetWriteError() !="") && (this->connectors[i].GetState() != STATE_DISCONNECTED)) +00315 { +00316 // if we're here the write() caused an error, we cannot proceed +00317 WriteOpers("*** Lost single connection to %s, link inactive and retrying: %s",this->connectors[i].GetServerName().c_str(),this->connectors[i].GetWriteError().c_str()); +00318 this->connectors[i].CloseConnection(); +00319 this->connectors[i].SetState(STATE_DISCONNECTED); +00320 if (!IsRoutable(this->connectors[i].GetServerName())) +00321 { +00322 WriteOpers("*** Server %s is no longer routable, disconnecting.",this->connectors[i].GetServerName().c_str()); +00323 snprintf(buffer,MAXBUF,"& %s",this->connectors[i].GetServerName().c_str()); +00324 NetSendToAllExcept(this->connectors[i].GetServerName().c_str(),buffer); +00325 DoSplit(this->connectors[i].GetServerName().c_str()); +00326 } +00327 has_been_netsplit = true; +00328 } +00329 if ((this->connectors[i].HasBufferedOutput()) && (this->connectors[i].GetState() != STATE_DISCONNECTED)) +00330 { +00331 if (!this->connectors[i].FlushWriteBuf()) +00332 { +00333 // if we're here the write() caused an error, we cannot proceed +00334 WriteOpers("*** Lost single connection to %s, link inactive and retrying: %s",this->connectors[i].GetServerName().c_str(),this->connectors[i].GetWriteError().c_str()); +00335 this->connectors[i].CloseConnection(); +00336 this->connectors[i].SetState(STATE_DISCONNECTED); +00337 if (!IsRoutable(this->connectors[i].GetServerName())) +00338 { +00339 WriteOpers("*** Server %s is no longer routable, disconnecting.",this->connectors[i].GetServerName().c_str()); +00340 snprintf(buffer,MAXBUF,"& %s",this->connectors[i].GetServerName().c_str()); +00341 NetSendToAllExcept(this->connectors[i].GetServerName().c_str(),buffer); +00342 DoSplit(this->connectors[i].GetServerName().c_str()); +00343 } +00344 has_been_netsplit = true; +00345 } +00346 } +00347 } +00348 } +00349 +00350 bool serverrec::SendPacket(char *message, const char* sendhost) +00351 { +00352 if ((!message) || (!sendhost)) +00353 return true; +00354 +00355 ircd_connector* cn = this->FindHost(sendhost); +00356 +00357 if (!strchr(message,'\n')) +00358 { +00359 strlcat(message,"\n",MAXBUF); +00360 } +00361 +00362 if (cn) +00363 { +00364 log(DEBUG,"main: serverrec::SendPacket() sent '%s' to %s",message,cn->GetServerName().c_str()); +00365 +00366 if (cn->GetState() == STATE_DISCONNECTED) +00367 { +00368 // fix: can only route one hop to avoid a loop +00369 if (strncmp(message,"R ",2)) +00370 { +00371 log(DEBUG,"Not a double reroute"); +00372 // this route is down, we must re-route the packet through an available point in the mesh. +00373 for (int k = 0; k < this->connectors.size(); k++) +00374 { +00375 log(DEBUG,"Check connector %d: %s",k,this->connectors[k].GetServerName().c_str()); +00376 // search for another point in the mesh which can 'reach' where we want to go +00377 for (int m = 0; m < this->connectors[k].routes.size(); m++) +00378 { +00379 if (!strcasecmp(this->connectors[k].routes[m].c_str(),sendhost)) +00380 { +00381 log(DEBUG,"Found alternative route for packet: %s",this->connectors[k].GetServerName().c_str()); +00382 char buffer[MAXBUF]; +00383 snprintf(buffer,MAXBUF,"R %s %s",sendhost,message); +00384 this->SendPacket(buffer,this->connectors[k].GetServerName().c_str()); +00385 return true; +00386 } +00387 } +00388 } +00389 } +00390 char buffer[MAXBUF]; +00391 snprintf(buffer,MAXBUF,"& %s",sendhost); +00392 WriteOpers("*** All connections to %s lost.",sendhost); +00393 NetSendToAllExcept(sendhost,buffer); +00394 DoSplit(sendhost); +00395 return false; +00396 } +00397 +00398 // returns false if the packet could not be sent (e.g. target host down) +00399 if (!cn->AddWriteBuf(message)) +00400 { +00401 // if we're here, there was an error pending, and the send cannot proceed +00402 log(DEBUG,"cn->AddWriteBuf() failed for serverrec::SendPacket(): %s",cn->GetWriteError().c_str()); +00403 log(DEBUG,"Disabling connector: %s",cn->GetServerName().c_str()); +00404 cn->CloseConnection(); +00405 cn->SetState(STATE_DISCONNECTED); +00406 WriteOpers("*** Lost single connection to %s, link inactive and retrying: %s",cn->GetServerName().c_str(),cn->GetWriteError().c_str()); +00407 // retry the packet along a new route so either arrival OR failure are gauranteed (bugfix) +00408 return this->SendPacket(message,sendhost); +00409 } +00410 if (!cn->FlushWriteBuf()) +00411 { +00412 // if we're here the write() caused an error, we cannot proceed +00413 log(DEBUG,"cn->FlushWriteBuf() failed for serverrec::SendPacket(): %s",cn->GetWriteError().c_str()); +00414 log(DEBUG,"Disabling connector: %s",cn->GetServerName().c_str()); +00415 cn->CloseConnection(); +00416 cn->SetState(STATE_DISCONNECTED); +00417 WriteOpers("*** Lost single connection to %s, link inactive and retrying: %s",cn->GetServerName().c_str(),cn->GetWriteError().c_str()); +00418 // retry the packet along a new route so either arrival OR failure are gauranteed +00419 return this->SendPacket(message,sendhost); +00420 } +00421 return true; +00422 } +00423 } +00424 +00425 bool already_have_sum(std::string sum) +00426 { +00427 for (int i = 0; i < xsums.size(); i++) +00428 { +00429 if (xsums[i] == sum) +00430 { +00431 return true; +00432 } +00433 } +00434 if (xsums.size() >= 128) +00435 { +00436 xsums.pop_front(); +00437 } +00438 xsums.push_back(sum); +00439 return false; +00440 } 00441 -00442 // check if theres any data on this socket -00443 // if not, continue onwards to the next. -00444 pollfd polls; -00445 polls.fd = this->connectors[i].GetDescriptor(); -00446 polls.events = POLLIN; -00447 int ret = poll(&polls,1,1); -00448 if (ret <= 0) continue; -00449 -00450 rcvsize = recv(this->connectors[i].GetDescriptor(),data,65000,0); -00451 data[rcvsize] = '\0'; -00452 if (rcvsize == -1) -00453 { -00454 if (errno != EAGAIN) -00455 { -00456 log(DEBUG,"recv() failed for serverrec::RecvPacket(): %s",strerror(errno)); -00457 log(DEBUG,"Disabling connector: %s",this->connectors[i].GetServerName().c_str()); -00458 this->connectors[i].CloseConnection(); -00459 this->connectors[i].SetState(STATE_DISCONNECTED); -00460 if (!IsRoutable(this->connectors[i].GetServerName())) -00461 { -00462 WriteOpers("*** Server %s is no longer routable, disconnecting.",this->connectors[i].GetServerName().c_str()); -00463 DoSplit(this->connectors[i].GetServerName().c_str()); -00464 } -00465 has_been_netsplit = true; -00466 } -00467 } -00468 int pushed = 0; -00469 if (rcvsize > 0) -00470 { -00471 if (!this->connectors[i].AddBuffer(data)) -00472 { -00473 WriteOpers("*** Read buffer for %s exceeds maximum, closing connection!",this->connectors[i].GetServerName().c_str()); -00474 this->connectors[i].CloseConnection(); -00475 this->connectors[i].SetState(STATE_DISCONNECTED); -00476 if (!IsRoutable(this->connectors[i].GetServerName())) -00477 { -00478 WriteOpers("*** Server %s is no longer routable, disconnecting.",this->connectors[i].GetServerName().c_str()); -00479 DoSplit(this->connectors[i].GetServerName().c_str()); -00480 } -00481 has_been_netsplit = true; -00482 } -00483 if (this->connectors[i].BufferIsComplete()) +00442 // receives a packet from any where there is data waiting, first come, first served +00443 // fills the message and host values with the host where the data came from. +00444 +00445 bool serverrec::RecvPacket(std::deque<std::string> &messages, char* recvhost,std::deque<std::string> &sums) +00446 { +00447 char data[65536],buffer[MAXBUF]; +00448 memset(data, 0, 65536); +00449 for (int i = 0; i < this->connectors.size(); i++) +00450 { +00451 if (this->connectors[i].GetState() != STATE_DISCONNECTED) +00452 { +00453 // returns false if the packet could not be sent (e.g. target host down) +00454 int rcvsize = 0; +00455 +00456 // check if theres any data on this socket +00457 // if not, continue onwards to the next. +00458 pollfd polls; +00459 polls.fd = this->connectors[i].GetDescriptor(); +00460 polls.events = POLLIN; +00461 int ret = poll(&polls,1,1); +00462 if (ret <= 0) continue; +00463 +00464 rcvsize = recv(this->connectors[i].GetDescriptor(),data,65000,0); +00465 data[rcvsize] = '\0'; +00466 if (rcvsize == 0) +00467 { +00468 log(DEBUG,"recv() failed for serverrec::RecvPacket(): EOF"); +00469 log(DEBUG,"Disabling connector: %s",this->connectors[i].GetServerName().c_str()); +00470 this->connectors[i].CloseConnection(); +00471 this->connectors[i].SetState(STATE_DISCONNECTED); +00472 if (!IsRoutable(this->connectors[i].GetServerName())) +00473 { +00474 WriteOpers("*** Server %s is no longer routable, disconnecting (EOF)",this->connectors[i].GetServerName().c_str()); +00475 snprintf(buffer,MAXBUF,"& %s",this->connectors[i].GetServerName().c_str()); +00476 NetSendToAllExcept(this->connectors[i].GetServerName().c_str(),buffer); +00477 DoSplit(this->connectors[i].GetServerName().c_str()); +00478 } +00479 has_been_netsplit = true; +00480 } +00481 if (rcvsize == -1) +00482 { +00483 if (errno != EAGAIN) 00484 { -00485 this->connectors[i].ResetPing(); -00486 while (this->connectors[i].BufferIsComplete()) -00487 { -00488 std::string text = this->connectors[i].GetBuffer(); -00489 if (text != "") -00490 { -00491 if ((text[0] == ':') && (text.find(" ") != std::string::npos)) -00492 { -00493 std::string orig = text; -00494 log(DEBUG,"Original: %s",text.c_str()); -00495 std::string sum = text.substr(1,text.find(" ")-1); -00496 text = text.substr(text.find(" ")+1,text.length()); -00497 std::string possible_token = text.substr(1,text.find(" ")-1); -00498 if (possible_token.length() > 1) -00499 { -00500 sums.push_back("*"); -00501 text = orig; -00502 log(DEBUG,"Non-mesh, non-tokenized string passed up the chain"); -00503 } -00504 else -00505 { -00506 log(DEBUG,"Packet sum: '%s'",sum.c_str()); -00507 if ((already_have_sum(sum)) && (sum != "*")) -00508 { -00509 // we don't accept dupes -00510 continue; -00511 } -00512 sums.push_back(sum.c_str()); -00513 } -00514 } -00515 else sums.push_back("*"); -00516 messages.push_back(text.c_str()); -00517 strlcpy(recvhost,this->connectors[i].GetServerName().c_str(),160); -00518 log(DEBUG,"serverrec::RecvPacket() %d:%s->%s",pushed++,recvhost,text.c_str()); -00519 } -00520 } -00521 return true; -00522 } -00523 } -00524 } -00525 } -00526 // nothing new yet -- message and host will be undefined -00527 return false; -00528 } -00529 -
Generated on Wed May 25 22:02:05 2005 for InspIRCd by +00485 log(DEBUG,"recv() failed for serverrec::RecvPacket(): %s",strerror(errno)); +00486 log(DEBUG,"Disabling connector: %s",this->connectors[i].GetServerName().c_str()); +00487 this->connectors[i].CloseConnection(); +00488 this->connectors[i].SetState(STATE_DISCONNECTED); +00489 if (!IsRoutable(this->connectors[i].GetServerName())) +00490 { +00491 WriteOpers("*** Server %s is no longer routable, disconnecting.",this->connectors[i].GetServerName().c_str()); +00492 snprintf(buffer,MAXBUF,"& %s",this->connectors[i].GetServerName().c_str()); +00493 NetSendToAllExcept(this->connectors[i].GetServerName().c_str(),buffer); +00494 DoSplit(this->connectors[i].GetServerName().c_str()); +00495 } +00496 has_been_netsplit = true; +00497 } +00498 } +00499 int pushed = 0; +00500 if (rcvsize > 0) +00501 { +00502 if (!this->connectors[i].AddBuffer(data)) +00503 { +00504 WriteOpers("*** Read buffer for %s exceeds maximum, closing connection!",this->connectors[i].GetServerName().c_str()); +00505 this->connectors[i].CloseConnection(); +00506 this->connectors[i].SetState(STATE_DISCONNECTED); +00507 if (!IsRoutable(this->connectors[i].GetServerName())) +00508 { +00509 WriteOpers("*** Server %s is no longer routable, disconnecting.",this->connectors[i].GetServerName().c_str()); +00510 snprintf(buffer,MAXBUF,"& %s",this->connectors[i].GetServerName().c_str()); +00511 NetSendToAllExcept(this->connectors[i].GetServerName().c_str(),buffer); +00512 DoSplit(this->connectors[i].GetServerName().c_str()); +00513 } +00514 has_been_netsplit = true; +00515 } +00516 if (this->connectors[i].BufferIsComplete()) +00517 { +00518 this->connectors[i].ResetPing(); +00519 while (this->connectors[i].BufferIsComplete()) +00520 { +00521 std::string text = this->connectors[i].GetBuffer(); +00522 if (text != "") +00523 { +00524 if ((text[0] == ':') && (text.find(" ") != std::string::npos)) +00525 { +00526 std::string orig = text; +00527 log(DEBUG,"Original: %s",text.c_str()); +00528 std::string sum = text.substr(1,text.find(" ")-1); +00529 text = text.substr(text.find(" ")+1,text.length()); +00530 std::string possible_token = text.substr(1,text.find(" ")-1); +00531 if (possible_token.length() > 1) +00532 { +00533 sums.push_back("*"); +00534 text = orig; +00535 log(DEBUG,"Non-mesh, non-tokenized string passed up the chain"); +00536 } +00537 else +00538 { +00539 log(DEBUG,"Packet sum: '%s'",sum.c_str()); +00540 if ((already_have_sum(sum)) && (sum != "*")) +00541 { +00542 // we don't accept dupes +00543 continue; +00544 } +00545 sums.push_back(sum.c_str()); +00546 } +00547 } +00548 else sums.push_back("*"); +00549 messages.push_back(text.c_str()); +00550 strlcpy(recvhost,this->connectors[i].GetServerName().c_str(),160); +00551 log(DEBUG,"serverrec::RecvPacket() %d:%s->%s",pushed++,recvhost,text.c_str()); +00552 } +00553 } +00554 return true; +00555 } +00556 } +00557 } +00558 } +00559 // nothing new yet -- message and host will be undefined +00560 return false; +00561 } +00562 +
Generated on Mon May 30 05:15:21 2005 for InspIRCd by doxygen 1.3.3
-- cgit v1.2.3