Changeset 202f85178854db96b302a656508cc591b67a143e

Show
Ignore:
Timestamp:
09/16/09 04:12:39 (5 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
  • src/modules/lua.c

    r49a6c7b r202f851  
    452452  lua_module_closure_t *lmc; 
    453453 
     454  noit_lua_init(); 
     455 
    454456  lmc = noit_image_get_userdata(i); 
    455457  L = lmc->lua_state; 
     
    593595noit_lua_resume(noit_lua_check_info_t *ci, int nargs) { 
    594596  int result = -1, base; 
     597  noit_module_t *self; 
    595598  noit_check_t *check; 
    596599  check = ci->check; 
     
    619622          if(err) { 
    620623            free(ci->current.status); 
    621             ci->current.status = (char *)err
     624            ci->current.status = strdup(err)
    622625          } 
    623626        } 
     
    625628      break; 
    626629  } 
     630 
     631  self = ci->self; 
     632  check = ci->check; 
    627633  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); 
    631636  ci = NULL; /* we freed it... explode if someone uses it before we return */ 
    632637  check->flags &= ~NP_RUNNING; 
     
    638643noit_lua_check_timeout(eventer_t e, int mask, void *closure, 
    639644                       struct timeval *now) { 
     645  noit_module_t *self; 
    640646  noit_check_t *check; 
    641647  struct nl_intcl *int_cl = closure; 
     
    645651  ci->timed_out = 1; 
    646652  noit_lua_check_deregister_event(ci, e, 0); 
     653 
     654  self = ci->self; 
     655  check = ci->check; 
     656 
    647657  if(ci->coro_state) { 
    648658    /* Our coro is still "in-flight". To fix this we will unreference 
     
    652662  } 
    653663 
    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); 
    656666  check->flags &= ~NP_RUNNING; 
    657667 
     
    812822static int 
    813823noit_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"); 
    816826  if(!nlerr) nlerr = noit_stderr; 
    817827  if(!nldeb) nldeb = noit_debug; 
  • src/modules/lua_noit.c

    racf04f0 r202f851  
    668668  return 0; 
    669669} 
     670 
     671void 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} 
  • src/modules/lua_noit.h

    r88a7178 r202f851  
    9393}; 
    9494 
     95void noit_lua_init(); 
    9596int luaopen_noit(lua_State *L); 
    9697noit_lua_check_info_t *get_ci(lua_State *L);