Commit 8228ed76 authored by jan.koester's avatar jan.koester
Browse files

fixed all

parent cbc57f25
Loading
Loading
Loading
Loading
+4 −3
Changes for src/event/iocp.cpp: 4 added lines, 3 removed lines.
Original line number Diff line number Diff line
@@ -118,7 +118,8 @@ namespace netplus {
			g_eventapi->ConnectEvent(pClientContext->CurCon, tid, args);

			try {
				size_t recv = pClientContext->CurCon->csock->recvData(nullptr, 0, 0);
				std::shared_ptr<char[]> buf;	
				size_t recv = pClientContext->CurCon->csock->recvData(buf, 0, 0);
			} catch (NetException& e) {
				std::cerr << e.what() << std::endl;
				if (e.getErrorType() != NetException::Note)
@@ -239,14 +240,14 @@ namespace netplus {
	
							ULONG ssize = curCon->SendData.size() < BLOCKSIZE ? (ULONG)curCon->SendData.size() : BLOCKSIZE;
							DWORD ret = 0;
							ret = curCon->csock->sendData(curCon->SendData.data(), ssize, 0);
							ret = curCon->csock->sendData(std::shared_ptr<char[]>(curCon->SendData.data()), ssize, 0);
							curCon->SendData.resize(ret);
							if (curCon->SendData.empty())
								pClientContext->State = IO_READ_STATE;
						}break;
						case IO_READ_STATE: {
							std::shared_ptr<char[]> buf(new char[BLOCKSIZE], std::default_delete<char[]>());
							size_t recv = curCon->csock->recvData(buf.get(), BLOCKSIZE, 0);
							size_t recv = curCon->csock->recvData(buf, BLOCKSIZE, 0);
							curCon->RecvData.append(buf.get(), recv);

							eargs->event->RequestEvent(curCon, tid, args);
+8 −9
Changes for src/socket.h: 8 added lines, 9 removed lines.
Original line number Diff line number Diff line
@@ -65,8 +65,8 @@ namespace netplus {

            virtual int              getMaxconnections()=0;
            
            virtual size_t sendData(std::shared_ptr<char> &data,size_t size,int flags=0);
            virtual size_t recvData(std::shared_ptr<char> &data,size_t size,int flags=0);
            virtual size_t sendData(std::shared_ptr<char[]>& data, size_t size, int flags = 0)=0;
            virtual size_t recvData(std::shared_ptr<char[]> &data,size_t size,int flags=0)=0;

            virtual void             connect(socket *csock)=0;

@@ -110,8 +110,8 @@ namespace netplus {

            int           getMaxconnections();
            
            size_t sendData(std::shared_ptr<char> &data,size_t size,int flags=0);
            size_t recvData(std::shared_ptr<char> &data,size_t size,int flags=0);
            size_t sendData(std::shared_ptr<char[]> &data,size_t size,int flags=0);
            size_t recvData(std::shared_ptr<char[]> &data,size_t size,int flags=0);

            virtual void connect(socket *csock);

@@ -144,8 +144,8 @@ namespace netplus {

            int           getMaxconnections();

            size_t sendData(std::shared_ptr<char> &data,size_t size,int flags=0);
            size_t recvData(std::shared_ptr<char> &data,size_t size,int flags=0);
            size_t sendData(std::shared_ptr<char[]> &data,size_t size,int flags=0);
            size_t recvData(std::shared_ptr<char[]> &data,size_t size,int flags=0);

            void connect(socket *csock);

@@ -171,11 +171,10 @@ namespace netplus {
            ssl&          operator=(int socket);
            int           getMaxconnections();
            
            size_t sendData(std::shared_ptr<char> &data,size_t size,int flags=0);
            size_t recvData(std::shared_ptr<char> &data,size_t size,int flags=0);
            size_t sendData(std::shared_ptr<char[]> &data,size_t size,int flags=0);
            size_t recvData(std::shared_ptr<char[]> &data,size_t size,int flags=0);
            
            void connect(socket *csock);
            void getAddress(std::string &addr);

        private:
            int                      _Maxconnections;
+2 −2
Changes for src/ssl.cpp: 2 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -39,12 +39,12 @@ int netplus::ssl::getMaxconnections(){
    return _Maxconnections;
}

size_t netplus::ssl::sendData(std::shared_ptr<char> &data,size_t size, int flags){
size_t netplus::ssl::sendData(std::shared_ptr<char[]>& data, size_t size, int flags) {
    NetException exception;
    return 0;
}

size_t netplus::ssl::recvData(std::shared_ptr<char> &data,size_t size,int flags){
size_t netplus::ssl::recvData(std::shared_ptr<char[]>& data, size_t size, int flags) {
    return 0;
}

+4 −4
Changes for src/windows/tcp.cpp: 4 added lines, 4 removed lines.
Original line number Diff line number Diff line
@@ -193,10 +193,10 @@ void netplus::tcp::bind(){
}


size_t netplus::tcp::sendData(void* data, unsigned long size,int flags){
size_t netplus::tcp::sendData(std::shared_ptr<char[]> &data,size_t size,int flags){
    WSABUF buf{0};

    buf.buf = reinterpret_cast<char*>(data);
    buf.buf = reinterpret_cast<char*>(data.get());
    buf.len = size;

    DWORD dwsend = 0;
@@ -219,12 +219,12 @@ size_t netplus::tcp::sendData(void* data, unsigned long size,int flags){
    return (size_t)dwsend;
}

size_t netplus::tcp::recvData(void* data, unsigned long size,int flags){
size_t netplus::tcp::recvData(std::shared_ptr<char[]> &data,size_t size,int flags){
    NetException exception;

    WSABUF buf;

    buf.buf = reinterpret_cast<char*>(data);
    buf.buf = reinterpret_cast<char*>(data.get());
    buf.len = size;
    DWORD dwBytes = 0;

+2 −2
Changes for src/windows/udp.cpp: 2 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -188,7 +188,7 @@ void netplus::udp::bind() {
    }
}

size_t netplus::udp::sendData(std::shared_ptr<char> &data,size_t size, int flags) {
size_t netplus::udp::sendData(std::shared_ptr<char[]> &data,size_t size, int flags) {
    NetException exception;

    WSABUF buf;
@@ -213,7 +213,7 @@ size_t netplus::udp::sendData(std::shared_ptr<char> &data,size_t size, int flags
    return (size_t)rval;
}

size_t netplus::udp::recvData(std::shared_ptr<char> data, size_t size, int flags) {
size_t netplus::udp::recvData(std::shared_ptr<char[]> &data, size_t size, int flags) {

    NetException exception;