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/bot crash #21

Merged
merged 3 commits into from
Jun 28, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
dont stop listening on wrong packet
rttwente committed Jun 28, 2024
commit 3fdd15237c245e6b35481403143dc8c6dd038de3
17 changes: 9 additions & 8 deletions src/main/java/nl/roboteamtwente/autoref/WorldConnection.java
Original file line number Diff line number Diff line change
@@ -35,18 +35,19 @@ public void connect() {
* Receive and process messages
*/
public void listener() {
try {
while (!Thread.currentThread().isInterrupted() && worldSocket != null) {
while (!Thread.currentThread().isInterrupted() && worldSocket != null) {
try {
byte[] buffer = worldSocket.recv();
StateOuterClass.State packet = StateOuterClass.State.parseFrom(buffer);
ref.checkViolations(packet);
}
} catch (InvalidProtocolBufferException e) {
e.printStackTrace();
} catch (ZMQException e) {
//4 is the error code when we close the connection by hand, which can be ignored
if (e.getErrorCode() != 4) {

} catch (InvalidProtocolBufferException e) {
e.printStackTrace();
} catch (ZMQException e) {
//4 is the error code when we close the connection by hand, which can be ignored
if (e.getErrorCode() != 4) {
e.printStackTrace();
}
}
}
}