Skip to content

Commit

Permalink
Fixed SwooleG.type error.
Browse files Browse the repository at this point in the history
  • Loading branch information
matyhtf committed Nov 26, 2014
1 parent 5d04aa6 commit 00efaeb
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
2 changes: 0 additions & 2 deletions src/network/TaskWorker.c
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,6 @@ void swTaskWorker_onStart(swProcessPool *pool, int worker_id)
swWorker_onStart(serv);

current_worker = &pool->workers[worker_id];

SwooleG.process_type = SW_PROCESS_TASKWORKER;
}

void swTaskWorker_onStop(swProcessPool *pool, int worker_id)
Expand Down
10 changes: 9 additions & 1 deletion src/network/Worker.c
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,7 @@ void swWorker_onStart(swServer *serv)
*/
int i;
swWorker *worker;

for (i = 0; i < serv->worker_num + SwooleG.task_worker_num; i++)
{
worker = swServer_get_worker(serv, i);
Expand All @@ -240,7 +241,14 @@ void swWorker_onStart(swServer *serv)
}
}

SwooleG.process_type = SW_PROCESS_WORKER;
if (SwooleWG.id >= serv->worker_num)
{
SwooleG.process_type = SW_PROCESS_TASKWORKER;
}
else
{
SwooleG.process_type = SW_PROCESS_WORKER;
}

if (serv->onWorkerStart)
{
Expand Down
2 changes: 0 additions & 2 deletions swoole_server.c
Original file line number Diff line number Diff line change
Expand Up @@ -526,8 +526,6 @@ static void php_swoole_onWorkerStart(swServer *serv, int worker_id)
MAKE_STD_ZVAL(zworker_id);
ZVAL_LONG(zworker_id, worker_id);

printf("process_type=%d\n", SwooleG.process_type);

args[0] = &zserv;
zval_add_ref(&zserv);
args[1] = &zworker_id;
Expand Down

0 comments on commit 00efaeb

Please sign in to comment.