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

fix: connecting to a non-existing port on switch returns error #58

Merged
merged 1 commit into from
Dec 23, 2024

Conversation

samuelemusiani
Copy link
Contributor

I have found a bug where if you try to connect to a port on the switch that does not exists the connection will hang. To reproduce the bug:

  1. Open a terminal and start a switch: vde_switch /tmp/sw1
  2. Open another terminal and try to connect to any port >= 32: vdens '/tmp/sw1[33]'

This patch should fix the bug. After this if you try to connect to a non-existing port the
error message vdeplug: No such file or directory is returned.

@berdav
Copy link
Collaborator

berdav commented Dec 22, 2024

I see that there it is some confusion on coding style (e.g. curly brackets and else placement).

LFTM.

}
else {
remove_fd(fd);
} else {
Copy link
Collaborator

@berdav berdav Dec 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For instance, this else branch modification is not necessary.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I should do something like this?

}
else {

So this apply to the other if statements too? So from this:

if () {
} else {
    remove_fd(fd);
}

to this

if () {
}
else {
    remove_fd(fd);
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also I've just notice that the else if statement on line 252 is in the wrong format, right?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I think it would be better to refactor the project in future with a consistent coding style (for instance the Linux one).

It is not relevant for this pr.

Copy link
Contributor Author

@samuelemusiani samuelemusiani Dec 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, makes sense. Code formatters are made for this :)

@rd235 rd235 merged commit 1702682 into virtualsquare:master Dec 23, 2024
2 checks passed
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

Successfully merging this pull request may close these issues.

3 participants