Class: Baykit::BayServer::Agent::Multiplexer::PlainTransporter
- Inherits:
-
Object
- Object
- Baykit::BayServer::Agent::Multiplexer::PlainTransporter
- Includes:
- Baykit::BayServer::Agent, Common::Transporter, Protocol, Util
- Defined in:
- lib/baykit/bayserver/agent/multiplexer/plain_transporter.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#closed ⇒ Object
readonly
Returns the value of attribute closed.
-
#multiplexer ⇒ Object
readonly
Returns the value of attribute multiplexer.
-
#read_buffer_size ⇒ Object
readonly
Returns the value of attribute read_buffer_size.
-
#server_mode ⇒ Object
readonly
Returns the value of attribute server_mode.
-
#ship ⇒ Object
readonly
Returns the value of attribute ship.
-
#trace_ssl ⇒ Object
readonly
Returns the value of attribute trace_ssl.
Instance Method Summary collapse
- #check_timeout(rd, duration_sec) ⇒ Object
- #get_read_buffer_size ⇒ Object
-
#init ⇒ Object
Implements Transporter.
-
#initialize(mpx, sip, server_mode, bufsiz, trace_ssl) ⇒ PlainTransporter
constructor
A new instance of PlainTransporter.
- #on_closed(rd) ⇒ Object
- #on_connected(rd) ⇒ Object
- #on_error(rd, e) ⇒ Object
- #on_read(rd, buf, adr) ⇒ Object
- #print_usage(indent) ⇒ Object
- #req_close(rd) ⇒ Object
- #req_connect(rd, adr) ⇒ Object
- #req_read(rd) ⇒ Object
- #req_write(rd, buf, adr, tag, &lis) ⇒ Object
-
#secure ⇒ Object
Custom methods.
- #to_s ⇒ Object
Methods included from Util::Reusable
Constructor Details
#initialize(mpx, sip, server_mode, bufsiz, trace_ssl) ⇒ PlainTransporter
Returns a new instance of PlainTransporter.
22 23 24 25 26 27 28 29 |
# File 'lib/baykit/bayserver/agent/multiplexer/plain_transporter.rb', line 22 def initialize(mpx, sip, server_mode, bufsiz, trace_ssl) @multiplexer = mpx @ship = sip @server_mode = server_mode @trace_ssl = trace_ssl @read_buffer_size = bufsiz @closed = false end |
Instance Attribute Details
#closed ⇒ Object (readonly)
Returns the value of attribute closed.
20 21 22 |
# File 'lib/baykit/bayserver/agent/multiplexer/plain_transporter.rb', line 20 def closed @closed end |
#multiplexer ⇒ Object (readonly)
Returns the value of attribute multiplexer.
15 16 17 |
# File 'lib/baykit/bayserver/agent/multiplexer/plain_transporter.rb', line 15 def multiplexer @multiplexer end |
#read_buffer_size ⇒ Object (readonly)
Returns the value of attribute read_buffer_size.
18 19 20 |
# File 'lib/baykit/bayserver/agent/multiplexer/plain_transporter.rb', line 18 def read_buffer_size @read_buffer_size end |
#server_mode ⇒ Object (readonly)
Returns the value of attribute server_mode.
16 17 18 |
# File 'lib/baykit/bayserver/agent/multiplexer/plain_transporter.rb', line 16 def server_mode @server_mode end |
#ship ⇒ Object (readonly)
Returns the value of attribute ship.
19 20 21 |
# File 'lib/baykit/bayserver/agent/multiplexer/plain_transporter.rb', line 19 def ship @ship end |
#trace_ssl ⇒ Object (readonly)
Returns the value of attribute trace_ssl.
17 18 19 |
# File 'lib/baykit/bayserver/agent/multiplexer/plain_transporter.rb', line 17 def trace_ssl @trace_ssl end |
Instance Method Details
#check_timeout(rd, duration_sec) ⇒ Object
112 113 114 115 |
# File 'lib/baykit/bayserver/agent/multiplexer/plain_transporter.rb', line 112 def check_timeout(rd, duration_sec) check_rudder rd return @ship.check_timeout(duration_sec) end |
#get_read_buffer_size ⇒ Object
117 118 119 |
# File 'lib/baykit/bayserver/agent/multiplexer/plain_transporter.rb', line 117 def get_read_buffer_size return @read_buffer_size end |
#init ⇒ Object
Implements Transporter
39 40 41 |
# File 'lib/baykit/bayserver/agent/multiplexer/plain_transporter.rb', line 39 def init end |
#on_closed(rd) ⇒ Object
86 87 88 89 |
# File 'lib/baykit/bayserver/agent/multiplexer/plain_transporter.rb', line 86 def on_closed(rd) check_rudder rd @ship.notify_close end |
#on_connected(rd) ⇒ Object
43 44 45 46 47 48 |
# File 'lib/baykit/bayserver/agent/multiplexer/plain_transporter.rb', line 43 def on_connected(rd) BayLog.trace("%s onConnect", self) check_rudder rd return @ship.notify_connect end |
#on_error(rd, e) ⇒ Object
81 82 83 84 |
# File 'lib/baykit/bayserver/agent/multiplexer/plain_transporter.rb', line 81 def on_error(rd, e) check_rudder rd @ship.notify_error(e) end |
#on_read(rd, buf, adr) ⇒ Object
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 |
# File 'lib/baykit/bayserver/agent/multiplexer/plain_transporter.rb', line 50 def on_read(rd, buf, adr) BayLog.debug("%s onRead", self) check_rudder rd if buf.length == 0 return @ship.notify_eof else begin return @ship.notify_read(buf) rescue UpgradeException => e BayLog.debug("%s Protocol upgrade", @ship) return @ship.notify_read(buf) rescue ProtocolException => e close = @ship.notify_protocol_error(e) if !close && @server_mode return NextSocketAction::CONTINUE else return NextSocketAction::CLOSE end rescue IOError => e # IOError which occur in notifyRead must be distinguished from # IOError which occur in handshake or readNonBlock. on_error(rd, e) return NextSocketAction::CLOSE end end end |
#print_usage(indent) ⇒ Object
121 122 |
# File 'lib/baykit/bayserver/agent/multiplexer/plain_transporter.rb', line 121 def print_usage(indent) end |
#req_close(rd) ⇒ Object
106 107 108 109 110 |
# File 'lib/baykit/bayserver/agent/multiplexer/plain_transporter.rb', line 106 def req_close(rd) check_rudder rd @closed = true @multiplexer.req_close(rd) end |
#req_connect(rd, adr) ⇒ Object
91 92 93 94 |
# File 'lib/baykit/bayserver/agent/multiplexer/plain_transporter.rb', line 91 def req_connect(rd, adr) check_rudder rd @multiplexer.req_connect(rd, adr) end |
#req_read(rd) ⇒ Object
96 97 98 99 |
# File 'lib/baykit/bayserver/agent/multiplexer/plain_transporter.rb', line 96 def req_read(rd) check_rudder rd @multiplexer.req_read(rd) end |
#req_write(rd, buf, adr, tag, &lis) ⇒ Object
101 102 103 104 |
# File 'lib/baykit/bayserver/agent/multiplexer/plain_transporter.rb', line 101 def req_write(rd, buf, adr, tag, &lis) check_rudder rd @multiplexer.req_write(rd, buf, adr, tag, &lis) end |
#secure ⇒ Object
Custom methods
128 129 130 |
# File 'lib/baykit/bayserver/agent/multiplexer/plain_transporter.rb', line 128 def secure() return false end |
#to_s ⇒ Object
31 32 33 |
# File 'lib/baykit/bayserver/agent/multiplexer/plain_transporter.rb', line 31 def to_s return "tp[#{@ship}]" end |