예제 #1
0
		void _ReadImpl(u_long size, u_long error)
		{
			if( error != 0 || size == 0 )
			{
				_ReStart();
				return;
			}

			readCallback_(buf_.data(), size);
		}
예제 #2
-1
#include "chat.h"
#include "nbt.h"
#include "mineserver.h"
#include "packets.h"


extern int setnonblock(int fd);

#ifndef WIN32
#define SOCKET_ERROR -1
#endif

static const size_t BUFSIZE = 2048;
static std::tr1::array<uint8_t, BUFSIZE> BUF;
static std::tr1::array<uint8_t, BUFSIZE> BUFCRYPT;
static char* const cpBUF = reinterpret_cast<char*>(BUF.data());
static uint8_t* const upBUF = BUF.data();

static char* cpBUFCRYPT = reinterpret_cast<char*>(BUFCRYPT.data());

extern "C" void client_callback(int fd, short ev, void* arg)
{
  User* user = reinterpret_cast<User*>(arg);

  if (ev & EV_READ)
  {
    int read = 1;

    //Data must be decrypted if we are in crypted mode
    if(user->crypted)
    {