first real working version

This commit is contained in:
Jan Losinshi 2008-08-26 18:08:08 +02:00
parent ef46b68dd6
commit ce2889c9f1
3 changed files with 12 additions and 12 deletions

View File

@ -38,6 +38,10 @@ namespace xerxes
{ {
throw ConnCreateErr(); throw ConnCreateErr();
} }
if(be_debug)
{
std::cout << "socket with fd " << fd << " created" << std::endl;
}
} }
Socket::~Socket() Socket::~Socket()

View File

@ -27,7 +27,7 @@ namespace xerxes
{ {
struct Socket : boost::noncopyable struct Socket : boost::noncopyable
{ {
Socket(int fd); explicit Socket(int fd);
Socket(int domain, Socket(int domain,
int type, int type,
int protocol); int protocol);

View File

@ -6,10 +6,6 @@
* Maximilian Marx <mmarx@wh2.tu-dresden.de> * Maximilian Marx <mmarx@wh2.tu-dresden.de>
*/ */
/**
* TODO : Closing of dockets does not work korrect
*/
#include <iostream> #include <iostream>
#include <sys/types.h> #include <sys/types.h>
#include <sys/socket.h> #include <sys/socket.h>
@ -181,10 +177,10 @@ main(int argc, char* argv[])
{ {
if (e.type != EPOLL_ADD_ERR_SOURCE) if (e.type != EPOLL_ADD_ERR_SOURCE)
{ {
epoll.del(target->fd); epoll.del(*target);
} }
epoll.del(target->fd); epoll.del(*target);
epoll.del(source->fd); epoll.del(*source);
sockets.erase(target->fd); sockets.erase(target->fd);
sockets.erase(source->fd); sockets.erase(source->fd);
continue; continue;
@ -227,8 +223,8 @@ main(int argc, char* argv[])
{ {
cout << "Socket Error, closing socket" << target->fd << " and " << source->fd << endl; cout << "Socket Error, closing socket" << target->fd << " and " << source->fd << endl;
} }
epoll.del(target->fd); epoll.del(*target);
epoll.del(source->fd); epoll.del(*source);
sockets.erase(target->fd); sockets.erase(target->fd);
sockets.erase(source->fd); sockets.erase(source->fd);
continue; continue;
@ -241,8 +237,8 @@ main(int argc, char* argv[])
{ {
cout << "EPOLLERR or EPOLLHUP event from fd " << source->fd << " target is fd " << target->fd << " close both" << endl; cout << "EPOLLERR or EPOLLHUP event from fd " << source->fd << " target is fd " << target->fd << " close both" << endl;
} }
epoll.del(target->fd); epoll.del(*target);
epoll.del(source->fd); epoll.del(*source);
sockets.erase(target->fd); sockets.erase(target->fd);
sockets.erase(source->fd); sockets.erase(source->fd);
continue; continue;