Skip to content
This repository has been archived by the owner on Dec 10, 2018. It is now read-only.

Commit

Permalink
Merge pull request #179 from air-upc/add_handshake_logic
Browse files Browse the repository at this point in the history
add handshake logic in tracker
  • Loading branch information
lxyu committed Jan 27, 2016
2 parents 70bfa0b + 3b09149 commit e3451b6
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
2 changes: 2 additions & 0 deletions thriftpy/contrib/tracking/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ def _negotiation(self):
self._oprot.write_message_begin(track_method, TMessageType.CALL,
self._seqid)
args = track_thrift.UpgradeArgs()
self.tracker.init_handshake_info(args)
args.write(self._oprot)
self._oprot.write_message_end()
self._oprot.trans.flush()
Expand Down Expand Up @@ -148,6 +149,7 @@ def _try_upgrade(self, iprot):

args = track_thrift.UpgradeArgs()
args.read(iprot)
self.tracker.handle_handshake_info(args)
result = track_thrift.UpgradeReply()
result.oneway = False

Expand Down
6 changes: 6 additions & 0 deletions thriftpy/contrib/tracking/tracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,12 @@ def get_request_id(self):
return ctx.header.request_id
return str(uuid.uuid4())

def init_handshake_info(self, handshake_obj):
pass

def handle_handshake_info(self, handshake_obj):
pass


class ConsoleTracker(TrackerBase):
def record(self, header, exception):
Expand Down
4 changes: 3 additions & 1 deletion thriftpy/contrib/tracking/tracking.thrift
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,6 @@ struct RequestHeader {
* This is the struct that a successful upgrade will reply with.
*/
struct UpgradeReply {}
struct UpgradeArgs {}
struct UpgradeArgs {
1: string app_id
}

0 comments on commit e3451b6

Please sign in to comment.