-
Notifications
You must be signed in to change notification settings - Fork 304
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
HPCC-31196 Add "disconnect", "unlock", etc. to WsDali #18342
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -594,3 +594,135 @@ bool CWSDaliEx::onGetSDSSubscribers(IEspContext& context, IEspGetSDSSubscribersR | |
} | ||
return true; | ||
} | ||
|
||
bool CWSDaliEx::onDisconnectClientConnection(IEspContext& context, IEspDisconnectClientConnectionRequest& req, IEspResultResponse& resp) | ||
{ | ||
try | ||
{ | ||
checkAccess(context); | ||
|
||
const char* url = req.getURL(); | ||
if (isEmptyString(url)) | ||
throw makeStringException(ECLWATCH_INVALID_INPUT, "URL not specified."); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. see prev. comment re. "endpoint" |
||
|
||
MemoryBuffer mb; | ||
mb.append("disconnect").append(url); | ||
getDaliDiagnosticValue(mb); | ||
|
||
VStringBuffer result("DisconnectClientConnection called for %s.", url); | ||
resp.setResult(result); | ||
} | ||
catch(IException* e) | ||
{ | ||
FORWARDEXCEPTION(context, e, ECLWATCH_INTERNAL_ERROR); | ||
} | ||
return true; | ||
} | ||
|
||
bool CWSDaliEx::onUnlockSDSLock(IEspContext& context, IEspUnlockSDSLockRequest& req, IEspResultResponse& resp) | ||
{ | ||
try | ||
{ | ||
checkAccess(context); | ||
|
||
const char* connectionIdHex = req.getConnectionID(); | ||
if (isEmptyString(connectionIdHex)) | ||
throw makeStringException(ECLWATCH_INVALID_INPUT, "ConnectionID not specified."); | ||
|
||
MemoryBuffer mb; | ||
mb.append("unlock").append(strtoll(connectionIdHex, nullptr, 16)).append(req.getClose()); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I had to check this, because it's not clear from the dalidiag usage (not a new issue) that it expects a hex number. |
||
getDaliDiagnosticValue(mb); | ||
|
||
bool success = false; | ||
mb.read(success); | ||
if (!success) | ||
resp.setResult("Lock not found"); | ||
else | ||
{ | ||
StringBuffer result(("Lock successfully removed: ")); | ||
mb.read(result); | ||
resp.setResult(result); | ||
} | ||
} | ||
catch(IException* e) | ||
{ | ||
FORWARDEXCEPTION(context, e, ECLWATCH_INTERNAL_ERROR); | ||
} | ||
return true; | ||
} | ||
|
||
bool CWSDaliEx::onSaveSDSStore(IEspContext& context, IEspSaveSDSStoreRequest& req, IEspResultResponse& resp) | ||
{ | ||
try | ||
{ | ||
checkAccess(context); | ||
|
||
MemoryBuffer mb; | ||
mb.append("save"); | ||
getDaliDiagnosticValue(mb); | ||
resp.setResult("SaveSDSStore called."); | ||
} | ||
catch(IException* e) | ||
{ | ||
FORWARDEXCEPTION(context, e, ECLWATCH_INTERNAL_ERROR); | ||
} | ||
return true; | ||
} | ||
|
||
bool CWSDaliEx::onSetTraceTransactions(IEspContext& context, IEspSetTraceTransactionsRequest& req, IEspResultResponse& resp) | ||
{ | ||
try | ||
{ | ||
checkAccess(context); | ||
|
||
StringBuffer result; | ||
const char* cmd = "settracetransactions"; | ||
getDaliDiagnosticValue(cmd, result); | ||
resp.setResult(result.isEmpty() ? "SetTraceTransactions called." : result); | ||
} | ||
catch(IException* e) | ||
{ | ||
FORWARDEXCEPTION(context, e, ECLWATCH_INTERNAL_ERROR); | ||
} | ||
return true; | ||
} | ||
|
||
bool CWSDaliEx::onSetTraceSlowTransactions(IEspContext& context, IEspSetTraceSlowTransactionsRequest& req, IEspResultResponse& resp) | ||
{ | ||
try | ||
{ | ||
checkAccess(context); | ||
|
||
MemoryBuffer mb; | ||
mb.append("settraceslowtransactions"); | ||
mb.append(req.getSlowThresholdMS()); | ||
getDaliDiagnosticValue(mb); | ||
|
||
StringAttr result; | ||
mb.read(result); | ||
resp.setResult(result.isEmpty() ? "SetTraceSlowTransactions called." : result); | ||
} | ||
catch(IException* e) | ||
{ | ||
FORWARDEXCEPTION(context, e, ECLWATCH_INTERNAL_ERROR); | ||
} | ||
return true; | ||
} | ||
|
||
bool CWSDaliEx::onClearTraceTransactions(IEspContext& context, IEspClearTraceTransactionsRequest& req, IEspResultResponse& resp) | ||
{ | ||
try | ||
{ | ||
checkAccess(context); | ||
|
||
StringBuffer result; | ||
const char* cmd = "cleartracetransactions"; | ||
getDaliDiagnosticValue(cmd, result); | ||
resp.setResult(result.isEmpty() ? "ClearTraceTransactions called." : result); | ||
} | ||
catch(IException* e) | ||
{ | ||
FORWARDEXCEPTION(context, e, ECLWATCH_INTERNAL_ERROR); | ||
} | ||
return true; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a url is misleading. It's a host:port. Endpoint would be better.