Skip to content

Commit 6d0ecd8

Browse files
authored
Merge pull request #46 from lrowe/fix-reset-socket-confusion
Track next socket/file fd separately in FileDescriptors::manage_as
2 parents f46925e + ab7c820 commit 6d0ecd8

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

lib/tinykvm/linux/fds.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,11 @@ namespace tinykvm
237237
Entry entry{fd, is_writable, false};
238238
auto res = m_fds.insert_or_assign(vfd, entry);
239239
// Make sure we are not overwriting the vfd
240-
this->m_next_file_fd = std::max(this->m_next_file_fd, vfd + 1);
240+
if (is_socket_vfd(vfd)) {
241+
this->m_next_socket_fd = std::max(this->m_next_socket_fd, vfd + 1);
242+
} else {
243+
this->m_next_file_fd = std::max(this->m_next_file_fd, vfd + 1);
244+
}
241245
return res.first->second;
242246
}
243247

0 commit comments

Comments
 (0)