Example #1
0
/*
 * Generic mux interface callback functions, set when creating a new MSocket object.
 *  I don't think most of these should be used.
 * _lms_socket_default_write() = write condition from mux
 *
 * fd = file descriptor
 * e = event type
 * msoptr = pointer to the MSocket object on which the mux found something for us
 *
 */
void _lms_mux_default_write(int fd, short e, void *msoptr)
{
	MSocket *mso;

	if (msoptr)
	{
		mso = (MSocket *)msoptr;
	}
	else if (fd >= 0)
	{
		mso = lms_socket_findbyfd(fd);
	}
	else
	{
		/* mux is going a lot batty */
		return;
	}
	if (!mso)
	{
		/* mux is going a little batty */
		return;
	}

	if (mso->flags & LMSFLG_WAITCONN)
	{
		mso->flags &= ~LMSFLG_WAITCONN;
	}
	if (!(mso->flags & LMSFLG_CONNECTED))
	{
		mso->flags |= LMSFLG_CONNECTED;
	}

	mso->func_w(mso);

	return;
}