Method: Mosquitto::Client#loop_write
- Defined in:
- ext/mosquitto/client.c
#loop_write(1) ⇒ Boolean
Carry out network write operations. This should only be used if you are not using Mosquitto::Client#loop and are monitoring the client network socket for activity yourself.
1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 |
# File 'ext/mosquitto/client.c', line 1696
static VALUE rb_mosquitto_client_loop_write(VALUE obj, VALUE max_packets)
{
struct nogvl_loop_args args;
int ret;
MosquittoGetClient(obj);
Check_Type(max_packets, T_FIXNUM);
args.mosq = client->mosq;
args.max_packets = NUM2INT(max_packets);
ret = (int)rb_thread_call_without_gvl(rb_mosquitto_client_loop_write_nogvl, (void *)&args, RUBY_UBF_IO, 0);
switch (ret) {
case MOSQ_ERR_INVAL:
MosquittoError("invalid input params");
break;
case MOSQ_ERR_NOMEM:
rb_memerror();
break;
case MOSQ_ERR_NO_CONN:
MosquittoError("client not connected to broker");
break;
case MOSQ_ERR_CONN_LOST:
MosquittoError("connection to the broker was lost");
break;
case MOSQ_ERR_PROTOCOL:
MosquittoError("protocol error communicating with the broker");
break;
case MOSQ_ERR_ERRNO:
rb_sys_fail("mosquitto_loop");
break;
default:
return Qtrue;
}
}
|