From 4d6d3859d208d5576e7149de9a0a5576b7cf5153 Mon Sep 17 00:00:00 2001 From: brain Date: Mon, 12 Dec 2005 18:31:52 +0000 Subject: Added extra documentation for InspSocket (at last) git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@2356 e03df62e-2008-0410-955e-edbf42e46eb7 --- docs/module-doc/socket_8cpp-source.html | 138 ++++++++++++++++---------------- 1 file changed, 71 insertions(+), 67 deletions(-) (limited to 'docs/module-doc/socket_8cpp-source.html') diff --git a/docs/module-doc/socket_8cpp-source.html b/docs/module-doc/socket_8cpp-source.html index 0a22a089d..d0acacdf1 100644 --- a/docs/module-doc/socket_8cpp-source.html +++ b/docs/module-doc/socket_8cpp-source.html @@ -203,9 +203,9 @@ 00194 return written; 00195 } 00196 -00197 bool InspSocket::Poll() +00197 bool InspSocket::Timeout(time_t current) 00198 { -00199 if ((time(NULL) > timeout_end) && (this->state == I_CONNECTING)) +00199 if ((this->state == I_CONNECTING) && (current > timeout_end)) 00200 { 00201 // for non-listening sockets, the timeout can occur 00202 // which causes termination of the connection after @@ -215,72 +215,76 @@ 00206 this->OnError(I_ERR_TIMEOUT); 00207 timeout = true; 00208 this->state = I_ERROR; -00209 return false; +00209 return true; 00210 } -00211 -00212 int incoming = -1; -00213 -00214 switch (this->state) -00215 { -00216 case I_CONNECTING: -00217 this->SetState(I_CONNECTED); -00218 /* Our socket was in write-state, so delete it and re-add it -00219 * in read-state. -00220 */ -00221 SE->DelFd(this->fd); -00222 SE->AddFd(this->fd,true,X_ESTAB_MODULE); -00223 return this->OnConnected(); -00224 break; -00225 case I_LISTENING: -00226 length = sizeof (client); -00227 incoming = accept (this->fd, (sockaddr*)&client,&length); -00228 this->OnIncomingConnection(incoming,inet_ntoa(client.sin_addr)); -00229 return true; -00230 break; -00231 case I_CONNECTED: -00232 return this->OnDataReady(); -00233 break; -00234 default: -00235 break; -00236 } -00237 -00238 return true; -00239 } -00240 -00241 void InspSocket::SetState(InspSocketState s) -00242 { -00243 log(DEBUG,"Socket state change"); -00244 this->state = s; -00245 } -00246 -00247 InspSocketState InspSocket::GetState() -00248 { -00249 return this->state; -00250 } -00251 -00252 int InspSocket::GetFd() -00253 { -00254 return this->fd; -00255 } -00256 -00257 bool InspSocket::OnConnected() { return true; } -00258 void InspSocket::OnError(InspSocketError e) { return; } -00259 int InspSocket::OnDisconnect() { return 0; } -00260 int InspSocket::OnIncomingConnection(int newfd, char* ip) { return 0; } -00261 bool InspSocket::OnDataReady() { return true; } -00262 void InspSocket::OnTimeout() { return; } -00263 void InspSocket::OnClose() { return; } -00264 -00265 InspSocket::~InspSocket() -00266 { -00267 this->Close(); -00268 } -00269 -00270 /* -00271 int BindSocket (int sockfd, struct sockaddr_in client, struct sockaddr_in server, int port, char* addr) -00272 int OpenTCPSocket (void) -00273 */ -
1.4.4-20050815