@@ -940,7 +940,21 @@ PHP_FUNCTION(swoole_server_set)
940
940
convert_to_long (* v );
941
941
SwooleG .task_ipc_mode = (int )Z_LVAL_PP (v );
942
942
}
943
- //max_conn
943
+ /**
944
+ * Temporary file directory for task_worker
945
+ */
946
+ if (zend_hash_find (vht , ZEND_STRS ("task_tmpdir" ), (void * * ) & v ) == SUCCESS )
947
+ {
948
+ convert_to_string (* v );
949
+ SwooleG .task_tmpdir = emalloc (SW_DIR_MAXLEN );
950
+ SwooleG .task_tmpdir_len = snprintf (SwooleG .task_tmpdir , SW_DIR_MAXLEN , "%s/task.XXXXXX" , Z_STRVAL_PP (v )) + 1 ;
951
+ }
952
+ else
953
+ {
954
+ SwooleG .task_tmpdir = strndup (SW_TASK_TMP_FILE , sizeof (SW_TASK_TMP_FILE ));
955
+ SwooleG .task_tmpdir_len = sizeof (SW_TASK_TMP_FILE );
956
+ }
957
+ //max_connection
944
958
if (zend_hash_find (vht , ZEND_STRS ("max_connection" ), (void * * )& v ) == SUCCESS ||
945
959
zend_hash_find (vht , ZEND_STRS ("max_conn" ), (void * * )& v ) == SUCCESS )
946
960
{
@@ -1800,7 +1814,7 @@ static int php_swoole_onTask(swServer *serv, swEventData *req)
1800
1814
if (swTaskWorker_is_large (req ))
1801
1815
{
1802
1816
int data_len ;
1803
- void * buf ;
1817
+ char * buf ;
1804
1818
swTaskWorker_large_unpack (req , emalloc , buf , data_len );
1805
1819
1806
1820
/**
@@ -1868,7 +1882,7 @@ static int php_swoole_onFinish(swServer *serv, swEventData *req)
1868
1882
if (swTaskWorker_is_large (req ))
1869
1883
{
1870
1884
int data_len ;
1871
- void * buf ;
1885
+ char * buf ;
1872
1886
swTaskWorker_large_unpack (req , emalloc , buf , data_len );
1873
1887
1874
1888
/**
@@ -2927,7 +2941,7 @@ PHP_FUNCTION(swoole_server_taskwait)
2927
2941
if (swTaskWorker_is_large (task_result ))
2928
2942
{
2929
2943
int data_len ;
2930
- void * buf ;
2944
+ char * buf ;
2931
2945
swTaskWorker_large_unpack (task_result , emalloc , buf , data_len );
2932
2946
/**
2933
2947
* unpack failed
@@ -2937,7 +2951,7 @@ PHP_FUNCTION(swoole_server_taskwait)
2937
2951
efree (buf );
2938
2952
RETURN_FALSE ;
2939
2953
}
2940
- RETURN_STRINGL (buf , data_len , 0 );
2954
+ RETURN_STRINGL (buf , data_len , 0 );
2941
2955
}
2942
2956
else
2943
2957
{
0 commit comments