Exemple #1
0
void SessionUDP::DoAsyncRecv()
{

#ifdef VHWD_WINDOWS


	TempPtrT<MyOverLappedEx> q=lkfq_recv.getq();
	if(!q)
	{
		return;
	}

	MyOverLappedEx &idat(*q);

	int bRet=WSARecvFrom(sk_local.sock,
						 &idat.dbuf[0],
						 idat.dbuf[1].buf?2:1,
						 &idat.size,
						 &iocp_flag_recv,
						 idat.peer,
						 idat.peer,
						 &idat.olap,
						 NULL);

	if(bRet!=0 && WSAGetLastError()!=WSA_IO_PENDING)
	{
		--m_nPendingRecv;
		Disconnect();
		return;
	}
	else
	{
		q.release();
	}

#else
	ep_ctl(EPOLLIN);
#endif
}
Exemple #2
0
void SessionUDP::DoAsyncSend()
{

#ifdef VHWD_WINDOWS

	TempPtrT<MyOverLappedEx> q=lkfq_send.getq();
	if(!q)
	{
		return;
	}

	MyOverLappedEx &idat(*q);
	int bRet=WSASendTo(sk_local.sock,
					   &idat.dbuf[0],
					   idat.dbuf[1].buf?2:1,
					   &idat.size,
					   0,
					   idat.peer,
					   idat.peer.v4size(),
					   &idat.olap,
					   NULL);

	if(bRet!=0 && WSAGetLastError()!=WSA_IO_PENDING)
	{
		System::CheckError("WSASend Error");
		Disconnect();
		--m_nPendingSend;
		return;
	}
	else
	{
		q.release();
	}

#else
	ep_ctl(EPOLLOUT);
#endif
}
Exemple #3
0
// [WARNING] Linux specific:
// Unlike the Mac OS version, this function change the bitmask filter for a filedescriptor
value ep_mod(value epfd, value fd, value flags)
{
	return ep_ctl(epfd, EPOLL_CTL_MOD, fd, flags);
}
Exemple #4
0
// [WARNING] Linux specific:
// This function remove the filedescriptor from the epoll descriptor
// Unlike the Mac OS version, the third argument is unused
value ep_del(value epfd, value fd, value unused)
{
	return ep_ctl(epfd, EPOLL_CTL_DEL, fd, 0);
}
Exemple #5
0
value ep_add(value epfd, value fd, value flags)
{
	return ep_ctl(epfd, EPOLL_CTL_ADD, fd, flags);
}
Exemple #6
0
// [WARNING] Mac OS specific:
// Unlike the Linux version, this function delete a precise filter from a filedescripor
// and not the filedescriptor
value ep_del(value epfd, value fd, value v_flags)
{
    return ep_ctl(epfd, EV_DELETE, fd, Int_val(v_flags));
}
Exemple #7
0
value ep_add(value epfd, value fd, value v_flags)
{
	return ep_ctl(epfd, EV_ADD | EV_ENABLE, fd, Int_val(v_flags));
}