Handle all starting message cases
@@ -87,12 +87,12 @@ pub fn start_antenna_forwarding_proxy<S: 'static + std::marker::Send + ::std::ha
match ForwardingProtocolMessage::read_messages(&mut server_stream) {
Ok(messages) => {
// read messages will return a vec of at least one,
- if let Some(ForwardingProtocolMessage::ForwardMessage {
+ match messages.iter().next() {
+ Some(ForwardingProtocolMessage::ForwardMessage {
ip,
server_port: _server_port,
antenna_port,
- }) = messages.iter().next()
- {
+ }) => {
// if there are other messages in this batch safely form a slice
// to pass on
let slice = if messages.len() > 1 {
@@ -106,10 +106,14 @@ pub fn start_antenna_forwarding_proxy<S: 'static + std::marker::Send + ::std::ha
Ok(antenna_sockaddr) => {
forward_connections(antenna_sockaddr, server_stream, slice);
}
- Err(e) => send_error_message(&mut server_stream, format!("{:?}", e)),
+ Err(e) => {
+ send_error_message(&mut server_stream, format!("{:?}", e))
}
- } else {
- error!("Wrong start message!");
+ }
+ }
+ Some(ForwardingProtocolMessage::ForwardingCloseMessage) => {}
+ Some(m) => warn!("Wrong start message {:?}", m),
+ None => {}
}
}
Err(e) => {
