mirror of
https://github.com/valitydev/thrift.git
synced 2024-11-07 10:48:51 +00:00
Strip the rest of the empty () parens
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@668972 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
150af8b7c6
commit
d389f54f0a
@ -13,24 +13,24 @@ module Thrift
|
||||
data.send("#{k.to_s}=", v)
|
||||
end
|
||||
data.write(@oprot)
|
||||
@oprot.write_message_end()
|
||||
@oprot.trans.flush()
|
||||
@oprot.write_message_end
|
||||
@oprot.trans.flush
|
||||
end
|
||||
|
||||
def receive_message(result_klass)
|
||||
fname, mtype, rseqid = @iprot.read_message_begin()
|
||||
fname, mtype, rseqid = @iprot.read_message_begin
|
||||
handle_exception(mtype)
|
||||
result = result_klass.new
|
||||
result.read(@iprot)
|
||||
@iprot.read_message_end()
|
||||
@iprot.read_message_end
|
||||
return result
|
||||
end
|
||||
|
||||
def handle_exception(mtype)
|
||||
if mtype == MessageTypes::EXCEPTION
|
||||
x = ApplicationException.new()
|
||||
x = ApplicationException.new
|
||||
x.read(@iprot)
|
||||
@iprot.read_message_end()
|
||||
@iprot.read_message_end
|
||||
raise x
|
||||
end
|
||||
end
|
||||
|
@ -26,30 +26,30 @@ module Thrift
|
||||
end
|
||||
|
||||
def read(iprot)
|
||||
iprot.read_struct_begin()
|
||||
iprot.read_struct_begin
|
||||
while true
|
||||
fname, ftype, fid = iprot.read_field_begin()
|
||||
fname, ftype, fid = iprot.read_field_begin
|
||||
if (ftype === Types::STOP)
|
||||
break
|
||||
end
|
||||
if (fid == 1)
|
||||
if (ftype === Types::STRING)
|
||||
@message = iprot.read_string();
|
||||
@message = iprot.read_string;
|
||||
else
|
||||
iprot.skip(ftype)
|
||||
end
|
||||
elsif (fid == 2)
|
||||
if (ftype === Types::I32)
|
||||
@type = iprot.read_i32();
|
||||
@type = iprot.read_i32;
|
||||
else
|
||||
iprot.skip(ftype)
|
||||
end
|
||||
else
|
||||
iprot.skip(ftype)
|
||||
end
|
||||
iprot.read_field_end()
|
||||
iprot.read_field_end
|
||||
end
|
||||
iprot.read_struct_end()
|
||||
iprot.read_struct_end
|
||||
end
|
||||
|
||||
def write(oprot)
|
||||
@ -57,15 +57,15 @@ module Thrift
|
||||
if (@message != nil)
|
||||
oprot.write_field_begin('message', Types::STRING, 1)
|
||||
oprot.write_string(@message)
|
||||
oprot.write_field_end()
|
||||
oprot.write_field_end
|
||||
end
|
||||
if (@type != nil)
|
||||
oprot.write_field_begin('type', Types::I32, 2)
|
||||
oprot.write_i32(@type)
|
||||
oprot.write_field_end()
|
||||
oprot.write_field_end
|
||||
end
|
||||
oprot.write_field_stop()
|
||||
oprot.write_struct_end()
|
||||
oprot.write_field_stop
|
||||
oprot.write_struct_end
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -5,18 +5,18 @@ module Thrift
|
||||
end
|
||||
|
||||
def process(iprot, oprot)
|
||||
name, type, seqid = iprot.read_message_begin()
|
||||
name, type, seqid = iprot.read_message_begin
|
||||
if respond_to?("process_#{name}")
|
||||
send("process_#{name}", seqid, iprot, oprot)
|
||||
return true
|
||||
else
|
||||
iprot.skip(Types::STRUCT)
|
||||
iprot.read_message_end()
|
||||
iprot.read_message_end
|
||||
x = ApplicationException.new(ApplicationException::UNKNOWN_METHOD, 'Unknown function '+name)
|
||||
oprot.write_message_begin(name, MessageTypes::EXCEPTION, seqid)
|
||||
x.write(oprot)
|
||||
oprot.write_message_end()
|
||||
oprot.trans.flush()
|
||||
oprot.write_message_end
|
||||
oprot.trans.flush
|
||||
return
|
||||
end
|
||||
end
|
||||
@ -31,8 +31,8 @@ module Thrift
|
||||
def write_result(result, oprot, name, seqid)
|
||||
oprot.write_message_begin(name, MessageTypes::REPLY, seqid)
|
||||
result.write(oprot)
|
||||
oprot.write_message_end()
|
||||
oprot.trans.flush()
|
||||
oprot.write_message_end
|
||||
oprot.trans.flush
|
||||
end
|
||||
end
|
||||
deprecate_module! :TProcessor => Processor
|
||||
|
@ -19,14 +19,14 @@ module Thrift
|
||||
end
|
||||
|
||||
def read(iprot)
|
||||
iprot.read_struct_begin()
|
||||
iprot.read_struct_begin
|
||||
loop do
|
||||
fname, ftype, fid = iprot.read_field_begin()
|
||||
fname, ftype, fid = iprot.read_field_begin
|
||||
break if (ftype === Types::STOP)
|
||||
handle_message(iprot, fid, ftype)
|
||||
iprot.read_field_end()
|
||||
iprot.read_field_end
|
||||
end
|
||||
iprot.read_struct_end()
|
||||
iprot.read_struct_end
|
||||
end
|
||||
|
||||
def write(oprot)
|
||||
@ -42,8 +42,8 @@ module Thrift
|
||||
end
|
||||
end
|
||||
end
|
||||
oprot.write_field_stop()
|
||||
oprot.write_struct_end()
|
||||
oprot.write_field_stop
|
||||
oprot.write_struct_end
|
||||
end
|
||||
|
||||
def ==(other)
|
||||
|
@ -23,7 +23,7 @@ module Thrift
|
||||
@handle = handle
|
||||
end
|
||||
|
||||
def open()
|
||||
def open
|
||||
begin
|
||||
@handle = TCPSocket.new(@host, @port)
|
||||
rescue StandardError
|
||||
@ -31,7 +31,7 @@ module Thrift
|
||||
end
|
||||
end
|
||||
|
||||
def open?()
|
||||
def open?
|
||||
return !@handle.nil?
|
||||
end
|
||||
|
||||
@ -55,8 +55,8 @@ module Thrift
|
||||
end
|
||||
end
|
||||
|
||||
def close()
|
||||
@handle.close() unless @handle.nil?
|
||||
def close
|
||||
@handle.close unless @handle.nil?
|
||||
@handle = nil
|
||||
end
|
||||
end
|
||||
@ -68,22 +68,22 @@ module Thrift
|
||||
@handle = nil
|
||||
end
|
||||
|
||||
def listen()
|
||||
def listen
|
||||
@handle = TCPServer.new(nil, @port)
|
||||
end
|
||||
|
||||
def accept()
|
||||
def accept
|
||||
if (@handle != nil)
|
||||
sock = @handle.accept()
|
||||
trans = Socket.new()
|
||||
sock = @handle.accept
|
||||
trans = Socket.new
|
||||
trans.set_handle(sock)
|
||||
return trans
|
||||
end
|
||||
return nil
|
||||
end
|
||||
|
||||
def close()
|
||||
@handle.close() unless @handle.nil?
|
||||
def close
|
||||
@handle.close unless @handle.nil?
|
||||
end
|
||||
end
|
||||
deprecate_class! :TServerSocket => ServerSocket
|
||||
|
Loading…
Reference in New Issue
Block a user