i don't even know anymore

This commit is contained in:
2022-12-17 15:08:07 +01:00
parent 2b8aa06117
commit a7dbdff535
15 changed files with 387 additions and 43 deletions

View File

@@ -198,4 +198,21 @@ class Net {
public function removeProto(proto:String) {
protoHandlers.remove(proto);
}
/**
Sends a ping package to the given id. Returns true if there was a response.
**/
public function ping(toID: NetworkID): Promise<Bool> {
return new Promise<Bool>((resolve,reject)->{
this.sendAndAwait(toID,"ping",null).map(pack -> {
switch pack {
case Success(_):
resolve(true);
case Failure(err):
resolve(false);
}
});
return null;
});
}
}