Beispiel #1
0
static void tcp_after_close(uv_handle_t* handle) {
  UNWRAP(handle);
  lev_handle_unref(L, (LevRefStruct_t*)self);
  if (push_callback(L, self, "on_close")) {
    lua_call(L, 1, 0);/*, -3*/
  }
}
Beispiel #2
0
static void on_exists_callback(uv_fs_t *req) {
    UNWRAP(req);
    int ret_n;

    push_callback_no_obj(L, holder, FSR__CBNAME);
    ret_n = push_exists_results(L, req);
    lua_call(L, ret_n, 0);

    uv_fs_req_cleanup(req);
    lev_handle_unref(L, (LevRefStruct_t *)holder);
}
Beispiel #3
0
static void on_connect(uv_connect_t* req, int status) {
  UNWRAP(req->handle);
  push_callback(L, self, "on_connect");
  if (!status) {
    lua_pushnil(L);
    /*printf("CONNECT ON FD: %d (ref:%d)\n", ( (uv_stream_t*)&self->handle )->fd, ((LevRefStruct_t*)self)->refCount);*/
  } else {
    lua_pushinteger(L, status);
    lev_handle_unref(L, (LevRefStruct_t*)self);
  }
  lua_call(L, 2, 0);/*, -4*/
}
Beispiel #4
0
static void on_exists_callback(uv_fs_t *req) {
  UNWRAP(req);
  int ret_n;

  if (LUA_NOREF == holder->threadref) {
    push_callback_no_obj(L, holder, FSR__CBNAME);
    ret_n = push_exists_results(L, req);
    lua_call(L, ret_n, 0);
  } else { /* coroutines */
    ret_n = push_exists_results(L, req);
    lua_resume(L, ret_n);
  }

  uv_fs_req_cleanup(req);
  lev_handle_unref(L, (LevRefStruct_t *)holder);
}
Beispiel #5
0
static void on_fs_callback(uv_fs_t *req) {
  UNWRAP(req);
  int ret_n;

  if (LUA_NOREF == holder->threadref || holder->use_lcb) {
    push_callback_no_obj(L, holder, FSR__CBNAME);
    ret_n = push_results(L, req);
    lua_call(L, ret_n, 0);
  } else { /* coroutines */
    ret_n = push_results(L, req);
    /*luv_lua_debug_stackdump(L, "RESUME");*/
    lua_resume(L, ret_n);
  }

  uv_fs_req_cleanup(req);
  lev_handle_unref(L, (LevRefStruct_t *)holder);
}