apple / swift-nio

Event-driven network application framework for high performance protocol servers & clients, non-blocking.
https://swiftpackageindex.com/apple/swift-nio/documentation
Apache License 2.0
8k stars 652 forks source link

Calling write on a ServerSocketChannel fatal errors with bogus message #222

Closed weissi closed 6 years ago

weissi commented 6 years ago

Expected behavior

Calling write on a ServerSocketChannel should fail the promise with ChannelError.unsupportedOperation.

Actual behavior

It fatal errors with a bogus message that suggests the subclass (which is ServerSocketChannel must implement a method)

Steps to reproduce

  1. create a server bootstrap
  2. bind
  3. .wait/.then
  4. write to the Channel returned (which is a ServerSocketChannel)

If possible, minimal yet complete reproducer code (or URL to code)

    let bootstrap = ServerBootstrap(group: group)
       .childChannelOption(ChannelOptions.socket(SocketOptionLevel(SOL_SOCKET), SO_REUSEADDR), value: 1)
    defer {
        try! group.syncShutdownGracefully()
    }
    try! bootstrap.bind(host: "127.0.0.1", port: 12345).wait().write(NIOAny("foo bar")).wait()

then connect to port 12345

SwiftNIO version/commit hash

any

Swift & OS version (output of swift --version && uname -a)

any

normanmaurer commented 6 years ago

This was fixed