this change adds RejectConnectionDart and supports cl/467032081.

PiperOrigin-RevId: 469757197
This commit is contained in:
John Carroll
2022-08-24 10:07:33 -07:00
committed by Copybara-Service
parent 01a4daffd2
commit f3c1a76723
3 changed files with 23 additions and 1 deletions
@@ -542,6 +542,25 @@ void AcceptConnectionDart(Core *pCore, const char *endpoint_id,
finished.Await();
}
void RejectConnectionDart(Core *pCore, const char *endpoint_id,
Dart_Port dart_port) {
if (!pCore) {
PostResult(dart_port, Status::Value::kError);
return;
}
port = dart_port;
ResultCallbackW callback;
SetResultCallback(callback, dart_port);
CountDownLatch finished(1);
adapter_finished = &finished;
RejectConnection(pCore, endpoint_id, callback);
finished.Await();
}
void DisconnectFromEndpointDart(Core *pCore, char *endpoint_id,
Dart_Port dart_port) {
if (!pCore) {
@@ -259,6 +259,10 @@ DLL_API void __stdcall AcceptConnectionDart(Core *pCore,
PayloadListenerDart listener_dart,
Dart_Port result_cb);
DLL_API void __stdcall RejectConnectionDart(Core *pCore,
const char *endpoint_id,
Dart_Port result_cb);
// Disconnects from a remote endpoint. {@link Payload}s can no longer be sent
// to or received from the endpoint after this method is called.
// endpoint_id - The identifier for the remote endpoint to disconnect from.
@@ -117,7 +117,6 @@ struct DLL_API ConnectionResponseInfoW {
struct DLL_API PayloadProgressInfoW {
PayloadId payload_id = 0;
enum class Status {
kUnspecified = 0,
kSuccess,
kFailure,
kInProgress,