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

comboat: duplicate methods "execute" and "send" #743

Open
deadprogram opened this issue Feb 22, 2025 · 3 comments
Open

comboat: duplicate methods "execute" and "send" #743

deadprogram opened this issue Feb 22, 2025 · 3 comments

Comments

@deadprogram
Copy link
Member

The "execute" and "send" methods for this driver have the exact same implementation

func (d *device) execute(cmd string, timeout int) (err error) {

@deadprogram
Copy link
Member Author

cc @scottfeldman 😄

@scottfeldman
Copy link
Contributor

They are very close, but not the same. execute() waits for "OK", send() waits for ">". I thought about combining them into one func, but that would cause problems if a sending process see's the OK from another process that's executing a cmd, like creating another socket.

Maybe there is a way to DRY the duplicated parts of send() and execute()?

@scottfeldman
Copy link
Contributor

I thought about combining them into one func, but that would cause problems if a sending process see's the OK from another process that's executing a cmd, like creating another socket.

[Caffeine kicking in]...scratch that thought...the two competing processes are mutual ex due to d.Lock().

But I still like being explicit about expected result after an execute() cmd vs. a send() cmd. Maybe the code just needs a // comment covering this?

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