mirror of
https://github.com/lunarmodules/luasocket.git
synced 2024-12-25 12:08:21 +01:00
add options:
get/set : recv-buffer-size get/set : send-buffer-size Signed-off-by: surenyi <surenyi82@163.com>
This commit is contained in:
parent
6529598909
commit
97bfe1e043
@ -115,6 +115,26 @@ int opt_set_broadcast(lua_State *L, p_socket ps)
|
||||
return opt_setboolean(L, ps, SOL_SOCKET, SO_BROADCAST);
|
||||
}
|
||||
|
||||
int opt_set_recv_buf_size(lua_State *L, p_socket ps)
|
||||
{
|
||||
return opt_setint(L, ps, SOL_SOCKET, SO_RCVBUF);
|
||||
}
|
||||
|
||||
int opt_get_recv_buf_size(lua_State *L, p_socket ps)
|
||||
{
|
||||
return opt_getint(L, ps, SOL_SOCKET, SO_RCVBUF);
|
||||
}
|
||||
|
||||
int opt_get_send_buf_size(lua_State *L, p_socket ps)
|
||||
{
|
||||
return opt_getint(L, ps, SOL_SOCKET, SO_SNDBUF);
|
||||
}
|
||||
|
||||
int opt_set_send_buf_size(lua_State *L, p_socket ps)
|
||||
{
|
||||
return opt_setint(L, ps, SOL_SOCKET, SO_SNDBUF);
|
||||
}
|
||||
|
||||
int opt_get_broadcast(lua_State *L, p_socket ps)
|
||||
{
|
||||
return opt_getboolean(L, ps, SOL_SOCKET, SO_BROADCAST);
|
||||
|
@ -37,6 +37,8 @@ int opt_set_ip6_multicast_loop(lua_State *L, p_socket ps);
|
||||
int opt_set_ip6_add_membership(lua_State *L, p_socket ps);
|
||||
int opt_set_ip6_drop_membersip(lua_State *L, p_socket ps);
|
||||
int opt_set_ip6_v6only(lua_State *L, p_socket ps);
|
||||
int opt_set_recv_buf_size(lua_State *L, p_socket ps);
|
||||
int opt_set_send_buf_size(lua_State *L, p_socket ps);
|
||||
|
||||
/* supported options for getoption */
|
||||
int opt_get_dontroute(lua_State *L, p_socket ps);
|
||||
@ -54,6 +56,8 @@ int opt_get_ip6_multicast_hops(lua_State *L, p_socket ps);
|
||||
int opt_get_ip6_unicast_hops(lua_State *L, p_socket ps);
|
||||
int opt_get_ip6_v6only(lua_State *L, p_socket ps);
|
||||
int opt_get_reuseport(lua_State *L, p_socket ps);
|
||||
int opt_get_recv_buf_size(lua_State *L, p_socket ps);
|
||||
int opt_get_send_buf_size(lua_State *L, p_socket ps);
|
||||
|
||||
/* invokes the appropriate option handler */
|
||||
int opt_meth_setoption(lua_State *L, p_opt opt, p_socket ps);
|
||||
|
@ -79,6 +79,8 @@ static t_opt optget[] = {
|
||||
{"tcp-nodelay", opt_get_tcp_nodelay},
|
||||
{"linger", opt_get_linger},
|
||||
{"error", opt_get_error},
|
||||
{"recv-buffer-size", opt_get_recv_buf_size},
|
||||
{"send-buffer-size", opt_get_send_buf_size},
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
@ -89,6 +91,8 @@ static t_opt optset[] = {
|
||||
{"tcp-nodelay", opt_set_tcp_nodelay},
|
||||
{"ipv6-v6only", opt_set_ip6_v6only},
|
||||
{"linger", opt_set_linger},
|
||||
{"recv-buffer-size", opt_set_recv_buf_size},
|
||||
{"send-buffer-size", opt_set_send_buf_size},
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
|
@ -88,6 +88,8 @@ static t_opt optset[] = {
|
||||
{"ipv6-add-membership", opt_set_ip6_add_membership},
|
||||
{"ipv6-drop-membership", opt_set_ip6_drop_membersip},
|
||||
{"ipv6-v6only", opt_set_ip6_v6only},
|
||||
{"recv-buffer-size", opt_set_recv_buf_size},
|
||||
{"send-buffer-size", opt_set_send_buf_size},
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
@ -104,6 +106,8 @@ static t_opt optget[] = {
|
||||
{"ipv6-multicast-hops", opt_get_ip6_unicast_hops},
|
||||
{"ipv6-multicast-loop", opt_get_ip6_multicast_loop},
|
||||
{"ipv6-v6only", opt_get_ip6_v6only},
|
||||
{"recv-buffer-size", opt_get_recv_buf_size},
|
||||
{"send-buffer-size", opt_get_send_buf_size},
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user