Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace the protocol with header protocol #254

Merged
merged 4 commits into from
Jan 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions nebula3/gclient/net/Connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@

import time

from nebula3.fbthrift.transport import TSocket, TTransport, TSSLSocket
from nebula3.fbthrift.transport import TSocket, TSSLSocket, THeaderTransport
from nebula3.fbthrift.transport.TTransport import TTransportException
from nebula3.fbthrift.protocol import TBinaryProtocol
from nebula3.fbthrift.protocol import THeaderProtocol

from nebula3.common.ttypes import ErrorCode
from nebula3.graph import GraphService
Expand Down Expand Up @@ -77,8 +77,9 @@ def open_SSL(self, ip, port, timeout, ssl_config=None):
s = TSocket.TSocket(self._ip, self._port)
if timeout > 0:
s.setTimeout(timeout)
transport = TTransport.TBufferedTransport(s)
protocol = TBinaryProtocol.TBinaryProtocol(transport)
transport = THeaderTransport.THeaderTransport(s)
protocol = THeaderProtocol.THeaderProtocol(transport)

transport.open()
self._connection = GraphService.Client(protocol)
resp = self._connection.verifyClientVersion(VerifyClientVersionReq())
Expand Down
9 changes: 4 additions & 5 deletions nebula3/sclient/net/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,8 @@

from nebula3.Exception import InValidHostname
from nebula3.storage import GraphStorageService
from nebula3.storage.ttypes import ScanVertexRequest, ScanEdgeRequest
from nebula3.fbthrift.transport import TSocket, TTransport
from nebula3.fbthrift.protocol import TBinaryProtocol
from nebula3.fbthrift.transport import TSocket, THeaderTransport
from nebula3.fbthrift.protocol import THeaderProtocol


class GraphStorageConnection(object):
Expand All @@ -35,8 +34,8 @@ def open(self):
s = TSocket.TSocket(self._address.host, self._address.port)
if self._timeout > 0:
s.setTimeout(self._timeout)
transport = TTransport.TBufferedTransport(s)
protocol = TBinaryProtocol.TBinaryProtocol(transport)
transport = THeaderTransport.THeaderTransport(s)
protocol = THeaderProtocol.THeaderProtocol(transport)
transport.open()
self._connection = GraphStorageService.Client(protocol)
except Exception:
Expand Down