Skip to content

Commit

Permalink
tiny improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
dunglas committed May 30, 2022
1 parent e57c3d4 commit 5aea181
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
9 changes: 7 additions & 2 deletions frankenphp.c
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,8 @@ uintptr_t frankenphp_request_shutdown()
free(ctx);
SG(server_context) = NULL;

ts_free_thread();

return rh;
}

Expand All @@ -353,14 +355,16 @@ int frankenphp_create_server_context(uintptr_t requests_chan, char* worker_filen
#endif

// todo: use a pool
frankenphp_server_context *ctx = SG(server_context) = malloc(sizeof(frankenphp_server_context));
frankenphp_server_context *ctx = calloc(1, sizeof(frankenphp_server_context));
if (ctx == NULL) return FAILURE;

ctx->request = 0;
ctx->requests_chan = requests_chan;
ctx->worker_filename = worker_filename;
ctx->cookie_data = NULL;

SG(server_context) = ctx;

return SUCCESS;
}

Expand Down Expand Up @@ -546,11 +550,12 @@ int frankenphp_request_startup()

fprintf(stderr, "problem in php_request_startup\n");

php_request_shutdown((void *) 0);
frankenphp_server_context *ctx = SG(server_context);
SG(server_context) = NULL;
free(ctx);

php_request_shutdown((void *) 0);

return FAILURE;
}

Expand Down
2 changes: 2 additions & 0 deletions frankenphp.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ import (
"strconv"
"strings"
"unsafe"
// debug
//_ "github.com/ianlancetaylor/cgosymbolizer"
)

type key int
Expand Down
2 changes: 1 addition & 1 deletion frankenphp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func runTest(t *testing.T, test func(func(http.ResponseWriter, *http.Request), *
opts.nbWorkers = 2
}
if opts.nbParrallelRequests == 0 {
opts.nbParrallelRequests = 5
opts.nbParrallelRequests = 10
}

cwd, _ := os.Getwd()
Expand Down

0 comments on commit 5aea181

Please sign in to comment.