Commit f6e62ef5 authored by jan.koester's avatar jan.koester
Browse files

fixed feixed linux bsd

parent 597dbab3
Loading
Loading
Loading
Loading
+13 −13
Original line number Diff line number Diff line
@@ -75,10 +75,10 @@ namespace netplus {

        /*EventHandler*/
        virtual  int waitEventHandler(int timeout)=0;
        virtual void ConnectEventHandler(int pos,const int tid,void *args)=0;
        virtual void ReadEventHandler(int pos,const int tid,void *args)=0;
        virtual void WriteEventHandler(int pos,const int tid,void *args)=0;
        virtual void CloseEventHandler(int pos,const int tid,void *args)=0;
        virtual void ConnectEventHandler(int pos,const int tid,ULONG_PTR args)=0;
        virtual void ReadEventHandler(int pos,const int tid,ULONG_PTR args)=0;
        virtual void WriteEventHandler(int pos,const int tid,ULONG_PTR args)=0;
        virtual void CloseEventHandler(int pos,const int tid,ULONG_PTR args)=0;

    protected:
        eventapi *_evtapi;
@@ -156,7 +156,7 @@ namespace netplus {
            return evn;
        };

        void ConnectEventHandler(int pos,const int tid,void *args)  {
        void ConnectEventHandler(int pos,const int tid,ULONG_PTR args)  {
            NetException exception;
            con *ccon;

@@ -197,7 +197,7 @@ namespace netplus {

        };

        void ReadEventHandler(int pos,const int tid,void *args) {
        void ReadEventHandler(int pos,const int tid,ULONG_PTR args) {
            con *rcon = (con*)_Events[pos].data.ptr;
            try{
                std::shared_ptr<char[]> buf( new char[BLOCKSIZE], []( char *p ){ delete [] p; });
@@ -230,7 +230,7 @@ namespace netplus {
            }
        };

        void WriteEventHandler(int pos,const int tid,void *args) {
        void WriteEventHandler(int pos,const int tid,ULONG_PTR args) {
            con *wcon = (con*)_Events[pos].data.ptr;
            try{

@@ -267,7 +267,7 @@ namespace netplus {
        };


        void CloseEventHandler(int pos,const int tid,void *args) {
        void CloseEventHandler(int pos,const int tid,ULONG_PTR args) {
            con *ccon = (con*)_Events[pos].data.ptr;
            try{
                if(_pollFD!=pos){
@@ -373,19 +373,19 @@ EVENTLOOP:
        }
    };

    void eventapi::RequestEvent(con *curcon,const int tid,void *args){
    void eventapi::RequestEvent(con *curcon,const int tid,ULONG_PTR args){
        //dummy
    };

    void eventapi::ResponseEvent(con *curcon,const int tid,void *args){
    void eventapi::ResponseEvent(con *curcon,const int tid,ULONG_PTR args){
        //dummy
    };

    void eventapi::ConnectEvent(con *curcon,const int tid,void *args){
    void eventapi::ConnectEvent(con *curcon,const int tid,ULONG_PTR args){
        //dummy
    };

    void eventapi::DisconnectEvent(con *curcon,const int tid,void *args){
    void eventapi::DisconnectEvent(con *curcon,const int tid,ULONG_PTR args){
        //dummy
    };

@@ -454,7 +454,7 @@ MAINWORKERLOOP:

        for (int i = 0; i < threads; i++) {
            try {
                threadpool.push_back( std::thread([&eargs,i]{
                threadpool.push_back( std::thread([&eargs,args,i]{
                    EventWorker(i,args,&eargs);
                }));
           } catch (NetException& e) {
+17 −17
Original line number Diff line number Diff line
@@ -72,10 +72,10 @@ namespace netplus {

        /*EventHandler*/
        virtual  int waitEventHandler()=0;
        virtual void ConnectEventHandler(int pos,const int tid,void *args)=0;
        virtual void ReadEventHandler(int pos,const int tid,void *args)=0;
        virtual void WriteEventHandler(int pos,const int tid,void *args)=0;
        virtual void CloseEventHandler(int pos,const int tid,void *args)=0;
        virtual void ConnectEventHandler(int pos,const int tid,ULONG_PTR args)=0;
        virtual void ReadEventHandler(int pos,const int tid,ULONG_PTR args)=0;
        virtual void WriteEventHandler(int pos,const int tid,ULONG_PTR args)=0;
        virtual void CloseEventHandler(int pos,const int tid,ULONG_PTR args)=0;

    protected:
        eventapi *_evtapi;
@@ -155,7 +155,7 @@ namespace netplus {
            return evn;
        };

        void ConnectEventHandler(int pos,const int tid,void *args)  {
        void ConnectEventHandler(int pos,const int tid,ULONG_PTR args)  {
            NetException exception;
            con *ccon;

@@ -195,7 +195,7 @@ namespace netplus {

        };

        void ReadEventHandler(int pos,const int tid,void *args) {
        void ReadEventHandler(int pos,const int tid,ULONG_PTR args) {
            con *rcon = (con*)_Events[pos].udata;

            if(!rcon)
@@ -231,7 +231,7 @@ namespace netplus {
            }
        };

        void WriteEventHandler(int pos,const int tid,void *args) {
        void WriteEventHandler(int pos,const int tid,ULONG_PTR args) {
            con *wcon = (con*)_Events[pos].udata;
            try{

@@ -268,7 +268,7 @@ namespace netplus {
        };


        void CloseEventHandler(int pos,const int tid,void *args) {
        void CloseEventHandler(int pos,const int tid,ULONG_PTR args) {
            con *ccon = (con*)_Events[pos].udata;

            if(!ccon)
@@ -332,8 +332,8 @@ namespace netplus {

    class EventWorker {
    public:
        EventWorker(int tid,EventWorkerArgs* args) {
            poll pollptr(args->ssocket,args->event,args->pollfd,args->timeout);
        EventWorker(int tid,ULONG_PTR args,EventWorkerArgs* eargs) {
            poll pollptr(eargs->ssocket,eargs->event,eargs->pollfd,eargs->timeout);

EVENTLOOP:
            try {
@@ -380,19 +380,19 @@ EVENTLOOP:
        }
    };

    void eventapi::RequestEvent(con *curcon,const int tid,void *args){
    void eventapi::RequestEvent(con *curcon,const int tid,ULONG_PTR args){
        //dummy
    };

    void eventapi::ResponseEvent(con *curcon,const int tid,void *args){
    void eventapi::ResponseEvent(con *curcon,const int tid,ULONG_PTR args){
        //dummy
    };

    void eventapi::ConnectEvent(con *curcon,const int tid,void *args){
    void eventapi::ConnectEvent(con *curcon,const int tid,ULONG_PTR args){
        //dummy
    };

    void eventapi::DisconnectEvent(con *curcon,const int tid,void *args){
    void eventapi::DisconnectEvent(con *curcon,const int tid,ULONG_PTR args){
        //dummy
    };

@@ -421,7 +421,7 @@ EVENTLOOP:
    event::~event() {
    }

    void event::runEventloop() {
    void event::runEventloop(ULONG_PTR args) {
        NetException exception;

        signal(SIGPIPE, SIG_IGN);
@@ -459,8 +459,8 @@ EVENTLOOP:

        for (size_t i = 0; i < threads; i++) {
            try {
                threadpool[i] = new std::thread([&eargs,i]{
                    EventWorker *evt = new EventWorker(i,&eargs);
                threadpool[i] = new std::thread([&eargs,args,i]{
                    EventWorker *evt = new EventWorker(i,args,&eargs);
                    delete evt;
                });
           } catch (NetException& e) {
+2 −2
Original line number Diff line number Diff line
@@ -35,7 +35,7 @@
#pragma once

#ifndef Windows
typedef ULONG_PTR unsigned long long;
typedef unsigned long long ULONG_PTR;
#endif

namespace netplus {
+1 −1
Original line number Diff line number Diff line
@@ -35,7 +35,7 @@

#ifndef Windows  
typedef int SOCKET;
typedef ULONG_PTR unsigned long long;
typedef unsigned long long ULONG_PTR;
#else
#include <winsock.h>
#endif