Changeset 202f85178854db96b302a656508cc591b67a143e
- Timestamp:
- 09/16/09 04:12:39
(4 years ago)
- Author:
- Theo Schlossnagle <jesus@omniti.com>
- git-committer:
- Theo Schlossnagle <jesus@omniti.com> 1253074359 +0000
- git-parent:
[6492d5caf9dd0d182d061d1650520854f06e2b72]
- git-author:
- Theo Schlossnagle <jesus@omniti.com> 1253074359 +0000
- Message:
fix was small (strdup, stupid) and some other cleanup, fixes #179
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r49a6c7b |
r202f851 |
|
| 452 | 452 | lua_module_closure_t *lmc; |
|---|
| 453 | 453 | |
|---|
| | 454 | noit_lua_init(); |
|---|
| | 455 | |
|---|
| 454 | 456 | lmc = noit_image_get_userdata(i); |
|---|
| 455 | 457 | L = lmc->lua_state; |
|---|
| … | … | |
| 593 | 595 | noit_lua_resume(noit_lua_check_info_t *ci, int nargs) { |
|---|
| 594 | 596 | int result = -1, base; |
|---|
| | 597 | noit_module_t *self; |
|---|
| 595 | 598 | noit_check_t *check; |
|---|
| 596 | 599 | check = ci->check; |
|---|
| … | … | |
| 619 | 622 | if(err) { |
|---|
| 620 | 623 | free(ci->current.status); |
|---|
| 621 | | ci->current.status = (char *)err; |
|---|
| | 624 | ci->current.status = strdup(err); |
|---|
| 622 | 625 | } |
|---|
| 623 | 626 | } |
|---|
| … | … | |
| 625 | 628 | break; |
|---|
| 626 | 629 | } |
|---|
| | 630 | |
|---|
| | 631 | self = ci->self; |
|---|
| | 632 | check = ci->check; |
|---|
| 627 | 633 | cancel_coro(ci); |
|---|
| 628 | | |
|---|
| 629 | | noit_lua_log_results(ci->self, ci->check); |
|---|
| 630 | | noit_lua_module_cleanup(ci->self, ci->check); |
|---|
| | 634 | noit_lua_log_results(self, check); |
|---|
| | 635 | noit_lua_module_cleanup(self, check); |
|---|
| 631 | 636 | ci = NULL; /* we freed it... explode if someone uses it before we return */ |
|---|
| 632 | 637 | check->flags &= ~NP_RUNNING; |
|---|
| … | … | |
| 638 | 643 | noit_lua_check_timeout(eventer_t e, int mask, void *closure, |
|---|
| 639 | 644 | struct timeval *now) { |
|---|
| | 645 | noit_module_t *self; |
|---|
| 640 | 646 | noit_check_t *check; |
|---|
| 641 | 647 | struct nl_intcl *int_cl = closure; |
|---|
| … | … | |
| 645 | 651 | ci->timed_out = 1; |
|---|
| 646 | 652 | noit_lua_check_deregister_event(ci, e, 0); |
|---|
| | 653 | |
|---|
| | 654 | self = ci->self; |
|---|
| | 655 | check = ci->check; |
|---|
| | 656 | |
|---|
| 647 | 657 | if(ci->coro_state) { |
|---|
| 648 | 658 | /* Our coro is still "in-flight". To fix this we will unreference |
|---|
| … | … | |
| 652 | 662 | } |
|---|
| 653 | 663 | |
|---|
| 654 | | noit_lua_log_results(ci->self, ci->check); |
|---|
| 655 | | noit_lua_module_cleanup(ci->self, ci->check); |
|---|
| | 664 | noit_lua_log_results(self, check); |
|---|
| | 665 | noit_lua_module_cleanup(self, check); |
|---|
| 656 | 666 | check->flags &= ~NP_RUNNING; |
|---|
| 657 | 667 | |
|---|
| … | … | |
| 812 | 822 | static int |
|---|
| 813 | 823 | noit_lua_loader_onload(noit_image_t *self) { |
|---|
| 814 | | nlerr = noit_log_stream_find("error/serf"); |
|---|
| 815 | | nldeb = noit_log_stream_find("debug/serf"); |
|---|
| | 824 | nlerr = noit_log_stream_find("error/lua"); |
|---|
| | 825 | nldeb = noit_log_stream_find("debug/lua"); |
|---|
| 816 | 826 | if(!nlerr) nlerr = noit_stderr; |
|---|
| 817 | 827 | if(!nldeb) nldeb = noit_debug; |
|---|
| racf04f0 |
r202f851 |
|
| 668 | 668 | return 0; |
|---|
| 669 | 669 | } |
|---|
| | 670 | |
|---|
| | 671 | void noit_lua_init() { |
|---|
| | 672 | eventer_name_callback("lua/sleep", nl_sleep_complete); |
|---|
| | 673 | eventer_name_callback("lua/socket_read", |
|---|
| | 674 | noit_lua_socket_read_complete); |
|---|
| | 675 | eventer_name_callback("lua/socket_write", |
|---|
| | 676 | noit_lua_socket_write_complete); |
|---|
| | 677 | eventer_name_callback("lua/socket_connect", |
|---|
| | 678 | noit_lua_socket_connect_complete); |
|---|
| | 679 | eventer_name_callback("lua/ssl_upgrade", noit_lua_ssl_upgrade); |
|---|
| | 680 | } |
|---|
| r88a7178 |
r202f851 |
|
| 93 | 93 | }; |
|---|
| 94 | 94 | |
|---|
| | 95 | void noit_lua_init(); |
|---|
| 95 | 96 | int luaopen_noit(lua_State *L); |
|---|
| 96 | 97 | noit_lua_check_info_t *get_ci(lua_State *L); |
|---|