84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
|
# File 'lib/ffwd/plugin/json.rb', line 84
def self.setup_input opts
opts[:host] ||= DEFAULT_HOST
opts[:port] ||= DEFAULT_PORT
kind = (opts[:kind] || DEFAULT_KIND).to_s
unless connection = KINDS[kind]
raise "No such protocol kind: #{kind}"
end
protocol = FFWD.parse_protocol opts[:protocol] || DEFAULT_PROTOCOL[kind]
if connection == FrameConnection and protocol != FFWD::UDP
log.warning "When using :frame kind, you should use the UDP protocol." +
" Not #{protocol.family.to_s.upcase}"
end
if connection == LineConnection and protocol != FFWD::TCP
log.warning "When using :line kind, you should use the TCP protocol. " +
"Not #{protocol.family.to_s.upcase}"
end
protocol.bind opts, log, connection
end
|