You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
letcommand=SWIMNIOWriteCommand(message: message, to:self.swimNode, replyTimeout: timeout.toNIO, replyCallback:{ reply in
45
-
switch reply {
46
-
case.success(.response(.nack(_, _))):
47
-
continuation.resume(throwing:SWIMNIOIllegalMessageTypeError("Unexpected .nack reply to .ping message! Was: \(reply)"))
48
-
49
-
case.success(.response(let pingResponse)):
55
+
letcommand=SWIMNIOWriteCommand(message: message, to: swimNode, replyTimeout: timeout)
56
+
tryawait outbound.write(command)
57
+
fortryawaitmessagein inbound {
58
+
switch message {
59
+
case.response(.nack(_, _)):
60
+
throwSWIMNIOIllegalMessageTypeError("Unexpected .nack reply to .ping message! Was: \(message)")
61
+
case.response(let pingResponse):
50
62
assert(sequenceNumber == pingResponse.sequenceNumber,"callback invoked with not matching sequence number! Submitted with \(sequenceNumber) but invoked with \(pingResponse.sequenceNumber)!")
51
-
continuation.resume(returning: pingResponse)
52
-
53
-
case.failure(let error):
54
-
continuation.resume(throwing: error)
55
-
56
-
case.success(let other):
57
-
continuation.resume(throwing:
58
-
SWIMNIOIllegalMessageTypeError("Unexpected message, got: [\(other)]:\(reflecting:type(of: other)) while expected \(PingResponse<SWIM.NIOPeer,SWIM.NIOPeer>.self)"))
63
+
return pingResponse
64
+
default:
65
+
throwSWIMNIOIllegalMessageTypeError("Unexpected message, got: [\(message)]:\(reflecting:type(of: message)) while expected \(PingResponse<SWIM.NIOPeer,SWIM.NIOPeer>.self)")
59
66
}
60
-
})
61
-
62
-
self.channel.writeAndFlush(command, promise:nil)
67
+
}
68
+
throwSWIMNIOIllegalMessageTypeError("Unexpected message, got: [\(message)]:\(reflecting:type(of: message)) while expected \(PingResponse<SWIM.NIOPeer,SWIM.NIOPeer>.self)")
letcommand=SWIMNIOWriteCommand(message: message, to:self.node, replyTimeout: timeout.toNIO, replyCallback:{ reply in
76
-
switch reply {
77
-
case.success(.response(let pingResponse)):
81
+
letcommand=SWIMNIOWriteCommand(message: message, to: node, replyTimeout: timeout)
82
+
tryawait outbound.write(command)
83
+
fortryawaitmessagein inbound {
84
+
switch message {
85
+
case.response(let pingResponse):
78
86
assert(sequenceNumber == pingResponse.sequenceNumber,"callback invoked with not matching sequence number! Submitted with \(sequenceNumber) but invoked with \(pingResponse.sequenceNumber)!")
79
-
continuation.resume(returning: pingResponse)
80
-
81
-
case.failure(let error):
82
-
continuation.resume(throwing: error)
83
-
84
-
case.success(let other):
85
-
continuation.resume(throwing:SWIMNIOIllegalMessageTypeError("Unexpected message, got: \(other) while expected \(PingResponse<SWIM.NIOPeer,SWIM.NIOPeer>.self)"))
87
+
return pingResponse
88
+
default:
89
+
throwSWIMNIOIllegalMessageTypeError("Unexpected message, got: [\(message)]:\(reflecting:type(of: message)) while expected \(PingResponse<SWIM.NIOPeer,SWIM.NIOPeer>.self)")
86
90
}
87
-
})
88
-
89
-
self.channel.writeAndFlush(command, promise:nil)
91
+
}
92
+
throwSWIMNIOIllegalMessageTypeError("Unexpected message, got: [\(message)]:\(reflecting:type(of: message)) while expected \(PingResponse<SWIM.NIOPeer,SWIM.NIOPeer>.self)")
message:"Timeout of [\(callbackKey)], no reply to [\(writeCommand.message.messageCaseDescription)] after \(writeCommand.replyTimeout.prettyDescription())"
124
-
)
125
-
))
126
-
} // else, task fired already (should have been removed)
// if let task = self.pendingReplyCallbacks.removeValue(forKey: callbackKey) {
121
+
// throw SWIMNIOTimeoutError(
122
+
// timeout: writeCommand.replyTimeout,
123
+
// message: "Timeout of [\(callbackKey)], no reply to [\(writeCommand.message.messageCaseDescription)] after \(writeCommand.replyTimeout.prettyDescription())"
124
+
// )
125
+
// } // else, task fired already (should have been removed)
0 commit comments