-2
1200 2
1 1 0 1 0 7 50 -1 -1 0.000 1 0.0000 4500 1620 1260 585 4500 1620 5760 2205
-2 3 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 9
+2 3 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 8
1170 1350 1170 1890 2790 1890 2790 2070 3240 1620 2790 1170
- 2790 1350 1170 1350 1170 1350
-2 3 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 9
+ 2790 1350 1170 1350
+2 3 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 8
5760 1350 5760 1890 7380 1890 7380 2070 7830 1620 7380 1170
- 7380 1350 5760 1350 5760 1350
+ 7380 1350 5760 1350
2 1 1 1 0 7 50 -1 -1 1.000 0 0 -1 1 0 2
5 1 1.00 60.00 120.00
6210 540 6210 1440
4 0 0 50 -1 12 12 0.0000 4 150 720 6300 1110 send()\001
4 0 0 50 -1 12 12 0.0000 4 165 1560 6255 2205 get_out_len()\001
4 0 0 50 -1 16 12 0.0000 4 150 1230 6120 2520 read functions\001
-4 1 0 50 -1 16 12 0.0000 4 150 1650 4500 540 both side functions\001
+4 1 0 50 -1 16 12 0.0000 4 150 1650 4500 315 both side functions\001
+4 1 0 50 -1 12 12 0.0000 4 150 1080 4500 540 is_full()\001
:param class_channel channel: The manipulated Channel.
:param integer int: The amount of data which will be forwarded.
+.. js:function:: Channel.is_full(channel)
+
+ This function returns true if the buffer channel is full.
+
+ :returns: a boolean
.. _http_class:
return 1;
}
+/* Returns true if the channel is full. */
+__LJMP static int hlua_channel_is_full(lua_State *L)
+{
+ struct channel *chn;
+ int rem;
+
+ MAY_LJMP(check_args(L, 1, "is_full"));
+ chn = MAY_LJMP(hlua_checkchannel(L, 1));
+
+ rem = chn->buf->size;
+ rem -= chn->buf->o; /* Output size */
+ rem -= chn->buf->i; /* Input size */
+ rem -= global.tune.maxrewrite; /* Rewrite reserved size */
+
+ lua_pushboolean(L, rem <= 0);
+ return 1;
+}
+
/* Just returns the number of bytes available in the output
* side of the buffer. This function never fails.
*/
hlua_class_function(gL.T, "forward", hlua_channel_forward);
hlua_class_function(gL.T, "get_in_len", hlua_channel_get_in_len);
hlua_class_function(gL.T, "get_out_len", hlua_channel_get_out_len);
+ hlua_class_function(gL.T, "is_full", hlua_channel_is_full);
lua_rawset(gL.T, -3);