 
     }
     
-    private func safeRegister(interested: InterestedEvent) {
+    private func safeRegister(interested: InterestedEvent) -> Bool {
         guard open else {
             interestedEvent = .None
-            return
+            return false
         }
         interestedEvent = interested
         do {
             try eventLoop.register(channel: self)
+            return true
         } catch let err {
             pipeline.fireErrorCaught(error: err)
             close0(error: err)
+            return false
         }
     }
 

    
    func registerOnEventLoop(initPipeline: (ChannelPipeline) throws ->()) {
        // Was not registered yet so do it now.
        safeRegister(interested: .Read)
        
        do {
            try initPipeline(pipeline)
        
            pipeline.fireChannelRegistered()
        } catch let err {
            pipeline.fireErrorCaught(error: err)
            close0()
        }
    }


        case .Write:
            safeReregister(interested: .All)
        case .None:
            safeReregister(interested: .Read)
        default:
            break
        }
