Skip to content

Commit eab384e

Browse files
committed
fix: lastError has traceback field. RpcResult.result must accept a timeout param
1 parent bcfb56e commit eab384e

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/bridge.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,14 @@ class RpcResult {
3535
public:
3636
RpcResult(uint32_t id, RPCClient* c, struct k_mutex* m, int timeout) : msg_id_wait(id), client(c), read_mutex(m), _timeout(timeout) {}
3737

38-
template<typename RType> bool result(RType& result) {
38+
template<typename RType> bool result(RType& result, int timeout = -1) {
39+
if (timeout > 0) _timeout = timeout;
3940

4041
int start = millis();
4142
while(true) {
4243
if (_timeout > 0 && (millis() - start) > _timeout){
4344
client->lastError.code = GENERIC_ERR;
44-
client->lastError.message = "Timed out";
45+
client->lastError.traceback = "Timed out";
4546
break;
4647
}
4748
if (k_mutex_lock(read_mutex, K_MSEC(10)) == 0 ) {

0 commit comments

Comments
 (0)