mirror of
https://github.com/oven-sh/bun
synced 2026-02-14 12:51:54 +00:00
Fixed critical race condition in QUIC stream creation that prevented data transfer. Key fixes: 1. **Synchronous callback race**: socket.createStream() was calling on_new_stream synchronously BEFORE the QuicStream was added to pending queue. Fixed by adding to pending queue BEFORE triggering lsquic stream creation. 2. **Open callback timing**: The open() callback was firing for client-created streams before socket.stream() returned, causing clientStream variable to be undefined. Fixed by only calling open() for incoming/server-initiated streams, not for streams from pending queue. 3. **Stream connection**: QuicStreams are now properly connected to lsquic streams when popped from pending queue, and buffered writes are flushed successfully. Result: Full bidirectional QUIC data transfer now works: - Client write → Server receive ✅ - Server write → Client receive ✅ - Echo functionality working ✅ Test "QUIC server and client integration" now passes. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>