#20282: Make unbind work on windows
This commit is contained in:
parent
81579bd403
commit
028440d825
2 changed files with 6 additions and 6 deletions
|
|
@ -4,14 +4,16 @@
|
|||
|
||||
package akka.io
|
||||
|
||||
import java.nio.channels.{ SocketChannel, SelectionKey, ServerSocketChannel }
|
||||
import java.nio.channels.{ SelectionKey, ServerSocketChannel, SocketChannel }
|
||||
import java.net.InetSocketAddress
|
||||
|
||||
import scala.annotation.tailrec
|
||||
import scala.util.control.NonFatal
|
||||
import akka.actor._
|
||||
import akka.io.SelectionHandler._
|
||||
import akka.io.Tcp._
|
||||
import akka.dispatch.{ UnboundedMessageQueueSemantics, RequiresMessageQueue }
|
||||
import akka.dispatch.{ RequiresMessageQueue, UnboundedMessageQueueSemantics }
|
||||
import akka.util.Helpers
|
||||
|
||||
/**
|
||||
* INTERNAL API
|
||||
|
|
@ -96,6 +98,8 @@ private[io] class TcpListener(selectorRouter: ActorRef,
|
|||
case Unbind ⇒
|
||||
log.debug("Unbinding endpoint {}", localAddress)
|
||||
channel.close()
|
||||
// see https://github.com/akka/akka/issues/20282
|
||||
if (Helpers.isWindows) registration.enableInterest(1)
|
||||
sender() ! Unbound
|
||||
log.debug("Unbound endpoint {}, stopping listener", localAddress)
|
||||
context.stop(self)
|
||||
|
|
|
|||
|
|
@ -459,10 +459,6 @@ class TcpSpec extends AkkaSpec("akka.stream.materializer.subscription-timeout.ti
|
|||
}
|
||||
|
||||
"bind and unbind correctly" in EventFilter[BindException](occurrences = 2).intercept {
|
||||
if (Helpers.isWindows) {
|
||||
info("On Windows unbinding is not immediate")
|
||||
pending
|
||||
}
|
||||
val address = temporaryServerAddress()
|
||||
val probe1 = TestSubscriber.manualProbe[Tcp.IncomingConnection]()
|
||||
val bind = Tcp(system).bind(address.getHostName, address.getPort) // TODO getHostString in Java7
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue