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

fine fine

parent a23300fb
Loading
Loading
Loading
Loading
+0 −4
Original line number Diff line number Diff line
@@ -34,10 +34,6 @@

#pragma once

#ifndef Windows
typedef unsigned long long ULONG_PTR;
#endif

namespace netplus {
        class EventWorker;
        class pollapi;
+5 −2
Original line number Diff line number Diff line
@@ -50,17 +50,20 @@

#define HIDDEN __attribute__ ((visibility ("hidden")))

#define ADDRMAXSIZE 256

std::atomic<int> netplus::socket::_InitCount(0);

netplus::socket::socket(){
    _SocketInfo=(ULONG_PTR)::malloc(sizeof(sockaddr));
    _SocketInfoLen=sizeof(sockaddr);
    _SocketInfo=malloc(ADDRMAXSIZE);
    _SocketInfoLen=sizeof(struct sockaddr);
    _Type=-1;
    ++_InitCount;
}

netplus::socket::~socket(){
    --_InitCount;
    free(_SocketInfo);
}

void netplus::socket::setnonblocking(){
+2 −1
Original line number Diff line number Diff line
@@ -103,7 +103,8 @@ netplus::tcp::tcp(const char* addr, int port,int maxconnections,int sockopts) :
                           rp->ai_protocol);
        if (_Socket == -1)
            continue;
        memcpy((void*)_SocketInfo,rp,sizeof(struct addrinfo));
        memcpy((void*)_SocketInfo,rp,sizeof(hints));
        ((struct addrinfo*)_SocketInfo)->ai_next=nullptr;
        _SocketInfoLen=sizeof(rp);

        break;
+2 −2
Original line number Diff line number Diff line
@@ -103,9 +103,9 @@ netplus::udp::udp(const char* addr, int port,int maxconnections,int sockopts) :
                           rp->ai_protocol);
        if (_Socket == -1)
            continue;
        memcpy((void*)_SocketInfo,rp,sizeof(struct addrinfo));
        memcpy((void*)_SocketInfo,rp,sizeof(hints));
        ((struct addrinfo*)_SocketInfo)->ai_next=nullptr;
        _SocketInfoLen=sizeof(rp);

        break;
    }

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

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