From: <mik...@us...> - 2003-12-27 11:42:43
|
Update of /cvsroot/sharedaemon/sharedaemon-ui-web/src/server/http In directory sc8-pr-cvs1:/tmp/cvs-serv1468/src/server/http Modified Files: HttpServerSocket.cpp HttpServerSocket.h Log Message: 27/12/2003 Mikael Barbeaux * Fixed a bug about rebinding sockets on the same address. Index: HttpServerSocket.cpp =================================================================== RCS file: /cvsroot/sharedaemon/sharedaemon-ui-web/src/server/http/HttpServerSocket.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- HttpServerSocket.cpp 27 Dec 2003 10:55:11 -0000 1.4 +++ HttpServerSocket.cpp 27 Dec 2003 11:42:39 -0000 1.5 @@ -47,10 +47,15 @@ */ void HttpServerSocket::run() { // Starts the server - validate(); - bind(server_port); - listen(20); - + try { + validate(); + bind(server_port); + listen(20); + } + catch(Exception& e) { + cout << e.getMessage() << endl; + return; + } while(true) { // sets a cancel point setCancelPoint(); @@ -108,8 +113,8 @@ * Stops the server. */ void HttpServerSocket::stop() throw (SocketException) { + ServerSocket::close(); cancel(); - close(); // make a connection for stopping accept() int sd = socket(AF_INET, SOCK_STREAM, 0); Index: HttpServerSocket.h =================================================================== RCS file: /cvsroot/sharedaemon/sharedaemon-ui-web/src/server/http/HttpServerSocket.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- HttpServerSocket.h 26 Dec 2003 22:56:41 -0000 1.1 +++ HttpServerSocket.h 27 Dec 2003 11:42:39 -0000 1.2 @@ -31,7 +31,7 @@ * A http server socket is a threaded ServerSocket * that accepts HttpSocket. */ -class HttpServerSocket : protected ServerSocket, protected Thread { +class HttpServerSocket : protected ServerSocket, public Thread { private: |