Use core replacements for std members
[rust-lightning] / lightning / src / ln / peer_handler.rs
index 2559acfc2dd5370b93d59d1cdb47a591c80a1c56..097e9928677bb4a288e8d44820a1fb7df9567e42 100644 (file)
@@ -32,9 +32,10 @@ use routing::network_graph::NetGraphMsgHandler;
 
 use std::collections::{HashMap,hash_map,HashSet,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 +784,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 +1421,8 @@ mod tests {
        use bitcoin::secp256k1::Secp256k1;
        use bitcoin::secp256k1::key::{SecretKey, PublicKey};
 
-       use std;
        use std::sync::{Arc, Mutex};
-       use std::sync::atomic::Ordering;
+       use core::sync::atomic::Ordering;
 
        #[derive(Clone)]
        struct FileDescriptor {
@@ -1431,8 +1435,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)
                }
        }