vortexpy 3.4.6__tar.gz → 3.4.7__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- vortexpy-3.4.7/LICENSE +21 -0
- {vortexpy-3.4.6 → vortexpy-3.4.7}/PKG-INFO +7 -4
- {vortexpy-3.4.6 → vortexpy-3.4.7}/setup.py +1 -1
- {vortexpy-3.4.6 → vortexpy-3.4.7}/vortex/PayloadEnvelope.py +1 -0
- {vortexpy-3.4.6 → vortexpy-3.4.7}/vortex/VortexClientWebsocketFactory.py +9 -6
- {vortexpy-3.4.6 → vortexpy-3.4.7}/vortex/VortexFactory.py +8 -6
- {vortexpy-3.4.6 → vortexpy-3.4.7}/vortex/VortexPayloadProtocol.py +11 -14
- {vortexpy-3.4.6 → vortexpy-3.4.7}/vortex/VortexServer.py +3 -1
- {vortexpy-3.4.6 → vortexpy-3.4.7}/vortex/VortexServerWebsocket.py +63 -13
- {vortexpy-3.4.6 → vortexpy-3.4.7}/vortex/__init__.py +1 -1
- {vortexpy-3.4.6 → vortexpy-3.4.7}/vortexpy.egg-info/PKG-INFO +7 -4
- {vortexpy-3.4.6 → vortexpy-3.4.7}/vortexpy.egg-info/SOURCES.txt +1 -0
- {vortexpy-3.4.6 → vortexpy-3.4.7}/README.md +0 -0
- {vortexpy-3.4.6 → vortexpy-3.4.7}/setup.cfg +0 -0
- {vortexpy-3.4.6 → vortexpy-3.4.7}/vortex/DataWrapTuple.py +0 -0
- {vortexpy-3.4.6 → vortexpy-3.4.7}/vortex/DeferUtil.py +0 -0
- {vortexpy-3.4.6 → vortexpy-3.4.7}/vortex/Jsonable.py +0 -0
- {vortexpy-3.4.6 → vortexpy-3.4.7}/vortex/Payload.py +0 -0
- {vortexpy-3.4.6 → vortexpy-3.4.7}/vortex/PayloadEndpoint.py +0 -0
- {vortexpy-3.4.6 → vortexpy-3.4.7}/vortex/PayloadFilterKeys.py +0 -0
- {vortexpy-3.4.6 → vortexpy-3.4.7}/vortex/PayloadIO.py +0 -0
- {vortexpy-3.4.6 → vortexpy-3.4.7}/vortex/PayloadPriority.py +0 -0
- {vortexpy-3.4.6 → vortexpy-3.4.7}/vortex/PayloadResponse.py +0 -0
- {vortexpy-3.4.6 → vortexpy-3.4.7}/vortex/SerialiseUtil.py +0 -0
- {vortexpy-3.4.6 → vortexpy-3.4.7}/vortex/Tuple.py +0 -0
- {vortexpy-3.4.6 → vortexpy-3.4.7}/vortex/TupleAction.py +0 -0
- {vortexpy-3.4.6 → vortexpy-3.4.7}/vortex/TupleActionVortex.py +0 -0
- {vortexpy-3.4.6 → vortexpy-3.4.7}/vortex/TupleSelector.py +0 -0
- {vortexpy-3.4.6 → vortexpy-3.4.7}/vortex/VortexABC.py +0 -0
- {vortexpy-3.4.6 → vortexpy-3.4.7}/vortex/VortexClientHttp.py +0 -0
- {vortexpy-3.4.6 → vortexpy-3.4.7}/vortex/VortexClientTcp.py +0 -0
- {vortexpy-3.4.6 → vortexpy-3.4.7}/vortex/VortexConnectionABC.py +0 -0
- {vortexpy-3.4.6 → vortexpy-3.4.7}/vortex/VortexServerConnection.py +0 -0
- {vortexpy-3.4.6 → vortexpy-3.4.7}/vortex/VortexServerHttpResource.py +0 -0
- {vortexpy-3.4.6 → vortexpy-3.4.7}/vortex/VortexServerTcp.py +0 -0
- {vortexpy-3.4.6 → vortexpy-3.4.7}/vortex/VortexUtil.py +0 -0
- {vortexpy-3.4.6 → vortexpy-3.4.7}/vortex/VortexWritePushProducer.py +0 -0
- {vortexpy-3.4.6 → vortexpy-3.4.7}/vortex/data_loader/TupleDataLoader.py +0 -0
- {vortexpy-3.4.6 → vortexpy-3.4.7}/vortex/data_loader/TupleDataLoaderDelegate.py +0 -0
- {vortexpy-3.4.6 → vortexpy-3.4.7}/vortex/data_loader/TupleDataLoaderTupleABC.py +0 -0
- {vortexpy-3.4.6 → vortexpy-3.4.7}/vortex/data_loader/__init__.py +0 -0
- {vortexpy-3.4.6 → vortexpy-3.4.7}/vortex/handler/TupleActionProcessor.py +0 -0
- {vortexpy-3.4.6 → vortexpy-3.4.7}/vortex/handler/TupleActionProcessorProxy.py +0 -0
- {vortexpy-3.4.6 → vortexpy-3.4.7}/vortex/handler/TupleDataActionClient.py +0 -0
- {vortexpy-3.4.6 → vortexpy-3.4.7}/vortex/handler/TupleDataObservableCache.py +0 -0
- {vortexpy-3.4.6 → vortexpy-3.4.7}/vortex/handler/TupleDataObservableHandler.py +0 -0
- {vortexpy-3.4.6 → vortexpy-3.4.7}/vortex/handler/TupleDataObservableProxyHandler.py +0 -0
- {vortexpy-3.4.6 → vortexpy-3.4.7}/vortex/handler/TupleDataObserverClient.py +0 -0
- {vortexpy-3.4.6 → vortexpy-3.4.7}/vortex/handler/__init__.py +0 -0
- {vortexpy-3.4.6 → vortexpy-3.4.7}/vortex/restful/GzippedDataHttpClient.py +0 -0
- {vortexpy-3.4.6 → vortexpy-3.4.7}/vortex/restful/GzippedDataHttpClientTest.py +0 -0
- {vortexpy-3.4.6 → vortexpy-3.4.7}/vortex/restful/GzippedPayloadHttpClient.py +0 -0
- {vortexpy-3.4.6 → vortexpy-3.4.7}/vortex/restful/RestfulHttpClient.py +0 -0
- {vortexpy-3.4.6 → vortexpy-3.4.7}/vortex/restful/RestfulHttpClientTest.py +0 -0
- {vortexpy-3.4.6 → vortexpy-3.4.7}/vortex/restful/RestfulResource.py +0 -0
- {vortexpy-3.4.6 → vortexpy-3.4.7}/vortex/restful/RestfulResourceTest.py +0 -0
- {vortexpy-3.4.6 → vortexpy-3.4.7}/vortex/restful/__init__.py +0 -0
- {vortexpy-3.4.6 → vortexpy-3.4.7}/vortex/rpc/RPC.py +0 -0
- {vortexpy-3.4.6 → vortexpy-3.4.7}/vortex/rpc/__init__.py +0 -0
- {vortexpy-3.4.6 → vortexpy-3.4.7}/vortex/rpc/test/RPCTest.py +0 -0
- {vortexpy-3.4.6 → vortexpy-3.4.7}/vortex/rpc/test/__init__.py +0 -0
- {vortexpy-3.4.6 → vortexpy-3.4.7}/vortex/sqla_orm/OrmCrudHandler.py +0 -0
- {vortexpy-3.4.6 → vortexpy-3.4.7}/vortex/sqla_orm/TupleProviderForDb.py +0 -0
- {vortexpy-3.4.6 → vortexpy-3.4.7}/vortex/sqla_orm/__init__.py +0 -0
- {vortexpy-3.4.6 → vortexpy-3.4.7}/vortex/storage/TupleStorageSqlite.py +0 -0
- {vortexpy-3.4.6 → vortexpy-3.4.7}/vortex/storage/__init__.py +0 -0
- {vortexpy-3.4.6 → vortexpy-3.4.7}/vortex/test/PayloadEndpointTest.py +0 -0
- {vortexpy-3.4.6 → vortexpy-3.4.7}/vortex/test/PayloadResponseTest.py +0 -0
- {vortexpy-3.4.6 → vortexpy-3.4.7}/vortex/test/PayloadTest.py +0 -0
- {vortexpy-3.4.6 → vortexpy-3.4.7}/vortex/test/PerformTestActionTuple.py +0 -0
- {vortexpy-3.4.6 → vortexpy-3.4.7}/vortex/test/PolymorphicTupleTypeFieldArgTest.py +0 -0
- {vortexpy-3.4.6 → vortexpy-3.4.7}/vortex/test/TestTuple.py +0 -0
- {vortexpy-3.4.6 → vortexpy-3.4.7}/vortex/test/TupleDataForTest.py +0 -0
- {vortexpy-3.4.6 → vortexpy-3.4.7}/vortex/test/TuplePerfTest.py +0 -0
- {vortexpy-3.4.6 → vortexpy-3.4.7}/vortex/test/TupleRestfulTest.py +0 -0
- {vortexpy-3.4.6 → vortexpy-3.4.7}/vortex/test/TupleTest.py +0 -0
- {vortexpy-3.4.6 → vortexpy-3.4.7}/vortex/test/VortexClientHttpTest.py +0 -0
- {vortexpy-3.4.6 → vortexpy-3.4.7}/vortex/test/VortexTcpMemoryLeakPayloadTest.py +0 -0
- {vortexpy-3.4.6 → vortexpy-3.4.7}/vortex/test/VortexTcpMemoryLeakRawTest.py +0 -0
- {vortexpy-3.4.6 → vortexpy-3.4.7}/vortex/test/VortexTest.py +0 -0
- {vortexpy-3.4.6 → vortexpy-3.4.7}/vortex/test/__init__.py +0 -0
- {vortexpy-3.4.6 → vortexpy-3.4.7}/vortex/test/vortexjs/TupleActionProcessorTestHandler.py +0 -0
- {vortexpy-3.4.6 → vortexpy-3.4.7}/vortex/test/vortexjs/TupleDataObservableTestHandler.py +0 -0
- {vortexpy-3.4.6 → vortexpy-3.4.7}/vortex/test/vortexjs/VortexJSTupleLoaderTestHandler.py +0 -0
- {vortexpy-3.4.6 → vortexpy-3.4.7}/vortex/test/vortexjs/__init__.py +0 -0
- {vortexpy-3.4.6 → vortexpy-3.4.7}/vortexpy.egg-info/dependency_links.txt +0 -0
- {vortexpy-3.4.6 → vortexpy-3.4.7}/vortexpy.egg-info/requires.txt +0 -0
- {vortexpy-3.4.6 → vortexpy-3.4.7}/vortexpy.egg-info/top_level.txt +0 -0
vortexpy-3.4.7/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2016
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -1,13 +1,16 @@
|
|
|
1
|
-
Metadata-Version:
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
2
|
Name: vortexpy
|
|
3
|
-
Version: 3.4.
|
|
3
|
+
Version: 3.4.7
|
|
4
4
|
Summary: Synertys observable, routable, data serialisation and transport code.
|
|
5
5
|
Home-page: https://github.com/Synerty/vortexpy
|
|
6
6
|
Author: Synerty
|
|
7
7
|
Author-email: contact@synerty.com
|
|
8
8
|
License: UNKNOWN
|
|
9
|
-
Download-URL: https://github.com/Synerty/vortexpy/tarball/3.4.
|
|
10
|
-
Description: UNKNOWN
|
|
9
|
+
Download-URL: https://github.com/Synerty/vortexpy/tarball/3.4.7
|
|
11
10
|
Keywords: vortex,observable,http,compressed,synerty
|
|
12
11
|
Platform: UNKNOWN
|
|
13
12
|
Classifier: Programming Language :: Python :: 3.5
|
|
13
|
+
License-File: LICENSE
|
|
14
|
+
|
|
15
|
+
UNKNOWN
|
|
16
|
+
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
* Website : http://www.synerty.com
|
|
7
7
|
* Support : support@synerty.com
|
|
8
8
|
"""
|
|
9
|
+
|
|
9
10
|
import logging
|
|
10
11
|
import uuid
|
|
11
12
|
from collections import deque, namedtuple
|
|
@@ -317,12 +318,14 @@ class VortexClientWebsocketFactory(
|
|
|
317
318
|
assert self._server
|
|
318
319
|
assert vortexMsgs
|
|
319
320
|
|
|
320
|
-
#
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
vortexMsg
|
|
325
|
-
|
|
321
|
+
# If this transport requires base64 encoding
|
|
322
|
+
if self.requiresBase64Encoding:
|
|
323
|
+
for index, vortexMsg in enumerate(vortexMsgs):
|
|
324
|
+
if vortexMsg.startswith(b"{"):
|
|
325
|
+
vortexMsg = yield PayloadEnvelope.base64EncodeDefer(
|
|
326
|
+
vortexMsg
|
|
327
|
+
)
|
|
328
|
+
vortexMsgs[index] = vortexMsg + b"."
|
|
326
329
|
|
|
327
330
|
for vortexMsg in vortexMsgs:
|
|
328
331
|
self.__protocol.write(vortexMsg)
|
|
@@ -203,9 +203,9 @@ class _VortexFactoryVortexInfo:
|
|
|
203
203
|
|
|
204
204
|
self.__remoteVortexNameByUuid: dict[str, tuple[VortexABC, str]] = {}
|
|
205
205
|
|
|
206
|
-
self.__localVortexUuidsByName: dict[
|
|
207
|
-
|
|
208
|
-
|
|
206
|
+
self.__localVortexUuidsByName: dict[str, set[tuple[VortexABC, str]]] = (
|
|
207
|
+
defaultdict(set)
|
|
208
|
+
)
|
|
209
209
|
|
|
210
210
|
self.__localVortexNameByUuid: dict[str, tuple[VortexABC, str]] = {}
|
|
211
211
|
|
|
@@ -770,12 +770,14 @@ class VortexFactory:
|
|
|
770
770
|
base64VortexMsgs = vortexMsgs[:]
|
|
771
771
|
|
|
772
772
|
# If any transports require base64 encoding, then encode them all
|
|
773
|
+
|
|
773
774
|
if [v for v in vortexAndUuids if v[0].requiresBase64Encoding]:
|
|
774
775
|
for index, vortexMsg in enumerate(base64VortexMsgs):
|
|
775
776
|
if vortexMsg.startswith(b"{"):
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
777
|
+
base64VortexMsg = yield PayloadEnvelope.base64EncodeDefer(
|
|
778
|
+
vortexMsg
|
|
779
|
+
)
|
|
780
|
+
base64VortexMsgs[index] = base64VortexMsg + b"."
|
|
779
781
|
|
|
780
782
|
deferreds = []
|
|
781
783
|
for vortex, uuid in vortexAndUuids:
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
* Website : http://www.synerty.com
|
|
7
7
|
* Support : support@synerty.com
|
|
8
8
|
"""
|
|
9
|
+
|
|
9
10
|
import logging
|
|
10
11
|
from abc import ABCMeta, abstractmethod
|
|
11
12
|
from collections import deque
|
|
@@ -24,12 +25,11 @@ logger = logging.getLogger(name=__name__)
|
|
|
24
25
|
|
|
25
26
|
class VortexPayloadProtocol(Protocol, metaclass=ABCMeta):
|
|
26
27
|
def __init__(self, logger):
|
|
27
|
-
self._data = b""
|
|
28
28
|
self._serverVortexUuid = None
|
|
29
29
|
self._serverVortexName = None
|
|
30
30
|
self._logger = logger
|
|
31
31
|
|
|
32
|
-
self.
|
|
32
|
+
self._data = b""
|
|
33
33
|
self._vortexMsgsQueue = deque()
|
|
34
34
|
|
|
35
35
|
@abstractmethod
|
|
@@ -110,9 +110,6 @@ class VortexPayloadProtocol(Protocol, metaclass=ABCMeta):
|
|
|
110
110
|
self._logger.exception(reasonFailure.value)
|
|
111
111
|
|
|
112
112
|
def _processData(self):
|
|
113
|
-
if not self._data:
|
|
114
|
-
return
|
|
115
|
-
|
|
116
113
|
def getNextChunkIter():
|
|
117
114
|
try:
|
|
118
115
|
while True:
|
|
@@ -121,13 +118,14 @@ class VortexPayloadProtocol(Protocol, metaclass=ABCMeta):
|
|
|
121
118
|
# There is no '.' in it, wait for more data.
|
|
122
119
|
return
|
|
123
120
|
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
121
|
+
if self._data:
|
|
122
|
+
for nextChunk in getNextChunkIter():
|
|
123
|
+
vortexMsg = self._data[:nextChunk]
|
|
124
|
+
self._data = self._data[nextChunk + 1 :]
|
|
127
125
|
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
126
|
+
# If we get two heartbeats in a row, this will be false
|
|
127
|
+
if len(vortexMsg):
|
|
128
|
+
self._vortexMsgsQueue.append(vortexMsg)
|
|
131
129
|
|
|
132
130
|
if self._vortexMsgsQueue and not self._processVortexMsgs.running:
|
|
133
131
|
reactor.callLater(0, self._processVortexMsgs)
|
|
@@ -172,10 +170,9 @@ class VortexPayloadProtocol(Protocol, metaclass=ABCMeta):
|
|
|
172
170
|
name=self._serverVortexName, uuid=self._serverVortexUuid
|
|
173
171
|
)
|
|
174
172
|
|
|
175
|
-
def _deliverPayload(self,
|
|
176
|
-
|
|
173
|
+
def _deliverPayload(self, payloadEnvelope):
|
|
177
174
|
PayloadIO().process(
|
|
178
|
-
|
|
175
|
+
payloadEnvelope,
|
|
179
176
|
vortexUuid=self._serverVortexUuid,
|
|
180
177
|
vortexName=self._serverVortexName,
|
|
181
178
|
httpSession=None,
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
* Website : http://www.synerty.com
|
|
7
7
|
* Support : support@synerty.com
|
|
8
8
|
"""
|
|
9
|
+
|
|
9
10
|
import logging
|
|
10
11
|
import uuid
|
|
11
12
|
from typing import Any
|
|
@@ -314,9 +315,10 @@ class VortexServer(VortexABC):
|
|
|
314
315
|
if self.requiresBase64Encoding:
|
|
315
316
|
for index, vortexMsg in enumerate(vortexMsgs):
|
|
316
317
|
if vortexMsg.startswith(b"{"):
|
|
317
|
-
|
|
318
|
+
vortexMsg = yield PayloadEnvelope.base64EncodeDefer(
|
|
318
319
|
vortexMsg
|
|
319
320
|
)
|
|
321
|
+
vortexMsgs[index] = vortexMsg + b"."
|
|
320
322
|
|
|
321
323
|
if vortexUuid is None:
|
|
322
324
|
conns = self._connectionByVortexUuid.values()
|
|
@@ -6,11 +6,14 @@
|
|
|
6
6
|
* Website : http://www.synerty.com
|
|
7
7
|
* Support : support@synerty.com
|
|
8
8
|
"""
|
|
9
|
+
|
|
9
10
|
import logging
|
|
11
|
+
from collections import deque
|
|
10
12
|
from random import random
|
|
11
13
|
from urllib.parse import parse_qs
|
|
12
14
|
from urllib.parse import urlparse
|
|
13
15
|
|
|
16
|
+
from twisted.internet import reactor
|
|
14
17
|
from twisted.internet.defer import inlineCallbacks
|
|
15
18
|
from twisted.internet.protocol import Factory
|
|
16
19
|
from twisted.internet.protocol import Protocol
|
|
@@ -20,7 +23,7 @@ from twisted.web import resource
|
|
|
20
23
|
from twisted.web.server import NOT_DONE_YET
|
|
21
24
|
|
|
22
25
|
from txwebsocket.txws import WebSocketProtocol
|
|
23
|
-
from vortex.DeferUtil import vortexLogFailure
|
|
26
|
+
from vortex.DeferUtil import vortexLogFailure, nonConcurrentMethod
|
|
24
27
|
from vortex.PayloadEnvelope import PayloadEnvelope
|
|
25
28
|
from vortex.VortexServerConnection import VortexServerConnection
|
|
26
29
|
from .PayloadPriority import DEFAULT_PRIORITY
|
|
@@ -31,12 +34,12 @@ logger = logging.getLogger(name=__name__)
|
|
|
31
34
|
|
|
32
35
|
|
|
33
36
|
class VortexWebsocketServerProtocol(Protocol):
|
|
34
|
-
|
|
35
37
|
_DEBUG_LOGGING = False
|
|
36
38
|
|
|
37
39
|
def __init__(self, vortex: VortexServer, addr, httpSession=None) -> None:
|
|
38
40
|
self._vortex = vortex
|
|
39
41
|
self._addr = addr
|
|
42
|
+
self._logger = logger
|
|
40
43
|
|
|
41
44
|
self._conn = None
|
|
42
45
|
|
|
@@ -53,7 +56,9 @@ class VortexWebsocketServerProtocol(Protocol):
|
|
|
53
56
|
|
|
54
57
|
# Most messages don't need a buffer, but websockets can split messages
|
|
55
58
|
# around the 128kb mark
|
|
56
|
-
self.
|
|
59
|
+
self._data = b""
|
|
60
|
+
|
|
61
|
+
self._vortexMsgsQueue = deque()
|
|
57
62
|
|
|
58
63
|
def __initConnection(self):
|
|
59
64
|
# self.transport.setBinaryMode(True)
|
|
@@ -106,28 +111,74 @@ class VortexWebsocketServerProtocol(Protocol):
|
|
|
106
111
|
if self._httpSession:
|
|
107
112
|
self._httpSession.touch()
|
|
108
113
|
|
|
109
|
-
|
|
110
|
-
self._conn.beatReceived()
|
|
111
|
-
return
|
|
114
|
+
self._conn.beatReceived()
|
|
112
115
|
|
|
113
|
-
if
|
|
114
|
-
data
|
|
116
|
+
if data.startswith(b"{"):
|
|
117
|
+
# If the data starts with a { then the payloadEnvelope is al in
|
|
118
|
+
# the websocket message.
|
|
119
|
+
assert data.endswith(b"}"), (
|
|
120
|
+
"%s payloadEnvelope doesn't fit in websocket message" % __name__
|
|
121
|
+
)
|
|
122
|
+
self._vortexMsgsQueue.append(data)
|
|
123
|
+
else:
|
|
124
|
+
# Else it's a base64 encoded payloadEnvelope, and it will be separated
|
|
125
|
+
# by b'.'
|
|
126
|
+
self._data += data
|
|
115
127
|
|
|
116
|
-
|
|
117
|
-
d.addErrback(vortexLogFailure, logger, consumeError=True)
|
|
128
|
+
self._processData()
|
|
118
129
|
|
|
119
130
|
def connectionLost(self, reason=connectionDone):
|
|
120
131
|
if self._DEBUG_LOGGING:
|
|
121
132
|
logger.debug(
|
|
122
133
|
"VortexWebsocketServerProtocol.connectionLost reason=%s", reason
|
|
123
134
|
)
|
|
135
|
+
self._processData()
|
|
124
136
|
if self._conn:
|
|
125
137
|
self._conn.transportClosed()
|
|
126
138
|
self._vortex.connectionClosed(self._conn)
|
|
127
139
|
|
|
140
|
+
def _processData(self):
|
|
141
|
+
def getNextChunkIter():
|
|
142
|
+
try:
|
|
143
|
+
while True:
|
|
144
|
+
yield self._data.index(b".")
|
|
145
|
+
|
|
146
|
+
except ValueError:
|
|
147
|
+
# There is no '.' in it, wait for more data.
|
|
148
|
+
return
|
|
149
|
+
|
|
150
|
+
if self._data:
|
|
151
|
+
for nextChunk in getNextChunkIter():
|
|
152
|
+
vortexMsg = self._data[:nextChunk]
|
|
153
|
+
self._data = self._data[nextChunk + 1 :]
|
|
154
|
+
|
|
155
|
+
# If we get two heartbeats in a row, this will be false
|
|
156
|
+
if len(vortexMsg):
|
|
157
|
+
self._vortexMsgsQueue.append(vortexMsg)
|
|
158
|
+
|
|
159
|
+
if self._vortexMsgsQueue and not self._processVortexMsgs.running:
|
|
160
|
+
reactor.callLater(0, self._processVortexMsgs)
|
|
161
|
+
|
|
128
162
|
@inlineCallbacks
|
|
129
|
-
|
|
130
|
-
|
|
163
|
+
@nonConcurrentMethod
|
|
164
|
+
def _processVortexMsgs(self):
|
|
165
|
+
while self._vortexMsgsQueue:
|
|
166
|
+
vortexMsg = self._vortexMsgsQueue.popleft()
|
|
167
|
+
|
|
168
|
+
try:
|
|
169
|
+
payloadEnvelope = yield PayloadEnvelope().fromVortexMsgDefer(
|
|
170
|
+
vortexMsg
|
|
171
|
+
)
|
|
172
|
+
|
|
173
|
+
self._deliverPayload(payloadEnvelope)
|
|
174
|
+
|
|
175
|
+
except Exception as e:
|
|
176
|
+
print(vortexMsg)
|
|
177
|
+
print(e)
|
|
178
|
+
self._logger.exception(e)
|
|
179
|
+
raise
|
|
180
|
+
|
|
181
|
+
def _deliverPayload(self, payloadEnvelope):
|
|
131
182
|
self._vortex.payloadReveived(
|
|
132
183
|
httpSession=self._httpSession,
|
|
133
184
|
vortexUuid=self._remoteVortexUuid,
|
|
@@ -188,7 +239,6 @@ class VortexWebSocketUpgradeResource(resource.Resource):
|
|
|
188
239
|
self._websocketFactory = websocketFactory
|
|
189
240
|
|
|
190
241
|
def render(self, request):
|
|
191
|
-
|
|
192
242
|
from vortex.VortexFactory import VortexFactory
|
|
193
243
|
|
|
194
244
|
if not VortexFactory.canConnect(str(request.client.host)):
|
|
@@ -1,13 +1,16 @@
|
|
|
1
|
-
Metadata-Version:
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
2
|
Name: vortexpy
|
|
3
|
-
Version: 3.4.
|
|
3
|
+
Version: 3.4.7
|
|
4
4
|
Summary: Synertys observable, routable, data serialisation and transport code.
|
|
5
5
|
Home-page: https://github.com/Synerty/vortexpy
|
|
6
6
|
Author: Synerty
|
|
7
7
|
Author-email: contact@synerty.com
|
|
8
8
|
License: UNKNOWN
|
|
9
|
-
Download-URL: https://github.com/Synerty/vortexpy/tarball/3.4.
|
|
10
|
-
Description: UNKNOWN
|
|
9
|
+
Download-URL: https://github.com/Synerty/vortexpy/tarball/3.4.7
|
|
11
10
|
Keywords: vortex,observable,http,compressed,synerty
|
|
12
11
|
Platform: UNKNOWN
|
|
13
12
|
Classifier: Programming Language :: Python :: 3.5
|
|
13
|
+
License-File: LICENSE
|
|
14
|
+
|
|
15
|
+
UNKNOWN
|
|
16
|
+
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|