Skip to content

Commit a16cf1f

Browse files
vipc: client reconnects on server stream changes (#653)
1 parent 89096d9 commit a16cf1f

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

msgq/visionipc/visionipc_client.cc

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,13 @@ VisionBuf * VisionIpcClient::recv(VisionIpcBufExtra * extra, const int timeout_m
9696
assert(r->getSize() == sizeof(VisionIpcPacket));
9797
VisionIpcPacket *packet = (VisionIpcPacket*)r->getData();
9898

99-
assert(packet->idx < num_buffers);
99+
// Check if packet index is out of bounds, indicating server has changed
100+
if (packet->idx >= num_buffers) {
101+
connected = false;
102+
delete r;
103+
return nullptr;
104+
}
105+
100106
VisionBuf * buf = &buffers[packet->idx];
101107

102108
if (buf->server_id != packet->server_id){

0 commit comments

Comments
 (0)