Use hashbrown replacements for std equivalents
[rust-lightning] / lightning / src / ln / peer_handler.rs
index 2559acfc2dd5370b93d59d1cdb47a591c80a1c56..6e05b5498cf284391db623152242a571c57aa346 100644 (file)
@@ -30,11 +30,13 @@ use util::events::{MessageSendEvent, MessageSendEventsProvider};
 use util::logger::Logger;
 use routing::network_graph::NetGraphMsgHandler;
 
-use std::collections::{HashMap,hash_map,HashSet,LinkedList};
+use prelude::*;
+use alloc::collections::LinkedList;
 use std::sync::{Arc, Mutex};
-use std::sync::atomic::{AtomicUsize, Ordering};
-use std::{cmp, error, hash, fmt, mem};
-use std::ops::Deref;
+use core::sync::atomic::{AtomicUsize, Ordering};
+use core::{cmp, hash, fmt, mem};
+use core::ops::Deref;
+use std::error;
 
 use bitcoin::hashes::sha256::Hash as Sha256;
 use bitcoin::hashes::sha256::HashEngine as Sha256Engine;
@@ -783,6 +785,10 @@ impl<Descriptor: SocketDescriptor, CM: Deref, RM: Deref, L: Deref> PeerManager<D
                                                                                                        }
                                                                                                        msgs::DecodeError::BadLengthDescriptor => return Err(PeerHandleError { no_connection_possible: false }),
                                                                                                        msgs::DecodeError::Io(_) => return Err(PeerHandleError { no_connection_possible: false }),
+                                                                                                       msgs::DecodeError::UnsupportedCompression => {
+                                                                                                               log_debug!(self.logger, "We don't support zlib-compressed message fields, ignoring message");
+                                                                                                               continue;
+                                                                                                       }
                                                                                                }
                                                                                        }
                                                                                };
@@ -1416,9 +1422,9 @@ mod tests {
        use bitcoin::secp256k1::Secp256k1;
        use bitcoin::secp256k1::key::{SecretKey, PublicKey};
 
-       use std;
+       use prelude::*;
        use std::sync::{Arc, Mutex};
-       use std::sync::atomic::Ordering;
+       use core::sync::atomic::Ordering;
 
        #[derive(Clone)]
        struct FileDescriptor {
@@ -1431,8 +1437,8 @@ mod tests {
                }
        }
        impl Eq for FileDescriptor { }
-       impl std::hash::Hash for FileDescriptor {
-               fn hash<H: std::hash::Hasher>(&self, hasher: &mut H) {
+       impl core::hash::Hash for FileDescriptor {
+               fn hash<H: core::hash::Hasher>(&self, hasher: &mut H) {
                        self.fd.hash(hasher)
                }
        }