Commit graph

177 commits

Author SHA1 Message Date
Cameron Gutman e30f10e6b0 [AFD]
- Clear the sendable flag after a disconnect
- Don't set the sendable flag if send has been closed

svn path=/trunk/; revision=53009
2011-07-31 19:51:32 +00:00
Amine Khaldi 6ece3cae14 [AFD]
* Use afd.h as a PCH.

svn path=/trunk/; revision=52929
2011-07-27 19:29:34 +00:00
Cameron Gutman acd4c15b61 [AFD]
- Fix (hopefully) the final disconnect bugs

svn path=/trunk/; revision=52783
2011-07-22 15:11:01 +00:00
Cameron Gutman cb26a7762f [AFD]
- Only trigger the close event if the pending receive list is empty

svn path=/trunk/; revision=52775
2011-07-22 04:31:33 +00:00
Cameron Gutman 2e54713de3 [AFD]
- Wait to signal a graceful receive shutdown until all buffered transport data is read by the application

svn path=/trunk/; revision=52774
2011-07-22 04:11:50 +00:00
Cameron Gutman 78bd31b30d [AFD]
- Fix typos from my previous commit
- Fix another bug with recv() on a datagram socket
- Fix cancellation bugs

svn path=/trunk/; revision=52725
2011-07-18 11:27:01 +00:00
Cameron Gutman 2f00016a72 - Fix copy paste error
svn path=/trunk/; revision=52724
2011-07-18 04:25:08 +00:00
Cameron Gutman e37e340708 [AFD]
- Fix a nasty datagram corruption bug that would result in an uninitialized buffer data being returned instead of packet data if the client read buffer was smaller than the datagram received
- Fix broken user-mode send datagram IRP completion code which didn't set the completion status
- Implement disabling/enabling event select triggers

svn path=/trunk/; revision=52723
2011-07-18 04:21:40 +00:00
Cameron Gutman 13f96c816f [AFD]
- Change some debug prints to reduce useless spam

svn path=/trunk/; revision=52702
2011-07-16 19:16:45 +00:00
Cameron Gutman 6195434c6b [TCPIP]
- Fix the broken TDI_QUERY_CONNECTION_INFO implementation
- Perform buffer size checks on TDI_QUERY_MAX_DATAGRAM_INFO requests
[AFD]
- Greatly simplify AfdGetPeerName by using the remote address stored while connecting

svn path=/trunk/; revision=52698
2011-07-16 17:17:08 +00:00
Cameron Gutman 0ef6eb1c56 [AFD]
- Debugging overhaul

svn path=/trunk/; revision=52697
2011-07-16 16:57:07 +00:00
Jérôme Gardou ef65e8cc09 [AFD]
- fix MSVC build

svn path=/trunk/; revision=52605
2011-07-10 13:28:47 +00:00
Cameron Gutman 38990db5fd [AFD]
- Fix broken TDI address functions which were causing subtle memory corruptions, wasted memory, and incorrect or uninitialized values of the address length field
- Remove some buggy code that wasn't used anywhere
- General refactoring to reduce code duplication
- Handle an invalid address type properly

svn path=/trunk/; revision=52600
2011-07-10 08:25:31 +00:00
Cameron Gutman 41406f9697 [AFD]
- Probe and lock pages with the KernelMode access mode instead of Irp->RequestorMode (UserMode) since we're dealing with memory that we allocated in kernel-mode
- Fixes getpeername() and HTTPS browsing in Firefox

svn path=/trunk/; revision=52597
2011-07-10 02:23:12 +00:00
Cameron Gutman 62cbe9d8f0 [AFD]
- Fix a desired access bug that totally broke event select
- FILE_ALL_ACCESS is NOT equal to EVENT_ALL_ACCESS

svn path=/trunk/; revision=52563
2011-07-07 23:17:23 +00:00
Cameron Gutman 31774f263a [AFD]
- Signal the event immediately if the select triggers have already been satisfied
- This fixes hangs with applications that wait on the select event before performing any socket operations

svn path=/trunk/; revision=52562
2011-07-07 22:43:35 +00:00
Cameron Gutman fff1ab8feb [AFD]
- Implement IOCTL_AFD_RECV for connection-less sockets
- Fix a parameter check
- Fixes recv() on datagram sockets

svn path=/trunk/; revision=52561
2011-07-07 20:44:47 +00:00
Cameron Gutman 14f58265d2 [AFD]
- Rewrite user-mode send IRP handling so send errors get returned to the user properly
- Fixes OskitTCP: ESHUTDOWN/EPIPE debug log spam when a chargen telnet session is terminated by the remote side

svn path=/trunk/; revision=52552
2011-07-07 00:29:30 +00:00
Cameron Gutman 4e5a783a2f [AFD]
- Move the TdiReceiveDatagram call to WarmSocketForBind like it is done for connects

svn path=/trunk/; revision=52539
2011-07-04 19:13:45 +00:00
Cameron Gutman 54f9acbf0d [AFD]
- Add support for AFD_INFO_INLINING_MODE
- Add support for setting AFD_INFO_RECEIVE_WINDOW_SIZE and AFD_INFO_SEND_WINDOW_SIZE
- None of this is used by our current msafd but mswsock_new uses it

svn path=/trunk/; revision=52538
2011-07-04 18:07:55 +00:00
Cameron Gutman 0e8f87ff82 [MSAFD/AFD]
- Pass the non-blocking information as a boolean (mswsock_new does this too)
[AFD]
- Don't block waiting for a connection to accept on a non-blocking listener

svn path=/trunk/; revision=52537
2011-07-04 17:37:45 +00:00
Cameron Gutman fd6bb26299 - Small fix for my last commit to prevent problems if ExAllocatePool fails
svn path=/trunk/; revision=52534
2011-07-04 15:45:58 +00:00
Cameron Gutman 72fe2efcf8 [AFD]
- Fix FIONREAD for datagram sockets

svn path=/trunk/; revision=52533
2011-07-04 15:35:16 +00:00
Cameron Gutman 00651a94cd [AFD]
- Fix a check so FIONREAD works for accepted sockets too

svn path=/trunk/; revision=52532
2011-07-04 00:30:04 +00:00
Cameron Gutman afa2c1d664 [AFD]
- We really do need to count the outstanding send IRP in our pending send count (with a detailed explanation of the reason included in the code)
- Wait on an outstanding send IRP to dispatch the disconnect
- When we receive a FIN from the other side and our receive comes back with 0 data, only close receiving on the socket because sending is still legal in this state
- Fixes many bugs on the ws2_32_winetest sock and likely lots of other partial disconnect related stuff
- Retest network related hanging bugs after this please (ftp dir hang is fixed)

svn path=/trunk/; revision=52510
2011-07-03 01:53:10 +00:00
Cameron Gutman f828c2431c [AFD]
- Fix a corrupted disconnect timeout pointer being sent to the TDI transport driver

svn path=/trunk/; revision=52502
2011-07-02 20:26:21 +00:00
Cameron Gutman a45e92a406 [AFD]
- Rewrite disconnect to work asynchronously

svn path=/trunk/; revision=52497
2011-07-01 14:31:37 +00:00
Cameron Gutman 97b25874fc [AFD]
- Fix several bugs related to the FD_WRITE event
- We would not set the sendable poll state if the socket had data waiting to be sent even if there was buffer space
- We did not set the poll state after performing a send
- We did not clear the sendable poll state if we ran out of buffer space

svn path=/trunk/; revision=52492
2011-06-30 06:04:09 +00:00
Cameron Gutman f6485fab90 [AFD]
- Queue the user-mode connect IRP before calling TdiConnect to avoid a race if the TDI_CONNECT IRP is completed before we get a chance to queue the user-mode IRP to accept the connection
- Change the non-blocking TDI helper functions to always return STATUS_PENDING if the completion function will be called to avoid duplicate handling of IRPs

svn path=/trunk/; revision=52441
2011-06-24 14:06:48 +00:00
James Tabor a50aff948b - Fix debug build.
svn path=/trunk/; revision=52434
2011-06-23 22:25:50 +00:00
Cameron Gutman d7a7a20e8b [AFD]
- Hold on to the disconnect IRP until all pending sending IRPs are sent to the transport driver if a controlled disconnect was requested

svn path=/trunk/; revision=52415
2011-06-22 00:17:19 +00:00
Cameron Gutman 0fbf8e4374 [AFD]
- Remove extra cruft around the TdiReceive call
- Handle send and receive requests better after a socket closure

svn path=/trunk/; revision=52402
2011-06-21 13:59:49 +00:00
Cameron Gutman 2b116b187c [AFD]
- Complete receive requests with the correct status if the socket is unexpectedly closed

svn path=/trunk/; revision=52400
2011-06-21 13:02:42 +00:00
Cameron Gutman cbeac4750e [AFD]
- Only indicate that receive is possible if there are no pending receive IRPs waiting for data
- Don't attempt to receive on a connection which has been closed in the receive direction

svn path=/trunk/; revision=52224
2011-06-14 02:18:20 +00:00
Cameron Gutman 2c808bda98 [AFD]
- FD_CLOSE is only for remote disconnects so don't send it when the app closes its own socket
- Validate the user-mode event handle properly

svn path=/trunk/; revision=52223
2011-06-14 00:56:49 +00:00
Cameron Gutman f855ea9bdb [AFD]
- Fix packet size overflow check

svn path=/trunk/; revision=52195
2011-06-11 20:10:55 +00:00
Cameron Gutman dcf65c0e08 [AFD]
- Rewrite user-mode request locking to fix several bugs
- IRP_MJ_READ and IRP_MJ_WRITE doesn't crash
- Revert the IoModifyAccess change (the Write parameter was relevant to the buffer not the request)
- Use GetLockedData to retrieve a locked buffer instead of accessing it manually
- Lock several requests which were not locked and could cause a crash
- ASSERT that the in flight request is the IRP being completed
- Fix a socket closure bug so shutdown(SO_SEND) will not prevent packets being received
- Don't count bytes used in the receive content
- Don't free the datagram buffer if it is a peek request
- Requeue the datagram buffer at the head of the list if it is a peek request
- Fix a bug which could cause corrupted data to be received if multiple datagrams come in before the app receives them 
- Make sure that we're not overwriting an existing in flight request when creating a new one
- Perform an implicit bind in AfdPacketSocketWriteData if it is not already bound
- Implement batching several user-mode send IRPs into one TDI request (if there is already one pending)
- Fix a potential crash if a connectionless send IRP is cancelled

svn path=/trunk/; revision=52186
2011-06-11 12:46:04 +00:00
Cameron Gutman 4f74cccd2d [AFD]
- Cleanup the pending connection list before closing the FCB
- Fixes yet another socket closure bug

svn path=/trunk/; revision=52166
2011-06-09 22:38:38 +00:00
Cameron Gutman 17de5b1c0f [AFD]
- Fix a bug in some completion routines that resulted in failures being treated as successes
- Fix various cancellation bugs
- Fixes termination of programs that open listening sockets (Firefox, server.exe, tcpsvcs.exe, telnetd.exe, etc) and should increase stability in these programs as well

svn path=/trunk/; revision=52152
2011-06-08 22:15:27 +00:00
Cameron Gutman 84a9cedb4e [AFD]
- Fix IoModifyAccess vs IoReadAccess confusion

svn path=/trunk/; revision=52125
2011-06-06 22:55:17 +00:00
Cameron Gutman 768cc14b79 [AFD]
- Create an empty TRANSPORT_ADDRESS for the local address when doing an implicit bind so TCP/IP can choose its own local port and address instead of trying to bind the remote address and port
- Fixes another critical networking bug

svn path=/trunk/; revision=52092
2011-06-05 17:08:37 +00:00
Cameron Gutman 588db734b0 [AFD]
- Disassociate the connection from the address file before closing them

svn path=/trunk/; revision=52083
2011-06-04 20:31:05 +00:00
Jérôme Gardou 989c121257 [CMAKE]
fix pch support, with proper dependancies.
  Use cmake built-in functions instead of doing weird "magic" with tabs and spaces.
  According to gcc doc, if header.h is precompiled, the output should be named "header.h.gch" and not anything else.

svn path=/trunk/; revision=52058
2011-06-02 12:18:22 +00:00
Cameron Gutman e26e8e7106 [AFD]
- Launch a new listen IRP right after the current one completes instead of waiting until the current pending connection is accepted
- Reduces the chance of AFD missing two connection requests that are issued very close together and increases network performance by allowing our connection queue to do its job

svn path=/trunk/; revision=52013
2011-05-30 17:27:53 +00:00
Timo Kreuzer fae2044a23 [CMAKE]
Integrate cmake stuff into trunk
Only files added.

svn path=/trunk/; revision=51783
2011-05-16 13:12:07 +00:00
Cameron Gutman 9088c79a22 There is nothing to say about this...
svn path=/trunk/; revision=48410
2010-08-02 03:52:52 +00:00
Cameron Gutman caa555a453 [AFD]: BytesAvailable needs to be updated even when peeking so we don't run off the end of our buffer
svn path=/trunk/; revision=48405
2010-08-01 23:52:23 +00:00
Cameron Gutman a7c693ea78 Forgetting to save really sucks. Sorry again for the wasted commit.
svn path=/trunk/; revision=48404
2010-08-01 23:46:57 +00:00
Cameron Gutman e98fc993d1 [AFD]: Fix read data corruption when peeking at network data (TDI_RECEIVE_PEEK is specified for a stream socket)
svn path=/trunk/; revision=48403
2010-08-01 23:42:33 +00:00
Cameron Gutman be40e4a043 Fix a typo
svn path=/trunk/; revision=48402
2010-08-01 23:20:31 +00:00