Commit f34422a0 authored by jan.koester's avatar jan.koester
Browse files

win working

parent 4efefef1
Loading
Loading
Loading
Loading

server_error.txt

0 → 100644
+384 −0
Original line number Diff line number Diff line
[STDERR]
[SSL] loadServerPrivateKeyDer: looksPkcs8=0 children=9
[SSL] Loaded RSA private key
[IOCP] runEventloop: Starting 4 threads.
[IOCP] pop_accept: looking for pov=000001D1A8480470 in 8 entries
[IOCP]   stored ov=000001D1A8480830
[IOCP]   stored ov=000001D1A844EC80
[IOCP]   stored ov=000001D1A844EDA0
[IOCP]   stored ov=000001D1A844ED40
[IOCP]   stored ov=000001D1A844EE60
[IOCP]   stored ov=000001D1A844EF20
[IOCP]   stored ov=000001D1A8480770
[IOCP]   stored ov=000001D1A8480470
[IOCP] Registered connection: socket=304 csock->fd()=304
[IOCP] pop_accept: looking for pov=000001D1A8480470 in 7 entries
[IOCP]   stored ov=000001D1A8480830
[IOCP]   stored ov=000001D1A844EC80
[IOCP]   stored ov=000001D1A844EDA0
[IOCP]   stored ov=000001D1A844ED40
[IOCP]   stored ov=000001D1A844EE60
[IOCP]   stored ov=000001D1A844EF20
[IOCP]   stored ov=000001D1A8480770
[IOCP] Looking up connection for socket fd=304
[IOCP] Found connection, operation=READ bytes=206 InternalHigh=206
[IOCP] handshakeDone=0
[IOCP] Starting handshake_after_accept (fd=304)...
[SSL] ===== handshake_after_accept ENTER state=26
[SSL] handshake_after_accept loop: state=0
[SSL] Processing READ_CLIENT_HELLO state
[SSL] READ_CLIENT_HELLO: got 201 bytes of handshake message
[SSL] handshake_after_accept loop: state=4
[SSL] flush_out() called
[SSL] flush_out: combined.size()=1083
[SSL] flush_out: posting WSASend for 1083 bytes
[SSL] flush_out: Set _pendingIocpWrite=true, hasPendingWrite=1
[SSL] flush_out: WSASend posted OK
[IOCP] handshake_after_accept returned OK, hasPendingWrite=1
[IOCP] After handshake_after_accept: handshakeDone=0 hasPendingWrite=1 hasBufferedData=0
[IOCP] Handshake not done, no buffered data, reposting recv
[IOCP] pop_accept: looking for pov=000001D1A847FB10 in 8 entries
[IOCP]   stored ov=000001D1A8480830
[IOCP]   stored ov=000001D1A844EC80
[IOCP]   stored ov=000001D1A844EDA0
[IOCP]   stored ov=000001D1A844ED40
[IOCP]   stored ov=000001D1A844EE60
[IOCP]   stored ov=000001D1A844EF20
[IOCP]   stored ov=000001D1A8480770
[IOCP]   stored ov=000001D1A847FBD0
[IOCP] Looking up connection for socket fd=304
[IOCP] Found connection, operation=WRITE bytes=1083 InternalHigh=1083
[IOCP] Write completed, bytes=1083 cleared _pendingIocpWrite, isSSL=1
[IOCP] Write completed during handshake, continuing handshake state machine...
[SSL] ===== handshake_after_accept ENTER state=4
[SSL] handshake_after_accept loop: state=4
[SSL] flush_out() called
[SSL] flush_out: combined.size()=0
[IOCP] handshake_after_accept completed, handshakeDone=0 hasPendingWrite=0
[IOCP] post_recv: recv already pending for fd=304, skipping
[IOCP] pop_accept: looking for pov=000001D1A8480470 in 8 entries
[IOCP]   stored ov=000001D1A8480830
[IOCP]   stored ov=000001D1A844EC80
[IOCP]   stored ov=000001D1A844EDA0
[IOCP]   stored ov=000001D1A844ED40
[IOCP]   stored ov=000001D1A844EE60
[IOCP]   stored ov=000001D1A844EF20
[IOCP]   stored ov=000001D1A8480770
[IOCP]   stored ov=000001D1A847FBD0
[IOCP] Looking up connection for socket fd=304
[IOCP] Found connection, operation=READ bytes=342 InternalHigh=342
[IOCP] handshakeDone=0
[IOCP] Starting handshake_after_accept (fd=304)...
[SSL] ===== handshake_after_accept ENTER state=5
[SSL] handshake_after_accept loop: state=5
[SSL] WAIT_CKE: calling _fetchNextHandshakePlain()
[SSL] WAIT_CKE: _fetchNextHandshakePlain returned 262 bytes
[SSL] WAIT_CKE: Decrypting RSA ciphertext (256 bytes)...
[SSL] WAIT_CKE: RSA decryption successful
[SSL] WAIT_CKE: Extracted premaster (48 bytes)
[SSL] WAIT_CKE: Master secret derived
[SSL] WAIT_CKE: Key block derived
[SSL] WAIT_CKE: AES ciphers initialized, transitioning to WAIT_CCS
[IOCP] handshake_after_accept returned OK, hasPendingWrite=0
[IOCP] After handshake_after_accept: handshakeDone=0 hasPendingWrite=0 hasBufferedData=1
[IOCP] Buffered data available, continuing handshake loop
[IOCP] Starting handshake_after_accept (fd=304)...
[SSL] ===== handshake_after_accept ENTER state=6
[SSL] handshake_after_accept loop: state=6
[SSL] WAIT_CCS: waiting for ChangeCipherSpec record
[SSL] WAIT_CCS: Got record, size=6 type=20
[SSL] WAIT_CCS: CCS received correctly, transitioning to WAIT_FIN
[SSL] handshake_after_accept loop: state=7
[SSL] handshake_after_accept loop: state=8
[SSL] queueRaw: queued 6 bytes, queue size now=1
[SSL] queueRaw: queued 5 bytes, queue size now=2
[SSL] queueRaw: queued 64 bytes, queue size now=3
[SSL] flush_out() called
[SSL] flush_out: combined.size()=75
[SSL] flush_out: posting WSASend for 75 bytes
[SSL] flush_out: Set _pendingIocpWrite=true, hasPendingWrite=1
[SSL] flush_out: WSASend posted OK
[IOCP] handshake_after_accept returned OK, hasPendingWrite=1
[IOCP] After handshake_after_accept: handshakeDone=0 hasPendingWrite=1 hasBufferedData=0
[IOCP] Handshake not done, no buffered data, reposting recv
[IOCP] pop_accept: looking for pov=000001D1A847FB10 in 8 entries
[IOCP]   stored ov=000001D1A8480830
[IOCP]   stored ov=000001D1A844EC80
[IOCP]   stored ov=000001D1A844EDA0
[IOCP]   stored ov=000001D1A844ED40
[IOCP]   stored ov=000001D1A844EE60
[IOCP]   stored ov=000001D1A844EF20
[IOCP]   stored ov=000001D1A8480770
[IOCP]   stored ov=000001D1A847FBD0
[IOCP] Looking up connection for socket fd=304
[IOCP] Found connection, operation=WRITE bytes=75 InternalHigh=75
[IOCP] Write completed, bytes=75 cleared _pendingIocpWrite, isSSL=1
[IOCP] Write completed during handshake, continuing handshake state machine...
[SSL] ===== handshake_after_accept ENTER state=8
[SSL] handshake_after_accept loop: state=8
[SSL] flush_out() called
[SSL] flush_out: combined.size()=0
[IOCP] handshake_after_accept completed, handshakeDone=1 hasPendingWrite=0
[IOCP] post_recv: recv already pending for fd=304, skipping
[IOCP] pop_accept: looking for pov=000001D1A8480470 in 8 entries
[IOCP]   stored ov=000001D1A8480830
[IOCP]   stored ov=000001D1A844EC80
[IOCP]   stored ov=000001D1A844EDA0
[IOCP]   stored ov=000001D1A844ED40
[IOCP]   stored ov=000001D1A844EE60
[IOCP]   stored ov=000001D1A844EF20
[IOCP]   stored ov=000001D1A8480770
[IOCP]   stored ov=000001D1A847FBD0
[IOCP] Looking up connection for socket fd=304
[IOCP] Found connection, operation=READ bytes=133 InternalHigh=133
[IOCP] handshakeDone=1
[IOCP] Received 77 bytes of application data
[IOCP] RequestEvent returned, SendData.size()=104
[IOCP] Calling try_post_send, SendData.size()=104
[SSL] queueRaw: queued 5 bytes, queue size now=1
[SSL] queueRaw: queued 144 bytes, queue size now=2
[SSL] flush_out() called
[SSL] flush_out: combined.size()=149
[SSL] flush_out: posting WSASend for 149 bytes
[SSL] flush_out: Set _pendingIocpWrite=true, hasPendingWrite=1
[SSL] flush_out: WSASend posted OK
[IOCP] try_post_send completed
[IOCP] pop_accept: looking for pov=000001D1A847FB10 in 8 entries
[IOCP]   stored ov=000001D1A8480830
[IOCP]   stored ov=000001D1A844EC80
[IOCP]   stored ov=000001D1A844EDA0
[IOCP]   stored ov=000001D1A844ED40
[IOCP]   stored ov=000001D1A844EE60
[IOCP]   stored ov=000001D1A844EF20
[IOCP]   stored ov=000001D1A8480770
[IOCP]   stored ov=000001D1A847FBD0
[IOCP] Looking up connection for socket fd=304
[IOCP] Found connection, operation=WRITE bytes=149 InternalHigh=149
[IOCP] Write completed, bytes=149 cleared _pendingIocpWrite, isSSL=1
[IOCP] pop_accept: looking for pov=000001D1A8480470 in 8 entries
[IOCP]   stored ov=000001D1A8480830
[IOCP]   stored ov=000001D1A844EC80
[IOCP]   stored ov=000001D1A844EDA0
[IOCP]   stored ov=000001D1A844ED40
[IOCP]   stored ov=000001D1A844EE60
[IOCP]   stored ov=000001D1A844EF20
[IOCP]   stored ov=000001D1A8480770
[IOCP]   stored ov=000001D1A847FBD0
[IOCP] Looking up connection for socket fd=304
[IOCP] Found connection, operation=READ bytes=53 InternalHigh=53
[IOCP] handshakeDone=1
[IOCP] Calling try_post_send, SendData.size()=0
[IOCP] try_post_send completed
[IOCP] pop_accept: looking for pov=000001D1A8480470 in 8 entries
[IOCP]   stored ov=000001D1A8480830
[IOCP]   stored ov=000001D1A844EC80
[IOCP]   stored ov=000001D1A844EDA0
[IOCP]   stored ov=000001D1A844ED40
[IOCP]   stored ov=000001D1A844EE60
[IOCP]   stored ov=000001D1A844EF20
[IOCP]   stored ov=000001D1A8480770
[IOCP]   stored ov=000001D1A847FBD0
[IOCP] Looking up connection for socket fd=304
[IOCP] Found connection, operation=READ bytes=0 InternalHigh=0
[SSL] queueRaw: queued 5 bytes, queue size now=1
[SSL] queueRaw: queued 48 bytes, queue size now=2
[SSL] flush_out() called
[SSL] flush_out: combined.size()=53
[SSL] flush_out: posting WSASend for 53 bytes
[SSL] flush_out: Set _pendingIocpWrite=true, hasPendingWrite=1
[SSL] flush_out: WSASend posted OK
[IOCP] pop_accept: looking for pov=000001D1A847FB10 in 8 entries
[IOCP]   stored ov=000001D1A8480830
[IOCP]   stored ov=000001D1A844EC80
[IOCP]   stored ov=000001D1A844EDA0
[IOCP]   stored ov=000001D1A844ED40
[IOCP]   stored ov=000001D1A844EE60
[IOCP]   stored ov=000001D1A844EF20
[IOCP]   stored ov=000001D1A8480770
[IOCP]   stored ov=000001D1A847FBD0
[IOCP] Looking up connection for socket fd=18446744073709551615
[IOCP] Connection not found for fd=18446744073709551615, ignoring
[IOCP] pop_accept: looking for pov=000001D1A847FBD0 in 8 entries
[IOCP]   stored ov=000001D1A8480830
[IOCP]   stored ov=000001D1A844EC80
[IOCP]   stored ov=000001D1A844EDA0
[IOCP]   stored ov=000001D1A844ED40
[IOCP]   stored ov=000001D1A844EE60
[IOCP]   stored ov=000001D1A844EF20
[IOCP]   stored ov=000001D1A8480770
[IOCP]   stored ov=000001D1A847FBD0
[IOCP] Registered connection: socket=332 csock->fd()=332
[IOCP] pop_accept: looking for pov=000001D1A847FBD0 in 7 entries
[IOCP]   stored ov=000001D1A8480830
[IOCP]   stored ov=000001D1A844EC80
[IOCP]   stored ov=000001D1A844EDA0
[IOCP]   stored ov=000001D1A844ED40
[IOCP]   stored ov=000001D1A844EE60
[IOCP]   stored ov=000001D1A844EF20
[IOCP]   stored ov=000001D1A8480770
[IOCP] Looking up connection for socket fd=332
[IOCP] Found connection, operation=READ bytes=201 InternalHigh=201
[IOCP] handshakeDone=0
[IOCP] Starting handshake_after_accept (fd=332)...
[SSL] ===== handshake_after_accept ENTER state=26
[SSL] handshake_after_accept loop: state=0
[SSL] Processing READ_CLIENT_HELLO state
[SSL] READ_CLIENT_HELLO: got 196 bytes of handshake message
[SSL] handshake_after_accept loop: state=1
[SSL] Entering TLS13_SEND_SERVER_HELLO state
[SSL] Cleared secrets, checking keyshares...
[SSL] use_x25519=1 use_p256=0
[SSL] About to derive handshake keys, group=29 x25519_shared.size=32 ecdhe_shared.size=0
[TLS] ECDHE shared secret (first 16 bytes): 7f5600dc15b9c73105fc54a1cfc4f842
[TLS] Derived keys - c_key: 3967599cffcd2833... s_key: 3c4193329340a4fc
[TLS] Derived IVs - c_iv: fd63b6750412d2c0abd7b4d8 s_iv: f63940f3f9e6e429876346ba
[SSL] Handshake keys derived successfully
[SSL] flush_out() called
[SSL] flush_out: combined.size()=127
[SSL] flush_out: posting WSASend for 127 bytes
[SSL] flush_out: Set _pendingIocpWrite=true, hasPendingWrite=1
[SSL] flush_out: WSASend posted OK
[IOCP] handshake_after_accept returned OK, hasPendingWrite=1
[IOCP] After handshake_after_accept: handshakeDone=0 hasPendingWrite=1 hasBufferedData=0
[IOCP] Handshake not done, no buffered data, reposting recv
[IOCP] pop_accept: looking for pov=000001D1A847FCF0 in 8 entries
[IOCP]   stored ov=000001D1A847F9F0
[IOCP]   stored ov=000001D1A8480830
[IOCP]   stored ov=000001D1A844EC80
[IOCP]   stored ov=000001D1A844EDA0
[IOCP]   stored ov=000001D1A844ED40
[IOCP]   stored ov=000001D1A844EE60
[IOCP]   stored ov=000001D1A844EF20
[IOCP]   stored ov=000001D1A8480770
[IOCP] Looking up connection for socket fd=332
[IOCP] Found connection, operation=WRITE bytes=127 InternalHigh=127
[IOCP] Write completed, bytes=127 cleared _pendingIocpWrite, isSSL=1
[IOCP] Write completed during handshake, continuing handshake state machine...
[SSL] ===== handshake_after_accept ENTER state=2
[SSL] handshake_after_accept loop: state=2
[SSL] TLS13_SEND_ENCRYPTED_FLIGHT: encflight_queued=0
[TLS] CertificateVerify: toSign buffer size=130
[TLS] CertificateVerify: transcript hash (first 16 bytes): 37 9a 97 6e 7f e9 32 15 db 49 7d 15 f0 e5 46 37 
[TLS] RSA-PSS-SHA256 signature generated: size=256
[TLS] RSA-PSS signature (first 16 bytes): 2c 58 84 81 5e 25 39 12 d6 e8 0e 6b 3f a3 f4 10 
[TLS] RSA-PSS signature (last 16 bytes): 5d f8 a7 f1 3d ce a4 33 35 84 03 f6 4f ef da 7f 
[TLS] CertificateVerify message complete: total size=260 (alg_id=2 + len=2 + sig=256)
[TLS] CertificateVerify (first 20 bytes): 08 04 01 00 2c 58 84 81 5e 25 39 12 d6 e8 0e 6b 3f a3 f4 10 
[SSL] flush_out() called
[SSL] flush_out: combined.size()=1412
[SSL] flush_out: posting WSASend for 1412 bytes
[SSL] flush_out: Set _pendingIocpWrite=true, hasPendingWrite=1
[SSL] flush_out: WSASend posted OK
[SSL] TLS13_SEND_ENCRYPTED_FLIGHT: after flush_out, hasPendingWrite=1
[IOCP] handshake_after_accept completed, handshakeDone=0 hasPendingWrite=1
[IOCP] pop_accept: looking for pov=000001D1A847FB10 in 8 entries
[IOCP]   stored ov=000001D1A847F9F0
[IOCP]   stored ov=000001D1A8480830
[IOCP]   stored ov=000001D1A844EC80
[IOCP]   stored ov=000001D1A844EDA0
[IOCP]   stored ov=000001D1A844ED40
[IOCP]   stored ov=000001D1A844EE60
[IOCP]   stored ov=000001D1A844EF20
[IOCP]   stored ov=000001D1A8480770
[IOCP] Looking up connection for socket fd=332
[IOCP] Found connection, operation=WRITE bytes=1412 InternalHigh=1412
[IOCP] Write completed, bytes=1412 cleared _pendingIocpWrite, isSSL=1
[IOCP] Write completed during handshake, continuing handshake state machine...
[SSL] ===== handshake_after_accept ENTER state=2
[SSL] handshake_after_accept loop: state=2
[SSL] TLS13_SEND_ENCRYPTED_FLIGHT: encflight_queued=1
[SSL] flush_out() called
[SSL] flush_out: combined.size()=0
[SSL] TLS13_SEND_ENCRYPTED_FLIGHT: after flush_out, hasPendingWrite=0
[SSL] TLS13_SEND_ENCRYPTED_FLIGHT: transitioning to TLS13_WAIT_CLIENT_FINISHED
[IOCP] handshake_after_accept completed, handshakeDone=0 hasPendingWrite=0
[IOCP] post_recv: recv already pending for fd=332, skipping
[IOCP] pop_accept: looking for pov=000001D1A847FBD0 in 8 entries
[IOCP]   stored ov=000001D1A847F9F0
[IOCP]   stored ov=000001D1A8480830
[IOCP]   stored ov=000001D1A844EC80
[IOCP]   stored ov=000001D1A844EDA0
[IOCP]   stored ov=000001D1A844ED40
[IOCP]   stored ov=000001D1A844EE60
[IOCP]   stored ov=000001D1A844EF20
[IOCP]   stored ov=000001D1A8480770
[IOCP] Looking up connection for socket fd=332
[IOCP] Found connection, operation=READ bytes=6 InternalHigh=6
[IOCP] handshakeDone=0
[IOCP] Starting handshake_after_accept (fd=332)...
[SSL] ===== handshake_after_accept ENTER state=3
[SSL] handshake_after_accept loop: state=3
[SSL] _tls13_read_record_handshake: got record, size=6
[SSL] _tls13_read_record_handshake: outer_type=0x14 ver=0x303 rlen=1
[SSL] _tls13_read_record_handshake: skipping CCS record
[SSL] _tls13_read_record_handshake: got record, size=58
[SSL] _tls13_read_record_handshake: outer_type=0x17 ver=0x303 rlen=53
[TLS] record decrypted: size=37 stripped=37 type=0x16
[IOCP] handshake_after_accept returned OK, hasPendingWrite=0
[IOCP] After handshake_after_accept: handshakeDone=1 hasPendingWrite=0 hasBufferedData=1
[TLS] _tls13_recv_record: recv seq=0 data_len=94 is_client=0 handshake_keys=0
[TLS] IV (first 12 bytes): 2fb135e30e86bb3ca8123761
[IOCP] Received 77 bytes of application data
[IOCP] RequestEvent returned, SendData.size()=104
[IOCP] Calling try_post_send, SendData.size()=104
[SSL] flush_out() called
[SSL] flush_out: combined.size()=126
[SSL] flush_out: posting WSASend for 126 bytes
[SSL] flush_out: Set _pendingIocpWrite=true, hasPendingWrite=1
[SSL] flush_out: WSASend posted OK
[IOCP] try_post_send completed
[IOCP] pop_accept: looking for pov=000001D1A847FB10 in 8 entries
[IOCP]   stored ov=000001D1A847F9F0
[IOCP]   stored ov=000001D1A8480830
[IOCP]   stored ov=000001D1A844EC80
[IOCP]   stored ov=000001D1A844EDA0
[IOCP]   stored ov=000001D1A844ED40
[IOCP]   stored ov=000001D1A844EE60
[IOCP]   stored ov=000001D1A844EF20
[IOCP]   stored ov=000001D1A8480770
[IOCP] Looking up connection for socket fd=332
[IOCP] Found connection, operation=WRITE bytes=126 InternalHigh=126
[IOCP] Write completed, bytes=126 cleared _pendingIocpWrite, isSSL=1
[IOCP] pop_accept: looking for pov=000001D1A847FBD0 in 8 entries
[IOCP]   stored ov=000001D1A847F9F0
[IOCP]   stored ov=000001D1A8480830
[IOCP]   stored ov=000001D1A844EC80
[IOCP]   stored ov=000001D1A844EDA0
[IOCP]   stored ov=000001D1A844ED40
[IOCP]   stored ov=000001D1A844EE60
[IOCP]   stored ov=000001D1A844EF20
[IOCP]   stored ov=000001D1A8480770
[IOCP] Looking up connection for socket fd=332
[IOCP] Found connection, operation=READ bytes=24 InternalHigh=24
[IOCP] handshakeDone=1
[TLS] _tls13_recv_record: recv seq=1 data_len=19 is_client=0 handshake_keys=0
[TLS] IV (first 12 bytes): 2fb135e30e86bb3ca8123761
[IOCP] Calling try_post_send, SendData.size()=0
[IOCP] try_post_send completed
[IOCP] pop_accept: looking for pov=000001D1A847FBD0 in 8 entries
[IOCP]   stored ov=000001D1A847F9F0
[IOCP]   stored ov=000001D1A8480830
[IOCP]   stored ov=000001D1A844EC80
[IOCP]   stored ov=000001D1A844EDA0
[IOCP]   stored ov=000001D1A844ED40
[IOCP]   stored ov=000001D1A844EE60
[IOCP]   stored ov=000001D1A844EF20
[IOCP]   stored ov=000001D1A8480770
[IOCP] Looking up connection for socket fd=332
[IOCP] Found connection, operation=READ bytes=0 InternalHigh=0
[SSL] flush_out() called
[SSL] flush_out: combined.size()=24
[SSL] flush_out: posting WSASend for 24 bytes
[SSL] flush_out: Set _pendingIocpWrite=true, hasPendingWrite=1
[SSL] flush_out: WSASend posted OK
[IOCP] pop_accept: looking for pov=000001D1A847FB10 in 8 entries
[IOCP]   stored ov=000001D1A847F9F0
[IOCP]   stored ov=000001D1A8480830
[IOCP]   stored ov=000001D1A844EC80
[IOCP]   stored ov=000001D1A844EDA0
[IOCP]   stored ov=000001D1A844ED40
[IOCP]   stored ov=000001D1A844EE60
[IOCP]   stored ov=000001D1A844EF20
[IOCP]   stored ov=000001D1A8480770
[IOCP] Looking up connection for socket fd=18446744073709551615
[IOCP] Connection not found for fd=18446744073709551615, ignoring
+16 −3937

File changed.

Preview size limit exceeded, changes collapsed.

+14 −3
Original line number Diff line number Diff line
@@ -508,6 +508,7 @@ namespace netplus {
                std::cerr << "[IOCP] handshakeDone=" << owner->csock->getHandshakeDone() << std::endl;
#endif

handshake_continue:
                // Check if handshake is done
                if (!owner->csock->getHandshakeDone()) {
#if IOCP_DEBUG
@@ -580,16 +581,26 @@ namespace netplus {
                    
                    // CRITICAL: handshake_after_accept() has ALREADY called flush_out() internally!
                    // Do NOT call flush_out again - the WRITE completion handler will manage async writes.
                    // Just check if handshake is done, otherwise repost recv for more data.
                    // Just check if handshake is done, otherwise check for buffered data or repost recv.
                    
                    bool handshakeDone = owner->csock->getHandshakeDone();
#if IOCP_DEBUG
                    std::cerr << "[IOCP] After handshake_after_accept: handshakeDone=" << handshakeDone << " hasPendingWrite=" << (int)owner->csock->hasPendingWrite() << std::endl;
                    std::cerr << "[IOCP] After handshake_after_accept: handshakeDone=" << handshakeDone << " hasPendingWrite=" << (int)owner->csock->hasPendingWrite() << " hasBufferedData=" << owner->csock->hasBufferedData() << std::endl;
#endif
                    
                    if (!handshakeDone) {
                        // Check if there's buffered TLS data to process first
                        // (TLS 1.2 clients often send CKE+CCS+Finished in one TCP segment)
                        if (owner->csock->hasBufferedData()) {
#if IOCP_DEBUG
                        std::cerr << "[IOCP] Handshake not done yet, reposting recv for more data" << std::endl;
                            std::cerr << "[IOCP] Buffered data available, continuing handshake loop" << std::endl;
#endif
                            // Continue processing without reposting recv
                            // We need to call handshake_after_accept again
                            goto handshake_continue;
                        }
#if IOCP_DEBUG
                        std::cerr << "[IOCP] Handshake not done, no buffered data, reposting recv" << std::endl;
#endif
                        owner->ReadPending.store(false);  // Allow new READ processing
                        try {