funcmike / rabbitmq-nio

A Swift implementation of AMQP 0.9.1 protocol: decoder + encoder and non-blocking client
Apache License 2.0
44 stars 8 forks source link

AMQPClient isConnect concurrency issue #10

Closed funcmike closed 1 year ago

funcmike commented 1 year ago

There is no guarantee to run code below in correct order.

self.connection = connection
self.isConnect.store(false, ordering: .relaxed)

Less fragile design is to just use locks and switch to state enum (proposed by @fabianfett )

    enum State {
        case connecting
        case connected(AMQPConnection)
        ...
    }