*add socketExists api method
This commit is contained in:
parent
4e4a22542f
commit
cd33e1508b
|
@ -26,6 +26,7 @@ addHandler("connect", handleConnect);
|
||||||
addHandler("listenSocketEvent", handleListenSocketEvent, {
|
addHandler("listenSocketEvent", handleListenSocketEvent, {
|
||||||
receiveUpdates: true,
|
receiveUpdates: true,
|
||||||
});
|
});
|
||||||
|
addHandler("socketExists", handleSocketExists);
|
||||||
addHandler("close", handleCloseSocketEvent);
|
addHandler("close", handleCloseSocketEvent);
|
||||||
addHandler("write", handleWriteSocketEvent);
|
addHandler("write", handleWriteSocketEvent);
|
||||||
addHandler("addRelay", handleAddRelay);
|
addHandler("addRelay", handleAddRelay);
|
||||||
|
@ -149,6 +150,12 @@ function handleListenSocketEvent(aq: ActiveQuery) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function handleSocketExists(aq: ActiveQuery) {
|
||||||
|
const { id = null } = aq.callerInput;
|
||||||
|
|
||||||
|
aq.respond(hasDhtConnection(Number(id)));
|
||||||
|
}
|
||||||
|
|
||||||
function handleCloseSocketEvent(aq: ActiveQuery) {
|
function handleCloseSocketEvent(aq: ActiveQuery) {
|
||||||
const socket = validateConnection(aq);
|
const socket = validateConnection(aq);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue