Commit 8762334a authored by jan.koester's avatar jan.koester
Browse files

conn event fixed

parent 8f5f94fe
Loading
Loading
Loading
Loading
+4 −7
Changes for src/linux/event.cpp: 4 added lines, 7 removed lines.
Original line number Diff line number Diff line
@@ -157,7 +157,10 @@ namespace netplus {
        void ConnectEventHandler(int pos,const int tid,void *args)  {
            NetException exception;
            con *ccon=(con*)_Events[pos].data.ptr;
            if(!ccon){
            if(ccon){
                CloseEventHandler(pos,tid,args);
            }

            _evtapi->CreateConnetion(&ccon);
            if(_ServerSocket->_Type==sockettype::TCP){
                ccon->csock=new tcp();
@@ -166,7 +169,6 @@ namespace netplus {
            }else if(_ServerSocket->_Type==sockettype::SSL){
                ccon->csock=new ssl();
            }
            }

            _ServerSocket->accept(ccon->csock);
            ccon->csock->setnonblocking();
@@ -188,12 +190,7 @@ namespace netplus {
            if ( estate < 0 ) {
                char errstr[255];
                strerror_r_netplus(errno,errstr,255);
                if(errno==EWOULDBLOCK){
                    exception[NetException::Note] << "ConnectEventHandler: can't add socket to epoll: " << errstr;
                    ccon->state=EVCON;
                }else{
                exception[NetException::Error] << "ConnectEventHandler: can't add socket to epoll: " << errstr;
                }
                throw exception;
            }
            _evtapi->ConnectEvent(ccon,tid,args);