Update to 1.9.9.

This commit is contained in:
Vanilla I. Shu 2017-04-20 02:19:48 +00:00
parent abc6d672a6
commit 98a0f5eb65
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=438921
4 changed files with 123 additions and 6 deletions

View file

@ -2,7 +2,7 @@
# $FreeBSD$
PORTNAME= swoole
PORTVERSION= 1.9.8
PORTVERSION= 1.9.9
CATEGORIES= devel net
MAINTAINER= vanilla@FreeBSD.org

View file

@ -1,3 +1,3 @@
TIMESTAMP = 1489676691
SHA256 (PECL/swoole-1.9.8.tgz) = 6a5522de5af54b35b7fd615776e6aeb03378bd196bb75fa9703b1c5edfa38e47
SIZE (PECL/swoole-1.9.8.tgz) = 566294
TIMESTAMP = 1492612480
SHA256 (PECL/swoole-1.9.9.tgz) = a9a45e5492382b055a53c80dd439602b4a150cd32d74c0181147db38cf2fdabc
SIZE (PECL/swoole-1.9.9.tgz) = 575967

View file

@ -1,6 +1,6 @@
--- config.m4.orig 2017-02-24 07:21:23 UTC
--- config.m4.orig 2017-04-18 09:30:04 UTC
+++ config.m4
@@ -232,7 +232,7 @@ if test "$PHP_SWOOLE" != "no"; then
@@ -250,7 +250,7 @@ if test "$PHP_SWOOLE" != "no"; then
AC_CHECK_LIB(c, poll, AC_DEFINE(HAVE_POLL, 1, [have poll]))
AC_CHECK_LIB(c, sendfile, AC_DEFINE(HAVE_SENDFILE, 1, [have sendfile]))
AC_CHECK_LIB(c, kqueue, AC_DEFINE(HAVE_KQUEUE, 1, [have kqueue]))

View file

@ -0,0 +1,117 @@
--- src/network/ReactorThread.c.orig 2017-04-20 02:12:07 UTC
+++ src/network/ReactorThread.c
@@ -1263,7 +1263,6 @@ int swReactorThread_dispatch(swConnectio
#ifdef SW_USE_RINGBUFFER
swServer *serv = SwooleG.serv;
swReactorThread *thread = swServer_get_thread(serv, SwooleTG.id);
- int target_worker_id = swServer_worker_schedule(serv, conn->fd);
swPackage package;
package.length = length;
@@ -1271,11 +1270,11 @@ int swReactorThread_dispatch(swConnectio
task.data.info.type = SW_EVENT_PACKAGE;
task.data.info.len = sizeof(package);
- task.target_worker_id = target_worker_id;
- //swoole_dump_bin(package.data, 's', buffer->length);
memcpy(package.data, data, package.length);
memcpy(task.data.data, &package, sizeof(package));
+
+ task.target_worker_id = swServer_worker_schedule(serv, conn->fd, &task.data);
//dispatch failed, free the memory.
if (factory->dispatch(factory, &task) < 0)
@@ -1335,92 +1334,6 @@ int swReactorThread_dispatch(swConnectio
return SW_OK;
}
-#if 0
-int swReactorThread_dispatch_array_buffer(swReactorThread *thread, swConnection *conn)
-{
- swDispatchData task;
- swFactory *factory = SwooleG.factory;
-
- task.data.info.fd = conn->fd;
- task.data.info.from_id = conn->from_id;
-
- swBuffer *buffer = conn->in_buffer;
- swBuffer_trunk *trunk = swBuffer_get_trunk(buffer);
-
-#ifdef SW_USE_RINGBUFFER
- swServer *serv = SwooleG.serv;
- uint16_t target_worker_id = swServer_worker_schedule(serv, conn->fd);
- swPackage package;
-
- package.length = 0;
- package.data = swReactorThread_alloc(thread, buffer->length);
-
- task.data.info.type = SW_EVENT_PACKAGE;
-
- while (trunk != NULL)
- {
- task.data.info.len = trunk->length;
- memcpy(package.data + package.length, trunk->store.ptr, trunk->length);
- package.length += trunk->length;
-
- swBuffer_pop_trunk(buffer, trunk);
- trunk = swBuffer_get_trunk(buffer);
- }
- task.data.info.len = sizeof(package);
- task.target_worker_id = target_worker_id;
- memcpy(task.data.data, &package, sizeof(package));
- //swWarn("[ReactorThread] copy_n=%d", package.length);
- //dispatch failed, free the memory.
- if (factory->dispatch(factory, &task) < 0)
- {
- thread->buffer_input->free(thread->buffer_input, package.data);
- }
- else
- {
- return SW_OK;
- }
-#else
- int ret;
- task.data.info.type = SW_EVENT_PACKAGE_START;
- task.target_worker_id = -1;
-
- /**
- * lock target
- */
- SwooleTG.factory_lock_target = 1;
-
- while (trunk != NULL)
- {
- task.data.info.fd = conn->fd;
- task.data.info.len = trunk->length;
- memcpy(task.data.data, trunk->store.ptr, task.data.info.len);
- //package end
- if (trunk->next == NULL)
- {
- task.data.info.type = SW_EVENT_PACKAGE_END;
- }
- ret = factory->dispatch(factory, &task);
- //TODO: 处理数据失败,数据将丢失
- if (ret < 0)
- {
- swWarn("factory->dispatch() failed.");
- }
- swBuffer_pop_trunk(buffer, trunk);
- trunk = swBuffer_get_trunk(buffer);
-
- swTrace("send2worker[trunk_num=%d][type=%d]", buffer->trunk_num, task.data.info.type);
- }
- /**
- * unlock
- */
- SwooleTG.factory_target_worker = -1;
- SwooleTG.factory_lock_target = 0;
-
-#endif
- return SW_OK;
-}
-#endif
-
void swReactorThread_free(swServer *serv)
{
int i;