Cleaning code for pull request

This commit is contained in:
Killian Richard 2020-07-03 11:29:28 +02:00
commit 1e607c6445
6 changed files with 27 additions and 40 deletions

View file

@ -570,8 +570,8 @@ parse_serve_args(const char *optarg, char **s_protocol, uint32_t *s_ip, uint16_t
char *ip = NULL; char *ip = NULL;
uint32_t ip_value; uint32_t ip_value;
char *port = NULL; char *port = NULL;
char **values; char **values;
values = str_split(optarg, ':'); values = str_split(optarg, ':');
if (values) { if (values) {
@ -755,8 +755,7 @@ scrcpy_parse_args(struct scrcpy_cli_args *args, int argc, char *argv[]) {
case OPT_SERVE: case OPT_SERVE:
if (!parse_serve_args(optarg, &opts->serve_protocol, &opts->serve_ip, &opts->serve_port)) { if (!parse_serve_args(optarg, &opts->serve_protocol, &opts->serve_ip, &opts->serve_port)) {
return false; return false;
} } else {
else {
opts->serve = true; opts->serve = true;
} }
break; break;

View file

@ -309,7 +309,7 @@ scrcpy(const struct scrcpy_options *options) {
} }
} }
if (!server_start(&server, options->serial, &params, serv)) { if (!server_start(&server, options->serial, &params)) {
return false; return false;
} }

View file

@ -350,7 +350,7 @@ run_wait_server(void *data) {
bool bool
server_start(struct server *server, const char *serial, server_start(struct server *server, const char *serial,
const struct server_params *params, struct serve* serve) { const struct server_params *params) {
server->port_range = params->port_range; server->port_range = params->port_range;
if (serial) { if (serial) {
@ -368,22 +368,10 @@ server_start(struct server *server, const char *serial,
goto error1; goto error1;
} }
/*server->serve = serve;
if (server->serve) {
if (server->serve->isServeReady == true) {
server->process = execute_server(server, params); server->process = execute_server(server, params);
if (server->process == PROCESS_NONE) { if (server->process == PROCESS_NONE) {
goto error2; goto error2;
} }
}
}
else {*/
// server will connect to our server socket
server->process = execute_server(server, params);
if (server->process == PROCESS_NONE) {
goto error2;
}
//}
// If the server process dies before connecting to the server socket, then // If the server process dies before connecting to the server socket, then
// the client will be stuck forever on accept(). To avoid the problem, we // the client will be stuck forever on accept(). To avoid the problem, we

View file

@ -61,7 +61,7 @@ server_init(struct server *server);
// push, enable tunnel et start the server // push, enable tunnel et start the server
bool bool
server_start(struct server *server, const char *serial, server_start(struct server *server, const char *serial,
const struct server_params *params, struct serve* serve); const struct server_params *params);
// block until the communication with the server is established // block until the communication with the server is established
bool bool