Skip to content
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

[Request] ExecuteListWithDuration return on !done and ExecuteListUntilDone #48

Open
1 of 2 tasks
Deantwo opened this issue Sep 26, 2018 · 9 comments
Open
1 of 2 tasks

Comments

@Deantwo
Copy link
Contributor

Deantwo commented Sep 26, 2018

Attempting to make a simple synchronous traceroute, but none of the execute commands work, except for ExecuteListWithDuration.

I believe that calling the command /tool/traceroute address=8.8.8.8 count=1 would cause RouterOS to return a !done by itself without the need for a /cancel.

Do you think it would be possible to make ExecuteListWithDuration return when it it receive a !done?
And maybe a ExecuteListUntilDone would be interesting to have.

  • Change ExecuteListWithDuration to return when it receive !done
  • Add ExecuteListUntilDone, with optional timeout
@Deantwo
Copy link
Contributor Author

Deantwo commented Sep 26, 2018

Some testing shows that maybe ExecuteListWithDuration(1000) does return when it receive a !done.
The summary comment does not mention this though. Might want to add that.

So I might be able to use ExecuteListWithDuration anyway, but I would still prefer a timeout exception, rather than a cancel.

@danikf
Copy link
Owner

danikf commented Sep 26, 2018

Hi,
I believe synchronous call is easy, isn't it? Just use synchronous Execute method with count limit.

const string IP = "127.0.0.1";

var cmd = Connection.CreateCommandAndParameters("/tool/traceroute", TikCommandParameterFormat.NameValue,
      "address", IP,
      "count", "1");
var result = cmd.ExecuteList();

Which returns list of two !re rows.

> /tool/traceroute
> =address=127.0.0.1
> =count=1
< !re
< =address=
< =loss=0
< =sent=1
< =last=0
< =status=
< 
< !re
< =address=127.0.0.1
< =loss=0
< =sent=1
< =last=32
< =avg=32
< =best=32
< =worst=32
< =std-dev=0
< =status=
< 
< !done

Is this behavior similar to your expectations?

D

danikf added a commit that referenced this issue Sep 26, 2018
@danikf
Copy link
Owner

danikf commented Sep 26, 2018

BTW - about ExecuteWithDuration behavior see #41 (I have also updated comments on these methods as you recommended)

D

@danikf
Copy link
Owner

danikf commented Sep 26, 2018

Hi - version with expected fix seams to be still in development ... I will publish v3.4 soon.
D

danikf added a commit that referenced this issue Sep 26, 2018
@danikf
Copy link
Owner

danikf commented Sep 26, 2018

Added ToolTraceroute object with static Execute method.

@Deantwo
Copy link
Contributor Author

Deantwo commented Sep 27, 2018

Testing the changes.

@Deantwo
Copy link
Contributor Author

Deantwo commented Sep 27, 2018

ExecuteListWithDuration works, but kinda opposite from what I would want to have in my specific case. Which is why a ExecuteListUntilDone might be interesting.
Maybe I should try to implement it.

@Deantwo
Copy link
Contributor Author

Deantwo commented Sep 27, 2018

I would suggest that ExecuteListWithDuration(int, out bool, out string) return something else than "canceled" when it received a premature !done. Why not make the abortReason be "Prematurely done" or something?
Monitoring the ExecuteAsync's onDoneCallback for a premature !done shouldn't be too hard.

@Deantwo
Copy link
Contributor Author

Deantwo commented Feb 17, 2019

I will confess that I haven't used any of these duration execute methods at all out side of my testing back then. So not sure if anything needs to be changed here anymore.
The logic behind some of these just seem backwards to me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants