aboutsummaryrefslogtreecommitdiff
path: root/src/server.cpp
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2007-10-04 10:46:46 +0000
committerMike Buland <eichlan@xagasoft.com>2007-10-04 10:46:46 +0000
commit86f9fbefa58d91e151190c969216c751573bc664 (patch)
tree4e13de2666bfb063964877986dc7b8d310714483 /src/server.cpp
parentb3eef5b0b82c20a9f11868ba376f6bb2d94faae4 (diff)
downloadlibbu++-86f9fbefa58d91e151190c969216c751573bc664.tar.gz
libbu++-86f9fbefa58d91e151190c969216c751573bc664.tar.bz2
libbu++-86f9fbefa58d91e151190c969216c751573bc664.tar.xz
libbu++-86f9fbefa58d91e151190c969216c751573bc664.zip
Discovered that the Bu::Client::disconnect() function didn't do anything. That
has been fixed, it now safely disconnects after emptying the Client's outgoing buffer. Added some more helpers to Bu::FString. Added the beginings of ProtocolHttp using a new method for processing protocols that's based more strongly on an NFA state machine, this makes sense, but I never had the desire to actually try implementing it before. It's working pretty well.
Diffstat (limited to 'src/server.cpp')
-rw-r--r--src/server.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/server.cpp b/src/server.cpp
index 53b4301..29d4822 100644
--- a/src/server.cpp
+++ b/src/server.cpp
@@ -74,12 +74,26 @@ void Bu::Server::scan()
74 } 74 }
75 } 75 }
76 76
77 Bu::List<int> lDelete;
77 // Now we just try to write all the pending data on all the sockets. 78 // Now we just try to write all the pending data on all the sockets.
78 // this could be done better eventually, if we care about the socket 79 // this could be done better eventually, if we care about the socket
79 // wanting to accept writes (using a select). 80 // wanting to accept writes (using a select).
80 for( ClientHash::iterator i = hClients.begin(); i != hClients.end(); i++ ) 81 for( ClientHash::iterator i = hClients.begin(); i != hClients.end(); i++ )
81 { 82 {
82 (*i)->processOutput(); 83 (*i)->processOutput();
84 if( (*i)->wantsDisconnect() )
85 {
86 lDelete.append( i.getKey() );
87 }
88 }
89
90 for( Bu::List<int>::iterator i = lDelete.begin(); i != lDelete.end(); i++ )
91 {
92 Client *pClient = hClients.get( *i );
93 onClosedConnection( pClient );
94 pClient->close();
95 hClients.erase( *i );
96 FD_CLR( *i, &fdActive );
83 } 97 }
84} 98}
85 99