~ubuntu-branches/ubuntu/oneiric/inspircd/oneiric-security

« back to all changes in this revision

Viewing changes to src/inspsocket.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Darren Blaber
  • Date: 2008-04-21 12:51:01 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20080421125101-m6lqhtn1wna8u2go
Tags: 1.1.19+dfsg-1
New upstream version

Show diffs side-by-side

added added

removed removed

Lines of Context:
439
439
{
440
440
}
441
441
 
442
 
// There are two possible outcomes to this function.
443
 
// It will either write all of the data, or an undefined amount.
444
 
// If an undefined amount is written the connection has failed
445
 
// and should be aborted.
446
 
int InspSocket::Write(const std::string &data)
 
442
 /*
 
443
  * This function formerly tried to flush write buffer each call.
 
444
  * While admirable in attempting to get the data out to wherever
 
445
  * it is going, on a full socket, it's just going to syscall write() and
 
446
  * EAGAIN constantly, instead of waiting in the SE to know if it can write
 
447
  * which will chew a bit of CPU.
 
448
  *
 
449
  * So, now this function returns void (take note) and just adds to the sendq.
 
450
  *
 
451
  * It'll get written at a determinate point when the socketengine tells us it can write.
 
452
  *        -- w00t (april 1, 2008)
 
453
  */
 
454
void InspSocket::Write(const std::string &data)
447
455
{
448
456
        /* Try and append the data to the back of the queue, and send it on its way
449
457
         */
450
458
        outbuffer.push_back(data);
451
459
        this->Instance->SE->WantWrite(this);
452
 
        return (!this->FlushWriteBuffer());
453
460
}
454
461
 
455
462
bool InspSocket::FlushWriteBuffer()