Skip to content

Commit

Permalink
Replace the protocol with header protocol (#254)
Browse files Browse the repository at this point in the history
* Replace the protocol with header protocol

* Revert changes

* Update storage client as well
  • Loading branch information
Aiee authored Jan 31, 2023
1 parent 923aa84 commit ef84e5f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
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

0 comments on commit ef84e5f

Please sign in to comment.