diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2019-06-17 16:25:07 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2019-06-22 10:57:29 +0100 |
commit | 4b75d23d067118e2874ec3b8726d49e3f185b811 (patch) | |
tree | b97d01b8b2cf4d1d6cb05a0e5b2fed32f368fa5a /src/lua/lua_http.c | |
parent | de721b490bce9f95385ab451da1190f934cf3425 (diff) | |
download | rspamd-4b75d23d067118e2874ec3b8726d49e3f185b811.tar.gz rspamd-4b75d23d067118e2874ec3b8726d49e3f185b811.zip |
[Project] Adopt Lua API
Diffstat (limited to 'src/lua/lua_http.c')
-rw-r--r-- | src/lua/lua_http.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/lua/lua_http.c b/src/lua/lua_http.c index 38072e177..ec42ab39e 100644 --- a/src/lua/lua_http.c +++ b/src/lua/lua_http.c @@ -67,10 +67,10 @@ struct lua_http_cbdata { struct rspamd_async_session *session; struct rspamd_symcache_item *item; struct rspamd_http_message *msg; - struct ev_loop *ev_base; + struct ev_loop *event_loop; struct rspamd_config *cfg; struct rspamd_task *task; - struct timeval tv; + ev_tstamp timeout; struct rspamd_cryptobox_keypair *local_kp; struct rspamd_cryptobox_pubkey *peer_pk; rspamd_inet_addr_t *addr; @@ -86,7 +86,7 @@ struct lua_http_cbdata { ref_entry_t ref; }; -static const int default_http_timeout = 5000; +static const gdouble default_http_timeout = 5.0; static struct rspamd_dns_resolver * lua_http_global_resolver (struct ev_loop *ev_base) @@ -451,7 +451,7 @@ lua_http_make_connection (struct lua_http_cbdata *cbd) rspamd_http_connection_write_message (cbd->conn, msg, cbd->host, cbd->mime_type, cbd, - &cbd->tv); + cbd->timeout); return TRUE; } @@ -717,7 +717,7 @@ lua_http_request (lua_State *L) lua_pushstring (L, "timeout"); lua_gettable (L, 1); if (lua_type (L, -1) == LUA_TNUMBER) { - timeout = lua_tonumber (L, -1) * 1000.; + timeout = lua_tonumber (L, -1); } lua_pop (L, 1); @@ -860,7 +860,7 @@ lua_http_request (lua_State *L) lua_gettable (L, 1); if (lua_type (L, -1) == LUA_TNUMBER) { - max_size = lua_tonumber (L, -1); + max_size = lua_tointeger (L, -1); } lua_pop (L, 1); @@ -943,9 +943,9 @@ lua_http_request (lua_State *L) cbd = g_malloc0 (sizeof (*cbd)); cbd->cbref = cbref; cbd->msg = msg; - cbd->ev_base = ev_base; + cbd->event_loop = ev_base; cbd->mime_type = mime_type; - msec_to_tv (timeout, &cbd->tv); + cbd->timeout = timeout; cbd->fd = -1; cbd->cfg = cfg; cbd->peer_pk = peer_key; |