From 31a49c0af26580f931af1c23d60c60ab7b28256f Mon Sep 17 00:00:00 2001 From: Alex Fabijanic Date: Wed, 6 Jul 2022 11:13:50 +0200 Subject: [PATCH] fix(PollSet): Integrate windows epoll #2091, #3649 --- Net/Net.progen | 1 + Net/Net_vs150.vcxproj | 800 +++--- Net/Net_vs150.vcxproj.filters | 114 +- Net/Net_vs160.vcxproj | 804 +++--- Net/Net_vs160.vcxproj.filters | 114 +- Net/Net_vs170.vcxproj | 1071 +++----- Net/Net_vs170.vcxproj.filters | 114 +- Net/Net_vs90.vcproj | 10 +- Net/include/Poco/Net/Net.h | 15 +- Net/samples/EchoServer/EchoServer.progen | 1 + .../HTTPFormServer/HTTPFormServer.progen | 1 + Net/samples/HTTPLoadTest/HTTPLoadTest.progen | 1 + .../HTTPTimeServer/HTTPTimeServer.progen | 1 + Net/samples/Mail/Mail.progen | 1 + Net/samples/Ping/Ping.progen | 1 + Net/samples/SMTPLogger/SMTPLogger.progen | 1 + Net/samples/TimeServer/TimeServer.progen | 1 + .../WebSocketServer/WebSocketServer.progen | 1 + Net/samples/dict/dict.progen | 1 + Net/samples/download/download.progen | 1 + Net/samples/httpget/httpget.progen | 1 + Net/samples/ifconfig/ifconfig.progen | 1 + Net/samples/tcpserver/tcpserver.progen | 1 + Net/src/PollSet.cpp | 400 +-- Net/src/Socket.cpp | 6 +- Net/src/SocketImpl.cpp | 26 +- Net/src/wepoll.c | 2253 +++++++++++++++++ Net/src/wepoll.h | 114 + Net/testsuite/TestSuite.progen | 1 + Net/testsuite/TestSuite_vs150.vcxproj | 532 ++-- Net/testsuite/TestSuite_vs150.vcxproj.filters | 124 +- Net/testsuite/TestSuite_vs160.vcxproj | 358 +-- Net/testsuite/TestSuite_vs160.vcxproj.filters | 130 +- Net/testsuite/TestSuite_vs170.vcxproj | 830 ++---- Net/testsuite/TestSuite_vs170.vcxproj.filters | 118 +- Net/testsuite/TestSuite_vs90.vcproj | 10 +- 36 files changed, 4269 insertions(+), 3690 deletions(-) create mode 100644 Net/src/wepoll.c create mode 100644 Net/src/wepoll.h diff --git a/Net/Net.progen b/Net/Net.progen index 802f53935..50812acf6 100644 --- a/Net/Net.progen +++ b/Net/Net.progen @@ -12,6 +12,7 @@ vc.project.compiler.defines = vc.project.compiler.defines.shared = ${vc.project.name}_EXPORTS vc.project.compiler.defines.debug_shared = ${vc.project.compiler.defines.shared} vc.project.compiler.defines.release_shared = ${vc.project.compiler.defines.shared} +vc.project.compiler.additionalOptions = /Zc:__cplusplus vc.project.linker.dependencies.Win32 = ws2_32.lib iphlpapi.lib vc.solution.create = true vc.solution.include = testsuite\\TestSuite diff --git a/Net/Net_vs150.vcxproj b/Net/Net_vs150.vcxproj index 65bf927cb..884044023 100644 --- a/Net/Net_vs150.vcxproj +++ b/Net/Net_vs150.vcxproj @@ -1,4 +1,4 @@ - + @@ -56,120 +56,109 @@ Net Win32Proj - + StaticLibrary + v142 MultiByte - v141 StaticLibrary + v142 MultiByte - v141 StaticLibrary + v142 MultiByte - v141 StaticLibrary + v142 MultiByte - v141 DynamicLibrary + v142 MultiByte - v141 DynamicLibrary + v142 MultiByte - v141 StaticLibrary + v142 MultiByte - v141 StaticLibrary + v142 MultiByte - v141 StaticLibrary + v142 MultiByte - v141 StaticLibrary + v142 MultiByte - v141 DynamicLibrary + v142 MultiByte - v141 DynamicLibrary + v142 MultiByte - v141 - - + + + - + - + - + - + - + - + - + - + - + - + - + - + - + - <_ProjectFileVersion>16.0.32002.118 - PocoNetd - PocoNetmdd - PocoNetmtd - PocoNet - PocoNetmd - PocoNetmt - PocoNet64d - PocoNetmdd - PocoNetmtd - PocoNet64 - PocoNetmd - PocoNetmt + <_ProjectFileVersion>16.0.32602.291 ..\bin\ @@ -235,11 +224,11 @@ true true true - + Level3 ProgramDatabase Default - true + /Zc:__cplusplus %(AdditionalOptions) ws2_32.lib;iphlpapi.lib;%(AdditionalDependencies) @@ -268,11 +257,11 @@ true true true - + Level3 - + Default - true + /Zc:__cplusplus %(AdditionalOptions) ws2_32.lib;iphlpapi.lib;%(AdditionalDependencies) @@ -299,12 +288,12 @@ true true true - + ..\lib\PocoNetmtd.pdb Level3 ProgramDatabase Default - true + /Zc:__cplusplus %(AdditionalOptions) ..\lib\PocoNetmtd.lib @@ -325,11 +314,11 @@ true true true - + Level3 - + Default - true + /Zc:__cplusplus %(AdditionalOptions) ..\lib\PocoNetmt.lib @@ -347,12 +336,12 @@ true true true - + ..\lib\PocoNetmdd.pdb Level3 ProgramDatabase Default - true + /Zc:__cplusplus %(AdditionalOptions) ..\lib\PocoNetmdd.lib @@ -373,12 +362,12 @@ true true true - + ..\lib\PocoNetmd.pdb Level3 - + Default - true + /Zc:__cplusplus %(AdditionalOptions) ws2_32.lib;iphlpapi.lib;%(AdditionalDependencies) @@ -397,11 +386,11 @@ true true true - + Level3 ProgramDatabase Default - true + /Zc:__cplusplus %(AdditionalOptions) ws2_32.lib;iphlpapi.lib;%(AdditionalDependencies) @@ -430,11 +419,11 @@ true true true - + Level3 - + Default - true + /Zc:__cplusplus %(AdditionalOptions) ws2_32.lib;iphlpapi.lib;%(AdditionalDependencies) @@ -461,12 +450,12 @@ true true true - + ..\lib64\PocoNetmtd.pdb Level3 ProgramDatabase Default - true + /Zc:__cplusplus %(AdditionalOptions) ..\lib64\PocoNetmtd.lib @@ -487,11 +476,11 @@ true true true - + Level3 - + Default - true + /Zc:__cplusplus %(AdditionalOptions) ..\lib64\PocoNetmt.lib @@ -509,12 +498,12 @@ true true true - + ..\lib64\PocoNetmdd.pdb Level3 ProgramDatabase Default - true + /Zc:__cplusplus %(AdditionalOptions) ..\lib64\PocoNetmdd.lib @@ -535,454 +524,244 @@ true true true - + Level3 - + Default - true + /Zc:__cplusplus %(AdditionalOptions) ..\lib64\PocoNetmd.lib - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -996,6 +775,7 @@ true - - - + + + + \ No newline at end of file diff --git a/Net/Net_vs150.vcxproj.filters b/Net/Net_vs150.vcxproj.filters index 684f4537b..cefdee7d1 100644 --- a/Net/Net_vs150.vcxproj.filters +++ b/Net/Net_vs150.vcxproj.filters @@ -2,166 +2,166 @@ - {8508f58c-3fb5-4d69-87a3-2c8482d06074} + {e840a519-1d83-4115-b70e-f15c0d8f8b28} - {ed13593e-8ef5-4095-b19f-7fc285eab593} + {9a131a9b-34b0-4d4a-9bc0-ea8c6900b1f3} - {e5a47c76-1ca1-4851-bfa8-46c9382064df} + {b87a008e-69c9-4470-b199-ce86df07b80c} - {314468ce-eec5-455d-acfa-4931c2933a6c} + {63859459-6833-468c-8622-7a7a9f1f3f02} - {5f1e8a1a-be59-400a-bcb3-789083996e51} + {23eb6a38-d662-4ff6-83e1-2cf888db52b4} - {0ede78f6-a2d1-49b2-a863-50a53c83ec9f} + {a8f9122d-470d-4eec-a9b1-5293c420c09b} - {fad03a2a-6d88-44d0-ba95-f2f7548e0999} + {f2331b4e-5f3d-46b3-958e-cd1f8e8a90d9} - {c2268dc6-1ade-45d0-81da-904b91c8a6ec} + {c2c65f20-3dfb-4e93-ab26-e6c2342618a5} - {c6cdf518-af9a-4389-8897-22d2dd92dc78} + {0c7ca6c0-ef74-458b-8e31-cffee7ba3953} - {d9117b4a-9a8e-47e5-b07f-1e84102bfb9d} + {6a7b0aab-13ec-4fbb-b75c-55e835a948c9} - {9063d481-d1da-4532-8fcd-16fa74da9787} + {39f6a956-f167-437c-9c8c-a9ab1ab6722e} - {366ffb86-c38c-43ac-8aea-5604ccc339a2} + {49656ed6-bb20-48b2-a1cf-04f388f9b964} - {7a3f9cdb-959b-4669-8eaa-43281dfb3d6d} + {13ea5047-e908-47c1-8edc-0e4b29eeba62} - {1f1df559-bcd9-4637-a647-980fabd6d333} + {2438feb0-24f3-4fc9-9649-7b723863a8e9} - {6f05d453-cc20-4492-b48d-f1a1a479d8f5} + {d90e3464-0931-4762-9897-efca52e2b63a} - {ea5f87b3-9366-40a7-aad6-ac0cee734746} + {97aff2e3-d0e5-4744-918b-f273e57a649c} - {6c31788f-799c-4186-ae5e-fb5efee9ec7b} + {d2e1c6bb-1648-4f5d-bc5d-9c936e805241} - {49f79eca-489a-4e41-9cb4-5cb3efa345ce} + {138ac146-1a99-40b8-b9ad-017f3124ca3b} - {9b6ecadc-87b6-4e76-b302-5cd1e9339e53} + {0748503d-c7d2-419a-b4fe-8ce6e11c9a22} - {71d351ab-d39b-402f-bfff-34f98d6e65f3} + {62f1f846-e38c-4aa9-b5ff-3db6d3b9d8c9} - {1d2f2aba-f9c7-4edc-b302-a3143ee6a63f} + {cd05f9d0-8834-43e1-9f7d-fe13010fb7fd} - {8363348d-3499-445f-93f2-acb1d34db1ee} + {f947b4e3-ddc8-4428-9ed7-6890cd192e20} - {44711a22-ed48-4d62-b6c3-203b4312dc6a} + {df9ba858-bffd-49a1-aaed-e31ac6c3b674} - {c1d81fd5-48dd-42f9-8f95-fe1300a5f9b6} + {9ef16041-eee8-4969-ae44-a6283391de86} - {ab0016f0-7810-44bf-a62d-721ee58c9a42} + {c6d54071-115c-4aec-933f-c5b9af2dc2d0} - {12a8ade4-619a-4d42-8b38-84d60997b8cf} + {dcd04f8e-40f4-4bd3-91d3-098fd9616ac3} - {2a6a25f3-90c1-4ca9-b46a-d1e4bdffa6e0} + {7ab7eeea-e469-4bb0-b670-8c9930ee6fb1} - {6d2e622f-8236-4443-a280-4425af2dc018} + {28eacab5-c128-4f8a-afb6-1ae532ce380c} - {1b7044c7-9e8f-47c6-8d63-cd426aea4224} + {4a798866-728a-4519-b796-30c7532648eb} - {df87c970-043d-4654-9719-478910cc1dd6} + {a4f43ff9-3f10-43c1-9690-b75759d93bd9} - {ee898654-6a57-4836-84d3-020fe8691181} + {d1287b76-6c5f-43da-b7e1-9edea31ec7e5} - {4a538045-ae84-4017-983b-b6b037434619} + {15682ece-1f4b-45a2-98a7-7f4a7a5e3e77} - {7ff1433e-13fa-4335-975a-7b3a1c51bfd7} + {d237a082-578c-485e-bfce-f4ce324e2347} - {12bf45e4-01e8-47ac-a2fd-85801e0bd515} + {2ef6633a-41b6-49d4-b0fc-002ec72f9544} - {a0a92bd4-b801-49d2-8743-f36f6bc971cb} + {f2f5e1d1-e381-4998-92c3-3ce2946959d3} - {53fd855e-d66d-46a8-8790-0dd5f6d7b32b} + {a2e2d7ea-112d-491b-a3c4-3756721f70e2} - {f096a4aa-4e73-402d-869b-f66562678d66} + {3fe373f2-5d0c-43f1-9439-e176ad344747} - {ee7e3c59-2630-452d-ad3e-52f28a738e40} + {09fd9726-12ee-47e4-a06e-0c0b6642d18c} - {125f3f04-e591-4f38-9f73-250362647b50} + {978f1bbc-4aec-4d33-ac0d-76f16c9830c9} - {1382c0c6-f61a-48b3-87df-83e495bb0e58} + {1143797a-50d4-4ec8-ae42-226b5d2b8804} - {69c9f1c1-ab24-48fd-a560-3b1cbadf0a72} + {19d89d32-45ff-4bf9-b49b-f50a72bb0a2e} - {c9a36242-f6cd-4138-812c-6ad76264bbe7} + {d5d662bc-f74b-488d-84a2-52c1d4f439cb} - {07a93113-2a00-4807-a3e2-47c86506a9b6} + {86087ecd-a488-46df-851f-014d1c9f0711} - {69b7dc5d-1585-4641-9065-f0f03f42a3d8} + {cd0b7f09-23a0-4fc5-8cc3-aa43030a56e4} - {f321a8e4-e677-466c-abec-f6939f9c80df} + {ddaa9e13-ea06-4380-8949-effa4d2afd91} - {f7d6ecfd-b045-438e-b715-b7355fb4cf5b} + {cb3c724c-57ca-4409-af7e-54a0b1a0833e} - {3238c255-6ee3-486a-8e3d-9bcb8f22b3a0} + {e625ed80-f116-455c-8cd8-4eea8dfe549e} - {f8668051-3cfe-424e-b417-82a88370c8c2} + {b6202e98-4eb8-4884-8bd2-5bd0e751297c} - {ac68c9fa-0fa8-41e1-a993-72067654866b} + {7e52d977-686f-4ea6-8072-e84c91a29302} - {98fa619f-f7f8-45d8-9d6b-e50b111b77c4} + {3067edb0-bb4a-44bf-851b-5320aa50c1b2} - {d648920e-76fc-4d3d-8337-64a95f751ab3} + {718fff0e-fa9c-48e0-9531-293c0295eec6} - {1241adb6-6ae2-454b-82aa-46f8f460b141} + {50a46589-ee20-4660-b03d-54695a8c1d71} - {74814059-de13-47bc-9519-80f59cdb3325} + {ac136c24-0cfa-4532-9f55-52f9da386f85} - {7886d8d8-6c25-4523-861a-b0f9ab85b5aa} + {0a7efe78-f400-4131-940d-1287297f4b60} @@ -237,6 +237,9 @@ Sockets\Header Files + + Sockets\Header Files + Messages\Header Files @@ -587,6 +590,9 @@ Sockets\Source Files + + Sockets\Source Files + Messages\Source Files diff --git a/Net/Net_vs160.vcxproj b/Net/Net_vs160.vcxproj index 51092d0f6..d38ca5890 100644 --- a/Net/Net_vs160.vcxproj +++ b/Net/Net_vs160.vcxproj @@ -1,4 +1,4 @@ - + @@ -55,121 +55,111 @@ {B057A1FE-09F7-465E-B8B5-E1B659051D76} Net Win32Proj + 10.0 - + StaticLibrary - MultiByte v142 + MultiByte StaticLibrary - MultiByte v142 + MultiByte StaticLibrary - MultiByte v142 + MultiByte StaticLibrary - MultiByte v142 + MultiByte DynamicLibrary - MultiByte v142 + MultiByte DynamicLibrary - MultiByte v142 + MultiByte StaticLibrary - MultiByte v142 + MultiByte StaticLibrary - MultiByte v142 + MultiByte StaticLibrary - MultiByte v142 + MultiByte StaticLibrary - MultiByte v142 + MultiByte DynamicLibrary - MultiByte v142 + MultiByte DynamicLibrary - MultiByte v142 + MultiByte - - + + + - + - + - + - + - + - + - + - + - + - + - + - + - + - <_ProjectFileVersion>16.0.32002.118 - PocoNetd - PocoNetmdd - PocoNetmtd - PocoNet - PocoNetmd - PocoNetmt - PocoNet64d - PocoNetmdd - PocoNetmtd - PocoNet64 - PocoNetmd - PocoNetmt + <_ProjectFileVersion>16.0.32602.291 ..\bin\ @@ -201,6 +191,7 @@ ..\bin64\ obj64\Net\$(Configuration)\ true + Poco$(ProjectName)64d ..\bin64\ @@ -210,6 +201,7 @@ ..\lib64\ obj64\Net\$(Configuration)\ + Poco$(ProjectName)64d ..\lib64\ @@ -218,6 +210,7 @@ ..\lib64\ obj64\Net\$(Configuration)\ + Poco$(ProjectName)64d ..\lib64\ @@ -235,11 +228,11 @@ true true true - + Level3 ProgramDatabase Default - true + /Zc:__cplusplus %(AdditionalOptions) ws2_32.lib;iphlpapi.lib;%(AdditionalDependencies) @@ -268,11 +261,11 @@ true true true - + Level3 - + Default - true + /Zc:__cplusplus %(AdditionalOptions) ws2_32.lib;iphlpapi.lib;%(AdditionalDependencies) @@ -299,12 +292,12 @@ true true true - + ..\lib\PocoNetmtd.pdb Level3 ProgramDatabase Default - true + /Zc:__cplusplus %(AdditionalOptions) ..\lib\PocoNetmtd.lib @@ -325,11 +318,11 @@ true true true - + Level3 - + Default - true + /Zc:__cplusplus %(AdditionalOptions) ..\lib\PocoNetmt.lib @@ -347,12 +340,12 @@ true true true - + ..\lib\PocoNetmdd.pdb Level3 ProgramDatabase Default - true + /Zc:__cplusplus %(AdditionalOptions) ..\lib\PocoNetmdd.lib @@ -373,12 +366,12 @@ true true true - + ..\lib\PocoNetmd.pdb Level3 - + Default - true + /Zc:__cplusplus %(AdditionalOptions) ws2_32.lib;iphlpapi.lib;%(AdditionalDependencies) @@ -397,11 +390,11 @@ true true true - + Level3 ProgramDatabase Default - true + /Zc:__cplusplus %(AdditionalOptions) ws2_32.lib;iphlpapi.lib;%(AdditionalDependencies) @@ -430,11 +423,11 @@ true true true - + Level3 - + Default - true + /Zc:__cplusplus %(AdditionalOptions) ws2_32.lib;iphlpapi.lib;%(AdditionalDependencies) @@ -461,12 +454,12 @@ true true true - + ..\lib64\PocoNetmtd.pdb Level3 ProgramDatabase Default - true + /Zc:__cplusplus %(AdditionalOptions) ..\lib64\PocoNetmtd.lib @@ -487,11 +480,11 @@ true true true - + Level3 - + Default - true + /Zc:__cplusplus %(AdditionalOptions) ..\lib64\PocoNetmt.lib @@ -509,12 +502,12 @@ true true true - + ..\lib64\PocoNetmdd.pdb Level3 ProgramDatabase Default - true + /Zc:__cplusplus %(AdditionalOptions) ..\lib64\PocoNetmdd.lib @@ -535,454 +528,244 @@ true true true - + Level3 - + Default - true + /Zc:__cplusplus %(AdditionalOptions) ..\lib64\PocoNetmd.lib - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -996,6 +779,7 @@ true - - - + + + + \ No newline at end of file diff --git a/Net/Net_vs160.vcxproj.filters b/Net/Net_vs160.vcxproj.filters index d02b15851..90b7d9fd2 100644 --- a/Net/Net_vs160.vcxproj.filters +++ b/Net/Net_vs160.vcxproj.filters @@ -2,166 +2,166 @@ - {402148df-1810-4d87-a41d-c73539eeaf77} + {bed832ba-a95b-4705-bae5-450346a929cc} - {d7b25211-c15e-4f0f-b59c-093d798f8a72} + {93f2a194-0ff5-4a3b-9fdf-f624d4c33621} - {1ad3017c-7bef-4f41-9cc1-d8b974a27bbe} + {7810a6dc-8653-4cff-9726-c6cea4206a7f} - {6e94bb39-e1da-49bf-aa66-bab24f593c8f} + {0c7af21f-1e0b-474a-ab12-2c3ed7567d99} - {8ed0098e-a47f-41ad-b4fe-9c89d8922c2d} + {58429bdc-9ed0-4975-b68b-0f0e9fa057cc} - {729ab1f0-ab39-47c9-8766-7df6d56edaaf} + {c8044bc6-8480-4ccc-ac78-0edbba7b65ac} - {ecdec0fc-16e3-495f-95d0-2388c34cedcb} + {05e2d088-4223-49e9-901a-6f27631b263e} - {a8abfb8b-636f-4f99-a92a-053ea7cc691d} + {d3a90e5d-c574-4a4f-b65c-cec1d052ac0c} - {4043898e-b26c-4315-a624-025217a1e251} + {225651c0-2bc5-4c9e-b2f8-08ab5ba0d787} - {61cb93b4-2823-450f-81a1-a6055c99ba6c} + {6a888e17-3ed1-49f2-a818-856e6224f227} - {010de15b-3ee4-43f2-8bf2-028f0ace569f} + {b9f3b53b-fea5-4824-95fb-543d87a2544c} - {5a0daeb7-4f18-4bc3-8717-9814f8928d90} + {1544387d-a026-481a-afae-c480dd8a084a} - {288eb163-621d-426e-9142-8bd76969efa7} + {14eed53a-65ba-4cb7-8ead-71baa43b9883} - {8377bf46-27f1-4a7b-8235-aadd080774c4} + {6e9b1345-51f5-4691-97a0-f3c9a2d6e889} - {b7d5c4d5-74f1-4ad9-aaf0-4302042766d7} + {baa582d2-e6b3-4be0-b329-6e2cf22ba226} - {7cc4c6b7-5321-4b59-b118-f258571eda13} + {23e5989d-7809-41b9-9fb3-b7055d27efed} - {c5fd5cf8-846e-4a7d-af3d-ed1d7fadb25f} + {ba10327a-faf3-49b5-90c3-39822da37581} - {b00197e9-ef09-4fd4-9695-7cb89bd0cadc} + {313dee8a-089b-4b6a-8b2f-a4ab8a8cffd7} - {1d947826-d4aa-418b-b982-c731e1878b43} + {d2d51c47-9641-4f60-b818-1845c5c1f8e1} - {042479be-24c4-4977-9ce0-1c157e00f8c1} + {377e091e-8911-4cca-94c6-fb3824b02851} - {e1fa2656-e63a-486e-a000-3e1173b0019b} + {523adf2c-368e-4d90-b473-d8f8624e8558} - {62682b9e-f622-45b1-861d-9d9da51ab87d} + {380fafe0-96d6-4a07-8d11-36b2a018eeac} - {494ee506-0f56-4e44-93e3-9f21e7a77a38} + {b027048f-e732-485d-b82c-4ddf1aed8f4e} - {66c9cfdb-2542-46be-8f23-512b37e83432} + {632b5d4d-5d53-4ef9-9e5a-cb53c6de074a} - {38b8105f-36cb-4bc4-8884-5020e2a3c028} + {6f170f7c-2496-47b8-bf21-162fc81c6e91} - {6a64e643-e97e-4415-b3c5-be4a80405912} + {a3f42d0d-87fc-48d5-9c2c-ef8e86128d40} - {f64a10af-6e42-4645-8f98-3482fd7766f6} + {865e8eb7-04e3-476e-9e88-54de986b182b} - {8059b691-1b7e-4a0b-b96e-e15c1d9517ac} + {dde5350e-8cd1-4433-aebc-99430dc977da} - {80feb7dc-c893-4799-a143-2f36648f1bab} + {72bf844b-f7b9-4c31-8cc8-f583f8e854a9} - {7a524320-d713-495c-86db-6672632c5aa6} + {b14688d8-c23a-48e1-b2a2-705d288a831d} - {99de76a7-fe6b-4e1d-8cf3-be76ca0b512d} + {fc10e20f-b157-4802-b07c-d007381aaf2f} - {5bbb1bd8-d7a4-4d10-ab14-63cafef6f612} + {2e0d517c-b1cc-46c6-9e50-9002dc577244} - {9b640510-2c67-457f-9f00-ec9654e6af3a} + {89aa00e5-0406-483a-9d7b-de052ed37737} - {c2245dba-8bf4-4ffc-83c9-913db49fa34d} + {2822c50d-1587-4961-bcd8-5ee51abdb3dd} - {2a4a8750-284b-40eb-9c11-6aa13b0864c8} + {26fe38eb-f582-4228-9b5f-07811103f039} - {93327379-9b7e-43d2-92b0-ceab04c041e1} + {2f425b6a-f624-4f4b-b7b8-65871db14c6d} - {d2058c83-1230-481c-9cc7-239c24e3fcee} + {b91e1cea-026f-4d3c-a63b-b8782410e840} - {3ac5bf39-2024-4835-b904-4f0055a8b099} + {743b0b14-96c1-4afe-944d-724bf5d58a0d} - {d854d7dc-6a74-49e0-8fe0-b1788ee510d2} + {b3a1a237-8a37-4b00-b6fb-d749d4318853} - {2dae2b61-9fb8-48d7-ac36-54848e6dc3b5} + {6a56da21-c70d-4aef-83a7-e52c5f1034d1} - {7c9114dd-b8f6-438d-b165-fb01b7f0ca95} + {38a6fe24-4510-44ed-85f0-1cd6b51eacac} - {f05fd66a-5747-41f6-9ec9-6ae7e5850eff} + {57ef8eed-d8a1-457d-97b0-9cee45caa768} - {5fad2fc1-b98b-4b4c-ac12-a9bea7001e77} + {1df4476d-ad6b-4a46-a700-542dcbcc2a9b} - {fa33e5eb-ee72-494a-89f2-7ef26eac63a1} + {8142cf6c-34fd-4422-a990-6ac75ed002fc} - {472030c3-9bb7-4fd6-b65b-9e2ef683d58a} + {c0ccf258-573d-41e0-ae2f-9b61b13b1b97} - {bdd08486-fbfb-48fc-ba3a-7dc44df5ce3b} + {0ede4b80-eb1d-4a19-919a-73ab90f52615} - {09297207-28d3-40b2-9e20-6fd9c7d84c34} + {f47c3759-b6c8-4624-87d3-ceefe97bf4be} - {bfdbeb4e-fb50-4c94-a579-3095e55af174} + {8c7b5ee2-29a5-4c8a-8a5e-d4dddacc5be1} - {0a00644c-8a92-475c-aa79-b02581f63bd8} + {6d99153b-133e-4ae1-9073-5514ed5ef78f} - {c181f9f4-5725-4d15-8dac-059ec06fe660} + {dc33e8ab-ab14-4bbd-9c62-52dec8f8d272} - {b051aceb-84c2-4385-a22a-cd77702efa52} + {5806cf33-fbc0-4526-af18-fe5e492c15ee} - {d4e799db-92df-48b1-a820-ea264e118e57} + {32b579fd-0a2b-49c0-a7d8-bdc983f40ad7} - {3ef21170-bef8-4a68-9422-da4c7bdcec3f} + {04860b74-59ae-4851-b937-c5aac4c0c005} - {eabff0fa-1618-4cf0-a0a2-f2c580b9851e} + {1141b428-8ea1-4db8-a50b-0c73de626a9d} @@ -237,6 +237,9 @@ Sockets\Header Files + + Sockets\Header Files + Messages\Header Files @@ -587,6 +590,9 @@ Sockets\Source Files + + Sockets\Source Files + Messages\Source Files diff --git a/Net/Net_vs170.vcxproj b/Net/Net_vs170.vcxproj index 8999e123b..884044023 100644 --- a/Net/Net_vs170.vcxproj +++ b/Net/Net_vs170.vcxproj @@ -1,10 +1,6 @@ - - + + - - debug_shared - ARM64 - debug_shared Win32 @@ -13,10 +9,6 @@ debug_shared x64 - - debug_static_md - ARM64 - debug_static_md Win32 @@ -25,10 +17,6 @@ debug_static_md x64 - - debug_static_mt - ARM64 - debug_static_mt Win32 @@ -37,10 +25,6 @@ debug_static_mt x64 - - release_shared - ARM64 - release_shared Win32 @@ -49,10 +33,6 @@ release_shared x64 - - release_static_md - ARM64 - release_static_md Win32 @@ -61,10 +41,6 @@ release_static_md x64 - - release_static_mt - ARM64 - release_static_mt Win32 @@ -75,206 +51,114 @@ - 17.0 Net {B057A1FE-09F7-465E-B8B5-E1B659051D76} Net Win32Proj - + StaticLibrary + v142 MultiByte - v143 StaticLibrary + v142 MultiByte - v143 StaticLibrary + v142 MultiByte - v143 StaticLibrary + v142 MultiByte - v143 DynamicLibrary + v142 MultiByte - v143 DynamicLibrary + v142 MultiByte - v143 - - - StaticLibrary - MultiByte - v143 - - - StaticLibrary - MultiByte - v143 - - - StaticLibrary - MultiByte - v143 - - - StaticLibrary - MultiByte - v143 - - - DynamicLibrary - MultiByte - v143 - - - DynamicLibrary - MultiByte - v143 StaticLibrary + v142 MultiByte - v143 StaticLibrary + v142 MultiByte - v143 StaticLibrary + v142 MultiByte - v143 StaticLibrary + v142 MultiByte - v143 DynamicLibrary + v142 MultiByte - v143 DynamicLibrary + v142 MultiByte - v143 - - + + + - + - + - + - + - + - - - - - - - - - - - - - - - - - - - + - + - + - + - + - + - + - + - <_ProjectFileVersion>17.0.32505.173 - PocoNetA64d - PocoNetmdd - PocoNetmtd - PocoNetA64 - PocoNetmd - PocoNetmt - PocoNetd - PocoNetmdd - PocoNetmtd - PocoNet - PocoNetmd - PocoNetmt - PocoNet64d - PocoNetmdd - PocoNetmtd - PocoNet64 - PocoNetmd - PocoNetmt - - - ..\binA64\ - objA64\Net\$(Configuration)\ - true - - - ..\binA64\ - objA64\Net\$(Configuration)\ - false - - - ..\libA64\ - objA64\Net\$(Configuration)\ - - - ..\libA64\ - objA64\Net\$(Configuration)\ - - - ..\libA64\ - objA64\Net\$(Configuration)\ - - - ..\libA64\ - objA64\Net\$(Configuration)\ + <_ProjectFileVersion>16.0.32602.291 ..\bin\ @@ -328,166 +212,6 @@ ..\lib64\ obj64\Net\$(Configuration)\ - - - Disabled - .\include;..\Foundation\include;%(AdditionalIncludeDirectories) - WIN32;_DEBUG;_WINDOWS;_USRDLL;Net_EXPORTS;%(PreprocessorDefinitions) - true - EnableFastChecks - MultiThreadedDebugDLL - true - true - true - true - - Level3 - ProgramDatabase - Default - true - - - ws2_32.lib;iphlpapi.lib;%(AdditionalDependencies) - ..\binA64\PocoNetA64d.dll - true - true - ..\binA64\PocoNetA64d.pdb - ..\libA64;%(AdditionalLibraryDirectories) - Console - ..\libA64\PocoNetd.lib - MachineARM64 - - - - - MaxSpeed - OnlyExplicitInline - true - Speed - true - .\include;..\Foundation\include;%(AdditionalIncludeDirectories) - WIN32;NDEBUG;_WINDOWS;_USRDLL;Net_EXPORTS;%(PreprocessorDefinitions) - true - MultiThreadedDLL - false - true - true - true - - Level3 - - Default - true - - - ws2_32.lib;iphlpapi.lib;%(AdditionalDependencies) - ..\binA64\PocoNetA64.dll - true - false - ..\libA64;%(AdditionalLibraryDirectories) - Console - true - true - ..\libA64\PocoNet.lib - MachineARM64 - - - - - Disabled - .\include;..\Foundation\include;%(AdditionalIncludeDirectories) - WIN32;_DEBUG;_WINDOWS;POCO_STATIC;%(PreprocessorDefinitions) - true - EnableFastChecks - MultiThreadedDebug - true - true - true - true - - ..\libA64\PocoNetmtd.pdb - Level3 - ProgramDatabase - Default - true - - - ..\libA64\PocoNetmtd.lib - - - - - MaxSpeed - OnlyExplicitInline - true - Speed - true - .\include;..\Foundation\include;%(AdditionalIncludeDirectories) - WIN32;NDEBUG;_WINDOWS;POCO_STATIC;%(PreprocessorDefinitions) - true - MultiThreaded - false - true - true - true - - Level3 - - Default - true - - - ..\libA64\PocoNetmt.lib - - - - - Disabled - .\include;..\Foundation\include;%(AdditionalIncludeDirectories) - WIN32;_DEBUG;_WINDOWS;POCO_STATIC;%(PreprocessorDefinitions) - true - EnableFastChecks - MultiThreadedDebugDLL - true - true - true - true - - ..\libA64\PocoNetmdd.pdb - Level3 - ProgramDatabase - Default - true - - - ..\libA64\PocoNetmdd.lib - - - - - MaxSpeed - OnlyExplicitInline - true - Speed - true - .\include;..\Foundation\include;%(AdditionalIncludeDirectories) - WIN32;NDEBUG;_WINDOWS;POCO_STATIC;%(PreprocessorDefinitions) - true - MultiThreadedDLL - false - true - true - true - - Level3 - - Default - true - - - ..\libA64\PocoNetmd.lib - - Disabled @@ -500,11 +224,11 @@ true true true - + Level3 ProgramDatabase Default - true + /Zc:__cplusplus %(AdditionalOptions) ws2_32.lib;iphlpapi.lib;%(AdditionalDependencies) @@ -533,11 +257,11 @@ true true true - + Level3 - + Default - true + /Zc:__cplusplus %(AdditionalOptions) ws2_32.lib;iphlpapi.lib;%(AdditionalDependencies) @@ -564,12 +288,12 @@ true true true - + ..\lib\PocoNetmtd.pdb Level3 ProgramDatabase Default - true + /Zc:__cplusplus %(AdditionalOptions) ..\lib\PocoNetmtd.lib @@ -590,11 +314,11 @@ true true true - + Level3 - + Default - true + /Zc:__cplusplus %(AdditionalOptions) ..\lib\PocoNetmt.lib @@ -612,12 +336,12 @@ true true true - + ..\lib\PocoNetmdd.pdb Level3 ProgramDatabase Default - true + /Zc:__cplusplus %(AdditionalOptions) ..\lib\PocoNetmdd.lib @@ -638,12 +362,12 @@ true true true - + ..\lib\PocoNetmd.pdb Level3 - + Default - true + /Zc:__cplusplus %(AdditionalOptions) ws2_32.lib;iphlpapi.lib;%(AdditionalDependencies) @@ -662,11 +386,11 @@ true true true - + Level3 ProgramDatabase Default - true + /Zc:__cplusplus %(AdditionalOptions) ws2_32.lib;iphlpapi.lib;%(AdditionalDependencies) @@ -695,11 +419,11 @@ true true true - + Level3 - + Default - true + /Zc:__cplusplus %(AdditionalOptions) ws2_32.lib;iphlpapi.lib;%(AdditionalDependencies) @@ -726,12 +450,12 @@ true true true - + ..\lib64\PocoNetmtd.pdb Level3 ProgramDatabase Default - true + /Zc:__cplusplus %(AdditionalOptions) ..\lib64\PocoNetmtd.lib @@ -752,11 +476,11 @@ true true true - + Level3 - + Default - true + /Zc:__cplusplus %(AdditionalOptions) ..\lib64\PocoNetmt.lib @@ -774,12 +498,12 @@ true true true - + ..\lib64\PocoNetmdd.pdb Level3 ProgramDatabase Default - true + /Zc:__cplusplus %(AdditionalOptions) ..\lib64\PocoNetmdd.lib @@ -800,471 +524,258 @@ true true true - + Level3 - + Default - true + /Zc:__cplusplus %(AdditionalOptions) ..\lib64\PocoNetmd.lib - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - true true true - true true true - true true true - true true true - - - + + + + \ No newline at end of file diff --git a/Net/Net_vs170.vcxproj.filters b/Net/Net_vs170.vcxproj.filters index e8681c8e4..b953222f1 100644 --- a/Net/Net_vs170.vcxproj.filters +++ b/Net/Net_vs170.vcxproj.filters @@ -2,166 +2,166 @@ - {911f56bb-049d-4d4d-a0d5-7f938744fc02} + {6c27ca1b-370f-4f84-9990-cba55eb25b04} - {b3a5feb8-1e61-4684-93b2-e6e2729f8f59} + {05f4a0d9-3c77-42b7-9888-67d6ceb8218f} - {acb399c5-f26f-47fa-ae8b-2570e98fc6b9} + {db990ea9-789f-459e-bb2e-62ee3753ccf1} - {0d3e56ff-4aae-41e7-a383-c640af227a92} + {df0a4848-318a-4998-89a6-6a3495945547} - {a33c960c-5992-4770-9228-d803934a6f7e} + {36e7c6e5-52ef-45da-90a0-bf114909fd0d} - {035f2f4c-6b45-45b6-92ad-80609486fb63} + {2bda3d02-92da-4338-ad5f-5a9491337cb9} - {801e176c-77da-4180-91bf-fbe0ba5777b9} + {ca5096c9-2089-4d3c-9716-ae30b430e9f1} - {8398e24c-7330-4b20-a610-52070c69f3b3} + {d2e98f12-55be-4dfa-be01-6ac89c5e2d3d} - {2d6e12d0-4024-4fe6-9b2f-c174efe3cea0} + {2005522e-6b39-46b5-b852-387cebac3dca} - {1b40f490-ba0b-4f0b-8def-9270a19b4aa6} + {f45bc70e-bb16-401f-95ed-9b1fc5334923} - {df2c3e2b-730a-4c92-b084-ba4d680bb196} + {487c9dda-525c-42dc-ae0f-23447d877ec1} - {7ca5f53a-9e26-4600-a44d-5d32483dec8b} + {677c9111-0749-4c40-b5b3-68778b0c025a} - {c8d8d59a-1fe7-4317-8f5f-c3b8195f0eac} + {6928ee14-cd60-487e-96d7-41fe08004907} - {63058a84-fcdc-48f2-816a-1011c8c1b4fc} + {f9b9ff90-ed6d-4019-a616-541da2801063} - {9df64c47-e030-42e2-b244-3d53f3e75fcd} + {22c5b06b-1652-4cad-bca3-f5343b121038} - {e9b7c2f2-04a3-4bb6-bb80-e31d0fab6173} + {fa9b7f94-3b11-4b8e-8651-eea8bcff105c} - {07e92825-c445-4add-b93d-b6f019a103c8} + {95e3d6c3-ee39-4692-9ddf-437a9aa9322d} - {b886e732-7fce-4910-8681-e352fb440b7f} + {b9c76aa3-371c-4284-ae16-43c17202e4ee} - {c33c3241-ea4c-4279-bf67-407b0e61c5a7} + {c0663262-219d-4ff9-8a98-537f39ac144c} - {0190ed6f-cc86-4218-9d17-f5717b6cf6d9} + {746999cd-4463-40d2-802b-07493963a40b} - {15a6d403-4a28-4c2a-a2e6-0d6e80deadfa} + {87225a80-f84b-44d2-b8cf-33724b112c98} - {dd132ecb-6d2c-4b5c-b4d6-5fd8302348e1} + {13e6ec7c-33e9-430d-8e37-049a07c51a2f} - {8ba0d9dc-036b-46b5-a0ba-0ed450f82293} + {953ca569-497e-4b96-b4d0-140a7bcc2506} - {d152a8b3-c193-4b2e-af7f-b24e0c8f2d0d} + {c044f6be-046c-4c89-99c4-1ed3cb4be465} - {5501c616-f154-4401-9a21-cdca08ee50c7} + {a63817fe-d690-408d-9813-c432d849b958} - {6da235cd-b41f-4ecb-a9d5-a338a7213736} + {07f531f7-8417-49ff-9e88-a442e8afb692} - {3dfcda0f-7d4a-4f52-8efc-2307230d83f6} + {b6e03a15-e06b-4719-ae24-a645ce3c585f} - {989410e5-21d1-42e7-bfa9-c44acaebc029} + {652dfc6b-15ad-4490-ab39-6289f101372e} - {08bf7247-0028-44e5-918e-2ed119a8234b} + {281c7108-f5bf-4b53-b025-4f548966b8ce} - {9c5dc8c9-aabb-4cd8-8b74-5a17da821f02} + {1f8aea71-7832-4297-9024-5c641b8dbcf1} - {f938b867-060d-4737-9f49-25ccea5b957a} + {7857ddec-f1b1-49a5-a0ba-34525c11313f} - {dd698354-21c3-4309-a998-e37acf21a217} + {adfd98a1-61ff-427e-b745-4da327283b77} - {1c10f00f-d776-4da4-83e7-b41182e08a28} + {5e41b706-eecb-4413-9780-b84a50838f33} - {fce5e7ec-6fd9-439e-8df8-6b908390c741} + {996852e0-e04f-4330-b2e0-40a3711aaac9} - {c181296a-fc76-4b0e-a31b-418fe46a1360} + {7e343a97-40a8-4e31-ae02-92ff091491ff} - {5648a9a9-bc9b-42b5-9cdd-9c17e1437178} + {9eb83c02-35f8-4fc6-ae7d-46ba7366fbba} - {be4fd9fd-85d4-4586-9e59-2b0622b04505} + {48a78f65-948d-4ba6-a00a-c662a7a63015} - {54237d6d-6d2e-4f79-ab14-58e8dede50cc} + {8f1fe13b-8b69-48cf-b785-dbc24ff00b86} - {ff1c12e6-cd02-4643-8c60-b7e651413022} + {18312299-4930-4208-a0a4-b6015e297627} - {78b905a0-35ff-46f7-8062-13555ff1894f} + {5dc3d9ad-41a2-494c-9551-e4835fd6210a} - {7d1ea7cf-6355-420b-99a7-addeeca4370c} + {c80302ac-93ae-45ab-a924-26a2f389be58} - {b4c88a7d-7bea-4f64-a1bb-c3c9b8e24245} + {7a6da3e3-1dd8-4afa-aa76-638ddd1dd50b} - {02df74a1-bdc6-4076-b273-fc43fd4975da} + {2b43bf16-90e5-442e-8602-c4f3a5c95bea} - {56b6fa19-3510-4cdb-b80e-6a31d62a2aa6} + {bb79bbd5-2dcd-44fb-9145-e23bcdb1007b} - {e6cf0135-83ac-4cb5-98c0-11491870d830} + {33923922-e4a7-4895-b475-facd1706bf31} - {ecdb88cc-206a-407e-9f06-addbf0b0728d} + {9528d428-9211-4684-b2aa-ba1158ac1970} - {b543122a-99ec-4dcb-b84f-db57f26fdeca} + {5cb1bf77-6758-42bc-9ead-bebeb7fbe944} - {fbced114-043b-4618-9cac-9257023a2ccb} + {600591f5-f4a4-4b50-9f9f-3e7866cdd178} - {3ffb60fe-8666-4130-ae45-84381cacb212} + {ed8e6131-dcfa-40c6-988a-afcdcde40b06} - {abed7288-dfb0-4381-994d-62683940ca49} + {a2bfdf5a-8fa0-4ba9-98c6-70d75fca9bc0} - {049036d6-7e2b-451f-9f8b-b665375bb258} + {9aefa0a0-82c0-4e84-93b2-6a62164f2d1a} - {d9e0f5f8-1057-49f5-ae66-4a9db6e73d67} + {ff9c6c19-fcb1-481e-844a-a56469859b9b} - {f9788d4b-3688-4a29-8856-b6246c49da88} + {178e0cbf-87d9-4d73-9a55-fa5e7e903e34} - {169fb8fb-c41c-480e-a4a6-e13f271cc754} + {40c4f538-6196-4e06-a2ff-26029f9a1016} @@ -237,6 +237,9 @@ Sockets\Header Files + + Sockets\Header Files + Messages\Header Files @@ -587,6 +590,9 @@ Sockets\Source Files + + Sockets\Source Files + Messages\Source Files diff --git a/Net/Net_vs90.vcproj b/Net/Net_vs90.vcproj index f6b339ecc..98c5c5b20 100644 --- a/Net/Net_vs90.vcproj +++ b/Net/Net_vs90.vcproj @@ -643,6 +643,10 @@ RelativePath=".\include\Poco\Net\StreamSocketImpl.h" > + + + + - + \ No newline at end of file diff --git a/Net/include/Poco/Net/Net.h b/Net/include/Poco/Net/Net.h index 025f31cea..58e052af3 100644 --- a/Net/include/Poco/Net/Net.h +++ b/Net/include/Poco/Net/Net.h @@ -132,7 +132,7 @@ POCO_NET_FORCE_SYMBOL(pocoNetworkInitializer) #endif -#if POCO_OS == POCO_OS_LINUX +#if (POCO_OS == POCO_OS_LINUX) || (POCO_OS == POCO_OS_WINDOWS_NT) #define POCO_HAVE_FD_EPOLL 1 #endif @@ -144,17 +144,4 @@ POCO_NET_FORCE_SYMBOL(pocoNetworkInitializer) #endif -#if defined(POCO_OS_FAMILY_WINDOWS) - #ifndef POCO_HAVE_FD_POLL - // WSAPoll wants POLLOUT flag in order to return POLERR when there is no - // server on the other side. Windows default is multi-fd_set select, WSAPoll - // is disabled and not considered a production-grade code. - // see https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-wsapoll - // This is the version where the WSAPoll was (allegedly) fixed. - #if defined(WDK_NTDDI_VERSION) && (WDK_NTDDI_VERSION >= NTDDI_WIN10_VB) - //#define POCO_HAVE_FD_POLL 1 - #endif - #endif -#endif - #endif // Net_Net_INCLUDED diff --git a/Net/samples/EchoServer/EchoServer.progen b/Net/samples/EchoServer/EchoServer.progen index dd7209c7a..c610dc055 100644 --- a/Net/samples/EchoServer/EchoServer.progen +++ b/Net/samples/EchoServer/EchoServer.progen @@ -7,4 +7,5 @@ vc.project.platforms = Win32 vc.project.configurations = debug_shared, release_shared, debug_static_mt, release_static_mt, debug_static_md, release_static_md vc.project.prototype = ${vc.project.name}_vs90.vcproj vc.project.compiler.include = ..\\..\\..\\Foundation\\include;..\\..\\..\\XML\\include;..\\..\\..\\Util\\include;..\\..\\..\\Net\\include +vc.project.compiler.additionalOptions = /Zc:__cplusplus vc.project.linker.dependencies.Win32 = ws2_32.lib iphlpapi.lib diff --git a/Net/samples/HTTPFormServer/HTTPFormServer.progen b/Net/samples/HTTPFormServer/HTTPFormServer.progen index dd7209c7a..c610dc055 100644 --- a/Net/samples/HTTPFormServer/HTTPFormServer.progen +++ b/Net/samples/HTTPFormServer/HTTPFormServer.progen @@ -7,4 +7,5 @@ vc.project.platforms = Win32 vc.project.configurations = debug_shared, release_shared, debug_static_mt, release_static_mt, debug_static_md, release_static_md vc.project.prototype = ${vc.project.name}_vs90.vcproj vc.project.compiler.include = ..\\..\\..\\Foundation\\include;..\\..\\..\\XML\\include;..\\..\\..\\Util\\include;..\\..\\..\\Net\\include +vc.project.compiler.additionalOptions = /Zc:__cplusplus vc.project.linker.dependencies.Win32 = ws2_32.lib iphlpapi.lib diff --git a/Net/samples/HTTPLoadTest/HTTPLoadTest.progen b/Net/samples/HTTPLoadTest/HTTPLoadTest.progen index dd7209c7a..c610dc055 100644 --- a/Net/samples/HTTPLoadTest/HTTPLoadTest.progen +++ b/Net/samples/HTTPLoadTest/HTTPLoadTest.progen @@ -7,4 +7,5 @@ vc.project.platforms = Win32 vc.project.configurations = debug_shared, release_shared, debug_static_mt, release_static_mt, debug_static_md, release_static_md vc.project.prototype = ${vc.project.name}_vs90.vcproj vc.project.compiler.include = ..\\..\\..\\Foundation\\include;..\\..\\..\\XML\\include;..\\..\\..\\Util\\include;..\\..\\..\\Net\\include +vc.project.compiler.additionalOptions = /Zc:__cplusplus vc.project.linker.dependencies.Win32 = ws2_32.lib iphlpapi.lib diff --git a/Net/samples/HTTPTimeServer/HTTPTimeServer.progen b/Net/samples/HTTPTimeServer/HTTPTimeServer.progen index dd7209c7a..c610dc055 100644 --- a/Net/samples/HTTPTimeServer/HTTPTimeServer.progen +++ b/Net/samples/HTTPTimeServer/HTTPTimeServer.progen @@ -7,4 +7,5 @@ vc.project.platforms = Win32 vc.project.configurations = debug_shared, release_shared, debug_static_mt, release_static_mt, debug_static_md, release_static_md vc.project.prototype = ${vc.project.name}_vs90.vcproj vc.project.compiler.include = ..\\..\\..\\Foundation\\include;..\\..\\..\\XML\\include;..\\..\\..\\Util\\include;..\\..\\..\\Net\\include +vc.project.compiler.additionalOptions = /Zc:__cplusplus vc.project.linker.dependencies.Win32 = ws2_32.lib iphlpapi.lib diff --git a/Net/samples/Mail/Mail.progen b/Net/samples/Mail/Mail.progen index dd7209c7a..c610dc055 100644 --- a/Net/samples/Mail/Mail.progen +++ b/Net/samples/Mail/Mail.progen @@ -7,4 +7,5 @@ vc.project.platforms = Win32 vc.project.configurations = debug_shared, release_shared, debug_static_mt, release_static_mt, debug_static_md, release_static_md vc.project.prototype = ${vc.project.name}_vs90.vcproj vc.project.compiler.include = ..\\..\\..\\Foundation\\include;..\\..\\..\\XML\\include;..\\..\\..\\Util\\include;..\\..\\..\\Net\\include +vc.project.compiler.additionalOptions = /Zc:__cplusplus vc.project.linker.dependencies.Win32 = ws2_32.lib iphlpapi.lib diff --git a/Net/samples/Ping/Ping.progen b/Net/samples/Ping/Ping.progen index dd7209c7a..c610dc055 100644 --- a/Net/samples/Ping/Ping.progen +++ b/Net/samples/Ping/Ping.progen @@ -7,4 +7,5 @@ vc.project.platforms = Win32 vc.project.configurations = debug_shared, release_shared, debug_static_mt, release_static_mt, debug_static_md, release_static_md vc.project.prototype = ${vc.project.name}_vs90.vcproj vc.project.compiler.include = ..\\..\\..\\Foundation\\include;..\\..\\..\\XML\\include;..\\..\\..\\Util\\include;..\\..\\..\\Net\\include +vc.project.compiler.additionalOptions = /Zc:__cplusplus vc.project.linker.dependencies.Win32 = ws2_32.lib iphlpapi.lib diff --git a/Net/samples/SMTPLogger/SMTPLogger.progen b/Net/samples/SMTPLogger/SMTPLogger.progen index dd7209c7a..c610dc055 100644 --- a/Net/samples/SMTPLogger/SMTPLogger.progen +++ b/Net/samples/SMTPLogger/SMTPLogger.progen @@ -7,4 +7,5 @@ vc.project.platforms = Win32 vc.project.configurations = debug_shared, release_shared, debug_static_mt, release_static_mt, debug_static_md, release_static_md vc.project.prototype = ${vc.project.name}_vs90.vcproj vc.project.compiler.include = ..\\..\\..\\Foundation\\include;..\\..\\..\\XML\\include;..\\..\\..\\Util\\include;..\\..\\..\\Net\\include +vc.project.compiler.additionalOptions = /Zc:__cplusplus vc.project.linker.dependencies.Win32 = ws2_32.lib iphlpapi.lib diff --git a/Net/samples/TimeServer/TimeServer.progen b/Net/samples/TimeServer/TimeServer.progen index dd7209c7a..c610dc055 100644 --- a/Net/samples/TimeServer/TimeServer.progen +++ b/Net/samples/TimeServer/TimeServer.progen @@ -7,4 +7,5 @@ vc.project.platforms = Win32 vc.project.configurations = debug_shared, release_shared, debug_static_mt, release_static_mt, debug_static_md, release_static_md vc.project.prototype = ${vc.project.name}_vs90.vcproj vc.project.compiler.include = ..\\..\\..\\Foundation\\include;..\\..\\..\\XML\\include;..\\..\\..\\Util\\include;..\\..\\..\\Net\\include +vc.project.compiler.additionalOptions = /Zc:__cplusplus vc.project.linker.dependencies.Win32 = ws2_32.lib iphlpapi.lib diff --git a/Net/samples/WebSocketServer/WebSocketServer.progen b/Net/samples/WebSocketServer/WebSocketServer.progen index dd7209c7a..c610dc055 100644 --- a/Net/samples/WebSocketServer/WebSocketServer.progen +++ b/Net/samples/WebSocketServer/WebSocketServer.progen @@ -7,4 +7,5 @@ vc.project.platforms = Win32 vc.project.configurations = debug_shared, release_shared, debug_static_mt, release_static_mt, debug_static_md, release_static_md vc.project.prototype = ${vc.project.name}_vs90.vcproj vc.project.compiler.include = ..\\..\\..\\Foundation\\include;..\\..\\..\\XML\\include;..\\..\\..\\Util\\include;..\\..\\..\\Net\\include +vc.project.compiler.additionalOptions = /Zc:__cplusplus vc.project.linker.dependencies.Win32 = ws2_32.lib iphlpapi.lib diff --git a/Net/samples/dict/dict.progen b/Net/samples/dict/dict.progen index dd7209c7a..c610dc055 100644 --- a/Net/samples/dict/dict.progen +++ b/Net/samples/dict/dict.progen @@ -7,4 +7,5 @@ vc.project.platforms = Win32 vc.project.configurations = debug_shared, release_shared, debug_static_mt, release_static_mt, debug_static_md, release_static_md vc.project.prototype = ${vc.project.name}_vs90.vcproj vc.project.compiler.include = ..\\..\\..\\Foundation\\include;..\\..\\..\\XML\\include;..\\..\\..\\Util\\include;..\\..\\..\\Net\\include +vc.project.compiler.additionalOptions = /Zc:__cplusplus vc.project.linker.dependencies.Win32 = ws2_32.lib iphlpapi.lib diff --git a/Net/samples/download/download.progen b/Net/samples/download/download.progen index dd7209c7a..c610dc055 100644 --- a/Net/samples/download/download.progen +++ b/Net/samples/download/download.progen @@ -7,4 +7,5 @@ vc.project.platforms = Win32 vc.project.configurations = debug_shared, release_shared, debug_static_mt, release_static_mt, debug_static_md, release_static_md vc.project.prototype = ${vc.project.name}_vs90.vcproj vc.project.compiler.include = ..\\..\\..\\Foundation\\include;..\\..\\..\\XML\\include;..\\..\\..\\Util\\include;..\\..\\..\\Net\\include +vc.project.compiler.additionalOptions = /Zc:__cplusplus vc.project.linker.dependencies.Win32 = ws2_32.lib iphlpapi.lib diff --git a/Net/samples/httpget/httpget.progen b/Net/samples/httpget/httpget.progen index dd7209c7a..c610dc055 100644 --- a/Net/samples/httpget/httpget.progen +++ b/Net/samples/httpget/httpget.progen @@ -7,4 +7,5 @@ vc.project.platforms = Win32 vc.project.configurations = debug_shared, release_shared, debug_static_mt, release_static_mt, debug_static_md, release_static_md vc.project.prototype = ${vc.project.name}_vs90.vcproj vc.project.compiler.include = ..\\..\\..\\Foundation\\include;..\\..\\..\\XML\\include;..\\..\\..\\Util\\include;..\\..\\..\\Net\\include +vc.project.compiler.additionalOptions = /Zc:__cplusplus vc.project.linker.dependencies.Win32 = ws2_32.lib iphlpapi.lib diff --git a/Net/samples/ifconfig/ifconfig.progen b/Net/samples/ifconfig/ifconfig.progen index dd7209c7a..c610dc055 100644 --- a/Net/samples/ifconfig/ifconfig.progen +++ b/Net/samples/ifconfig/ifconfig.progen @@ -7,4 +7,5 @@ vc.project.platforms = Win32 vc.project.configurations = debug_shared, release_shared, debug_static_mt, release_static_mt, debug_static_md, release_static_md vc.project.prototype = ${vc.project.name}_vs90.vcproj vc.project.compiler.include = ..\\..\\..\\Foundation\\include;..\\..\\..\\XML\\include;..\\..\\..\\Util\\include;..\\..\\..\\Net\\include +vc.project.compiler.additionalOptions = /Zc:__cplusplus vc.project.linker.dependencies.Win32 = ws2_32.lib iphlpapi.lib diff --git a/Net/samples/tcpserver/tcpserver.progen b/Net/samples/tcpserver/tcpserver.progen index 7da6ac8e2..9ffca51c2 100644 --- a/Net/samples/tcpserver/tcpserver.progen +++ b/Net/samples/tcpserver/tcpserver.progen @@ -7,4 +7,5 @@ vc.project.platforms = Win32 vc.project.configurations = debug_shared, release_shared, debug_static_mt, release_static_mt, debug_static_md, release_static_md vc.project.prototype = ${vc.project.name}_vs90.vcproj vc.project.compiler.include = ..\\..\\..\\Foundation\\include;..\\..\\..\\Net\\include +vc.project.compiler.additionalOptions = /Zc:__cplusplus vc.project.linker.dependencies.Win32 = ws2_32.lib iphlpapi.lib diff --git a/Net/src/PollSet.cpp b/Net/src/PollSet.cpp index 242e37503..0fcc1fd6b 100644 --- a/Net/src/PollSet.cpp +++ b/Net/src/PollSet.cpp @@ -19,8 +19,14 @@ #if defined(POCO_HAVE_FD_EPOLL) - #include - #include + #ifdef POCO_OS_FAMILY_WINDOWS + #include "Poco/Net/ServerSocket.h" + #include "Poco/Net/SocketAddress.h" + #include "wepoll.h" + #else + #include + #include + #endif #elif defined(POCO_HAVE_FD_POLL) #ifndef _WIN32 #include @@ -35,10 +41,25 @@ namespace Net { #if defined(POCO_HAVE_FD_EPOLL) +// +// Implementation using epoll (Linux) or wepoll (Windows) +// + + +#ifdef WEPOLL_H_ + +namespace { + +int close(HANDLE h) +{ + return epoll_close(h); +} + +} + +#endif // WEPOLL_H_ + -// -// Linux implementation using epoll -// class PollSetImpl { public: @@ -47,9 +68,9 @@ public: using SocketMode = std::pair; using SocketMap = std::map; - PollSetImpl(): _epollfd(epoll_create(1)), - _events(1024), - _eventfd(eventfd(0, 0)) + PollSetImpl(): _events(1024), + _eventfd(eventfd(_port)), + _epollfd(epoll_create(1)) { int err = addFD(_eventfd, PollSet::POLL_READ, EPOLL_CTL_ADD); if ((err) || (_epollfd < 0)) @@ -60,8 +81,12 @@ public: ~PollSetImpl() { - ::close(_eventfd.exchange(0)); - if (_epollfd >= 0) ::close(_epollfd); +#ifdef WEPOLL_H_ + if (_eventfd >= 0) eventfd(_port, _eventfd); +#else + if (_eventfd > 0) close(_eventfd.exchange(0)); +#endif + if (_epollfd >= 0) close(_epollfd); } void add(const Socket& socket, int mode) @@ -118,8 +143,13 @@ public: _epollfd = epoll_create(1); if (_epollfd < 0) SocketImpl::error(); } +#ifdef WEPOLL_H_ + eventfd(_port, _eventfd); + _eventfd = eventfd(_port); +#else close(_eventfd.exchange(0)); _eventfd = eventfd(0, 0); +#endif addFD(_eventfd, PollSet::POLL_READ, EPOLL_CTL_ADD); } @@ -132,7 +162,8 @@ public: do { Poco::Timestamp start; - rc = epoll_wait(_epollfd, &_events[0], _events.size(), remainingTime.totalMilliseconds()); + rc = epoll_wait(_epollfd, &_events[0], + static_cast(_events.size()), static_cast(remainingTime.totalMilliseconds())); if (rc == 0) return result; // if we are hitting the events limit, resize it; even without resizing, the subseqent @@ -174,11 +205,15 @@ public: void wakeUp() { +#ifdef WEPOLL_H_ + StreamSocket ss(SocketAddress("127.0.0.1", _port)); +#else uint64_t val = 1; // This is guaranteed to write into a valid fd, // or 0 (meaning PollSet is being destroyed). // Errors are ignored. write(_eventfd, &val, sizeof(val)); +#endif } int count() const @@ -207,7 +242,7 @@ private: int updateImpl(const Socket& socket, int mode) { SocketImpl* sockImpl = socket.impl(); - int ret = addFD(sockImpl->sockfd(), mode, EPOLL_CTL_MOD, sockImpl); + int ret = addFD(static_cast(sockImpl->sockfd()), mode, EPOLL_CTL_MOD, sockImpl); if (ret == 0) socketMapUpdate(socket, mode); return ret; } @@ -216,7 +251,7 @@ private: { SocketImpl* sockImpl = socket.impl(); int newMode = getNewMode(sockImpl, mode); - int ret = addFD(sockImpl->sockfd(), newMode, EPOLL_CTL_ADD, sockImpl); + int ret = addFD(static_cast(sockImpl->sockfd()), newMode, EPOLL_CTL_ADD, sockImpl); if (ret == 0) socketMapUpdate(socket, newMode); return ret; } @@ -235,11 +270,38 @@ private: return epoll_ctl(_epollfd, op, fd, &ev); } +#ifdef WEPOLL_H_ + + int eventfd(int& port, int rmFD = 0) + { + if (rmFD == 0) + { + _pSocket = new ServerSocket(SocketAddress("127.0.0.1", 0)); + port = _pSocket->address().port(); + return static_cast(_pSocket->impl()->sockfd()); + } + else + { + delete _pSocket; + _pSocket = 0; + port = 0; + } + return 0; + } + +#endif // WEPOLL_H_ + mutable Mutex _mutex; - std::atomic _epollfd; SocketMap _socketMap; std::vector _events; + int _port = 0; std::atomic _eventfd; +#ifdef WEPOLL_H_ + std::atomic _epollfd; + ServerSocket* _pSocket; +#else + std::atomic _epollfd; +#endif }; @@ -359,11 +421,7 @@ public: do { Poco::Timestamp start; -#ifdef _WIN32 - rc = WSAPoll(&_pollfds[0], static_cast(_pollfds.size()), static_cast(remainingTime.totalMilliseconds())); -#else rc = ::poll(&_pollfds[0], _pollfds.size(), remainingTime.totalMilliseconds()); -#endif if (rc < 0 && SocketImpl::lastError() == POCO_EINTR) { Poco::Timestamp end; @@ -393,11 +451,7 @@ public: std::map::const_iterator its = _socketMap.find(it->fd); if (its != _socketMap.end()) { - if ((it->revents & POLLIN) -#ifdef _WIN32 - || (it->revents & POLLHUP) -#endif - ) + if (it->revents & POLLIN) result[its->second] |= PollSet::POLL_READ; if (it->revents & POLLOUT) result[its->second] |= PollSet::POLL_WRITE; @@ -440,302 +494,7 @@ private: std::map _addMap; std::set _removeSet; std::vector _pollfds; - Poco::Pipe _pipe; - /// Add _pipe to head of _pollfds used to wake up poll blocking -}; - - -#else - - -#ifdef POCO_OS_FAMILY_WINDOWS - - -// -// Windows-specific implementation using select() -// The size of select set is determined at compile -// time (see FD_SETSIZE in SocketDefs.h). -// -// This implementation works around that limit by -// having multiple socket descriptor sets and, -// when needed, calling select() multiple times. -// To avoid multiple sets situtation, the FD_SETSIZE -// can be increased, however then Poco::Net library -// must be recompiled in order for the new setting -// to be in effect. -// - - -class PollSetImpl -{ -public: - PollSetImpl() : _fdRead(1, {0, {0}}), - _fdWrite(1, {0, {0}}), - _fdExcept(1, {0, {0}}), - _pFDRead(std::make_unique()), - _pFDWrite(std::make_unique()), - _pFDExcept(std::make_unique()), - _nfd(0) - { - } - - void add(const Socket& socket, int mode) - { - Poco::Net::SocketImpl* pImpl = socket.impl(); - poco_check_ptr(pImpl); - Poco::FastMutex::ScopedLock lock(_mutex); - _map[socket] = mode; - setMode(pImpl->sockfd(), mode); - } - - void remove(const Socket& socket) - { - Poco::Net::SocketImpl* pImpl = socket.impl(); - poco_check_ptr(pImpl); - Poco::FastMutex::ScopedLock lock(_mutex); - remove(pImpl->sockfd()); - _map.erase(socket); - } - - bool has(const Socket& socket) const - { - Poco::FastMutex::ScopedLock lock(_mutex); - return _map.find(socket) != _map.end(); - } - - bool empty() const - { - Poco::FastMutex::ScopedLock lock(_mutex); - return _map.empty(); - } - - void update(const Socket& socket, int mode) - { - Poco::Net::SocketImpl* pImpl = socket.impl(); - poco_check_ptr(pImpl); - SOCKET fd = pImpl->sockfd(); - Poco::FastMutex::ScopedLock lock(_mutex); - _map[socket] = mode; - setMode(fd, mode); - if (!(mode & PollSet::POLL_READ)) remove(fd, _fdRead); - if (!(mode & PollSet::POLL_WRITE)) remove(fd, _fdWrite); - if (!(mode & PollSet::POLL_ERROR)) remove(fd, _fdExcept); - } - - void clear() - { - Poco::FastMutex::ScopedLock lock(_mutex); - _map.clear(); - for (auto& fd : _fdRead) std::memset(&fd, 0, sizeof(fd)); - for (auto& fd : _fdWrite) std::memset(&fd, 0, sizeof(fd)); - for (auto& fd : _fdExcept) std::memset(&fd, 0, sizeof(fd)); - _nfd = 0; - } - - PollSet::SocketModeMap poll(const Poco::Timespan& timeout) - { - Poco::Timestamp start; - poco_assert_dbg(_fdRead.size() == _fdWrite.size()); - poco_assert_dbg(_fdWrite.size() == _fdExcept.size()); - - PollSet::SocketModeMap result; - if (_nfd == 0) return result; - - Poco::Timespan remainingTime(timeout); - struct timeval tv {0, 1000}; - - Poco::FastMutex::ScopedLock lock(_mutex); - - auto readIt = _fdRead.begin(); - auto writeIt = _fdWrite.begin(); - auto exceptIt = _fdExcept.begin(); - do - { - std::memcpy(_pFDRead.get(), &*readIt, sizeof(fd_set)); - std::memcpy(_pFDWrite.get(), &*writeIt, sizeof(fd_set)); - std::memcpy(_pFDExcept.get(), &*exceptIt, sizeof(fd_set)); - - int rc; - do - { - rc = ::select((int)_nfd + 1, _pFDRead.get(), _pFDWrite.get(), _pFDExcept.get(), &tv); - } while (rc < 0 && SocketImpl::lastError() == POCO_EINTR); - if (rc < 0) SocketImpl::error(); - else if (rc > 0) - { - for (auto it = _map.begin(); it != _map.end(); ++it) - { - poco_socket_t fd = it->first.impl()->sockfd(); - if (fd != POCO_INVALID_SOCKET) - { - if (FD_ISSET(fd, _pFDRead.get())) - { - result[it->first] |= PollSet::POLL_READ; - } - if (FD_ISSET(fd, _pFDWrite.get())) - { - result[it->first] |= PollSet::POLL_WRITE; - } - if (FD_ISSET(fd, _pFDExcept.get())) - { - result[it->first] |= PollSet::POLL_ERROR; - } - } - } - } - - Timespan elapsed = Timestamp() - start; - if (++readIt == _fdRead.end()) - { - if ((rc > 0) || (elapsed.totalMilliseconds() > timeout.totalMilliseconds())) - break; - readIt = _fdRead.begin(); - writeIt = _fdWrite.begin(); - exceptIt = _fdExcept.begin(); - } - else - { - ++writeIt; - ++exceptIt; - } - - Poco::UInt64 tOut = (((Poco::UInt64)tv.tv_sec * 1000000) + tv.tv_usec) * 2; - Poco::Timespan left = timeout - elapsed; - if (tOut > left.totalMicroseconds()) - tOut = left.totalMicroseconds(); - - tv.tv_sec = static_cast(tOut / 1000000); - tv.tv_usec = tOut % 1000000; - } while (true); - - return result; - } - - int count() const - { - Poco::FastMutex::ScopedLock lock(_mutex); - return static_cast(_map.size()); - } - - void wakeUp() - { - // TODO - } - -private: - - void setMode(std::vector& fdSet, SOCKET fd) - { - SOCKET* pFD = 0; - for (auto& fdr : fdSet) - { - SOCKET* begin = fdr.fd_array; - SOCKET* end = fdr.fd_array + fdr.fd_count; - pFD = std::find(begin, end, fd); - if (end != pFD) - { - FD_SET(fd, &fdr); - if (fd > _nfd) _nfd = fd; - return; - } - } - // not found, insert at first free location - for (auto& fdr : fdSet) - { - if (fdr.fd_count < FD_SETSIZE) - { - fdr.fd_count++; - fdr.fd_array[fdr.fd_count-1] = fd; - if (fd > _nfd) _nfd = fd; - return; - } - } - // all fd sets are full; insert another one - fdSet.push_back({0, {0}}); - fd_set& fds = fdSet.back(); - fds.fd_count = 1; - fds.fd_array[0] = fd; - if (fd > _nfd) _nfd = fd; - } - - void setMode(SOCKET fd, int mode) - { - if (mode & PollSet::POLL_READ) setMode(_fdRead, fd); - if (mode & PollSet::POLL_WRITE) setMode(_fdWrite, fd); - if (mode & PollSet::POLL_ERROR) setMode(_fdExcept, fd); - } - - void remove(SOCKET fd, std::vector& fdSets) - { - bool newNFD = false; - for (auto& fdSet : fdSets) - { - if (fdSet.fd_count) - { - newNFD = (fd == _nfd); - int i = 0; - for (; i < fdSet.fd_count; ++i) - { - if (fdSet.fd_array[i] == fd) - { - if (i == (fdSet.fd_count-1)) - { - fdSet.fd_array[i] = 0; - } - else - { - for (; i < fdSet.fd_count-1; ++i) - { - fdSet.fd_array[i] = fdSet.fd_array[i+1]; - if (newNFD && fdSet.fd_array[i] > _nfd) - _nfd = fdSet.fd_array[i]; - } - } - fdSet.fd_array[fdSet.fd_count-1] = 0; - fdSet.fd_count--; - break; - } - if (newNFD && fdSet.fd_array[i] > _nfd) - _nfd = fdSet.fd_array[i]; - } - } - } - if (newNFD) - { - findNFD(_fdRead); - findNFD(_fdWrite); - findNFD(_fdExcept); - } - } - - void findNFD(std::vector& fdSets) - { - for (auto& fdSet : fdSets) - { - for (int i = 0; i < fdSet.fd_count; ++i) - { - if (fdSet.fd_array[i] > _nfd) - _nfd = fdSet.fd_array[i]; - } - } - } - - void remove(SOCKET fd) - { - remove(fd, _fdRead); - remove(fd, _fdWrite); - remove(fd, _fdExcept); - } - - mutable Poco::FastMutex _mutex; - PollSet::SocketModeMap _map; - SOCKET _nfd; - std::vector _fdRead; - std::vector _fdWrite; - std::vector _fdExcept; - std::unique_ptr _pFDRead; - std::unique_ptr _pFDWrite; - std::unique_ptr _pFDExcept; + Poco::Pipe _pipe; }; @@ -890,9 +649,6 @@ private: }; -#endif // POCO_OS_FAMILY_WINDOWS - - #endif diff --git a/Net/src/Socket.cpp b/Net/src/Socket.cpp index dcff65d3b..b848cb6a0 100644 --- a/Net/src/Socket.cpp +++ b/Net/src/Socket.cpp @@ -19,9 +19,9 @@ #include "Poco/Error.h" #include #include // FD_SET needs memset on some platforms, so we can't use -#if defined(POCO_HAVE_FD_EPOLL) - #include -#elif defined(POCO_HAVE_FD_POLL) + + +#if defined(POCO_HAVE_FD_POLL) #include "Poco/SharedPtr.h" #ifndef _WIN32 #include diff --git a/Net/src/SocketImpl.cpp b/Net/src/SocketImpl.cpp index 3bbe95cfb..173673886 100644 --- a/Net/src/SocketImpl.cpp +++ b/Net/src/SocketImpl.cpp @@ -21,7 +21,12 @@ #if defined(POCO_HAVE_FD_EPOLL) - #include + #ifdef POCO_OS_FAMILY_WINDOWS + #include "wepoll.h" + #else + #include + #include + #endif #elif defined(POCO_HAVE_FD_POLL) #ifndef _WIN32 #include @@ -52,6 +57,20 @@ using Poco::NumberFormatter; using Poco::Timespan; +#ifdef WEPOLL_H_ + +namespace { + + int close(HANDLE h) + { + return epoll_close(h); + } + +} + +#endif // WEPOLL_H_ + + namespace Poco { namespace Net { @@ -622,8 +641,11 @@ bool SocketImpl::poll(const Poco::Timespan& timeout, int mode) if (sockfd == POCO_INVALID_SOCKET) throw InvalidSocketException(); #if defined(POCO_HAVE_FD_EPOLL) - +#ifdef WEPOLL_H_ + HANDLE epollfd = epoll_create(1); +#else int epollfd = epoll_create(1); +#endif if (epollfd < 0) { error("Can't create epoll queue"); diff --git a/Net/src/wepoll.c b/Net/src/wepoll.c new file mode 100644 index 000000000..186d3f2d4 --- /dev/null +++ b/Net/src/wepoll.c @@ -0,0 +1,2253 @@ +/* + * wepoll - epoll for Windows + * https://github.com/piscisaureus/wepoll + * + * Copyright 2012-2020, Bert Belder + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WEPOLL_EXPORT +#define WEPOLL_EXPORT +#endif + +#include + +enum EPOLL_EVENTS { + EPOLLIN = (int) (1U << 0), + EPOLLPRI = (int) (1U << 1), + EPOLLOUT = (int) (1U << 2), + EPOLLERR = (int) (1U << 3), + EPOLLHUP = (int) (1U << 4), + EPOLLRDNORM = (int) (1U << 6), + EPOLLRDBAND = (int) (1U << 7), + EPOLLWRNORM = (int) (1U << 8), + EPOLLWRBAND = (int) (1U << 9), + EPOLLMSG = (int) (1U << 10), /* Never reported. */ + EPOLLRDHUP = (int) (1U << 13), + EPOLLONESHOT = (int) (1U << 31) +}; + +#define EPOLLIN (1U << 0) +#define EPOLLPRI (1U << 1) +#define EPOLLOUT (1U << 2) +#define EPOLLERR (1U << 3) +#define EPOLLHUP (1U << 4) +#define EPOLLRDNORM (1U << 6) +#define EPOLLRDBAND (1U << 7) +#define EPOLLWRNORM (1U << 8) +#define EPOLLWRBAND (1U << 9) +#define EPOLLMSG (1U << 10) +#define EPOLLRDHUP (1U << 13) +#define EPOLLONESHOT (1U << 31) + +#define EPOLL_CTL_ADD 1 +#define EPOLL_CTL_MOD 2 +#define EPOLL_CTL_DEL 3 + +typedef void* HANDLE; +typedef uintptr_t SOCKET; + +typedef union epoll_data { + void* ptr; + int fd; + uint32_t u32; + uint64_t u64; + SOCKET sock; /* Windows specific */ + HANDLE hnd; /* Windows specific */ +} epoll_data_t; + +struct epoll_event { + uint32_t events; /* Epoll events and flags */ + epoll_data_t data; /* User data variable */ +}; + +#ifdef __cplusplus +extern "C" { +#endif + +WEPOLL_EXPORT HANDLE epoll_create(int size); +WEPOLL_EXPORT HANDLE epoll_create1(int flags); + +WEPOLL_EXPORT int epoll_close(HANDLE ephnd); + +WEPOLL_EXPORT int epoll_ctl(HANDLE ephnd, + int op, + SOCKET sock, + struct epoll_event* event); + +WEPOLL_EXPORT int epoll_wait(HANDLE ephnd, + struct epoll_event* events, + int maxevents, + int timeout); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#include + +#include + +#define WEPOLL_INTERNAL static +#define WEPOLL_INTERNAL_EXTERN static + +#if defined(__clang__) +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wnonportable-system-include-path" +#pragma clang diagnostic ignored "-Wreserved-id-macro" +#elif defined(_MSC_VER) +#pragma warning(push, 1) +#endif + +#undef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN + +#undef _WIN32_WINNT +#define _WIN32_WINNT 0x0600 + +#include +#include +#include + +#if defined(__clang__) +#pragma clang diagnostic pop +#elif defined(_MSC_VER) +#pragma warning(pop) +#endif + +WEPOLL_INTERNAL int nt_global_init(void); + +typedef LONG NTSTATUS; +typedef NTSTATUS* PNTSTATUS; + +#ifndef NT_SUCCESS +#define NT_SUCCESS(status) (((NTSTATUS)(status)) >= 0) +#endif + +#ifndef STATUS_SUCCESS +#define STATUS_SUCCESS ((NTSTATUS) 0x00000000L) +#endif + +#ifndef STATUS_PENDING +#define STATUS_PENDING ((NTSTATUS) 0x00000103L) +#endif + +#ifndef STATUS_CANCELLED +#define STATUS_CANCELLED ((NTSTATUS) 0xC0000120L) +#endif + +#ifndef STATUS_NOT_FOUND +#define STATUS_NOT_FOUND ((NTSTATUS) 0xC0000225L) +#endif + +typedef struct _IO_STATUS_BLOCK { + NTSTATUS Status; + ULONG_PTR Information; +} IO_STATUS_BLOCK, *PIO_STATUS_BLOCK; + +typedef VOID(NTAPI* PIO_APC_ROUTINE)(PVOID ApcContext, + PIO_STATUS_BLOCK IoStatusBlock, + ULONG Reserved); + +typedef struct _UNICODE_STRING { + USHORT Length; + USHORT MaximumLength; + PWSTR Buffer; +} UNICODE_STRING, *PUNICODE_STRING; + +#define RTL_CONSTANT_STRING(s) \ + { sizeof(s) - sizeof((s)[0]), sizeof(s), s } + +typedef struct _OBJECT_ATTRIBUTES { + ULONG Length; + HANDLE RootDirectory; + PUNICODE_STRING ObjectName; + ULONG Attributes; + PVOID SecurityDescriptor; + PVOID SecurityQualityOfService; +} OBJECT_ATTRIBUTES, *POBJECT_ATTRIBUTES; + +#define RTL_CONSTANT_OBJECT_ATTRIBUTES(ObjectName, Attributes) \ + { sizeof(OBJECT_ATTRIBUTES), NULL, ObjectName, Attributes, NULL, NULL } + +#ifndef FILE_OPEN +#define FILE_OPEN 0x00000001UL +#endif + +#define KEYEDEVENT_WAIT 0x00000001UL +#define KEYEDEVENT_WAKE 0x00000002UL +#define KEYEDEVENT_ALL_ACCESS \ + (STANDARD_RIGHTS_REQUIRED | KEYEDEVENT_WAIT | KEYEDEVENT_WAKE) + +#define NT_NTDLL_IMPORT_LIST(X) \ + X(NTSTATUS, \ + NTAPI, \ + NtCancelIoFileEx, \ + (HANDLE FileHandle, \ + PIO_STATUS_BLOCK IoRequestToCancel, \ + PIO_STATUS_BLOCK IoStatusBlock)) \ + \ + X(NTSTATUS, \ + NTAPI, \ + NtCreateFile, \ + (PHANDLE FileHandle, \ + ACCESS_MASK DesiredAccess, \ + POBJECT_ATTRIBUTES ObjectAttributes, \ + PIO_STATUS_BLOCK IoStatusBlock, \ + PLARGE_INTEGER AllocationSize, \ + ULONG FileAttributes, \ + ULONG ShareAccess, \ + ULONG CreateDisposition, \ + ULONG CreateOptions, \ + PVOID EaBuffer, \ + ULONG EaLength)) \ + \ + X(NTSTATUS, \ + NTAPI, \ + NtCreateKeyedEvent, \ + (PHANDLE KeyedEventHandle, \ + ACCESS_MASK DesiredAccess, \ + POBJECT_ATTRIBUTES ObjectAttributes, \ + ULONG Flags)) \ + \ + X(NTSTATUS, \ + NTAPI, \ + NtDeviceIoControlFile, \ + (HANDLE FileHandle, \ + HANDLE Event, \ + PIO_APC_ROUTINE ApcRoutine, \ + PVOID ApcContext, \ + PIO_STATUS_BLOCK IoStatusBlock, \ + ULONG IoControlCode, \ + PVOID InputBuffer, \ + ULONG InputBufferLength, \ + PVOID OutputBuffer, \ + ULONG OutputBufferLength)) \ + \ + X(NTSTATUS, \ + NTAPI, \ + NtReleaseKeyedEvent, \ + (HANDLE KeyedEventHandle, \ + PVOID KeyValue, \ + BOOLEAN Alertable, \ + PLARGE_INTEGER Timeout)) \ + \ + X(NTSTATUS, \ + NTAPI, \ + NtWaitForKeyedEvent, \ + (HANDLE KeyedEventHandle, \ + PVOID KeyValue, \ + BOOLEAN Alertable, \ + PLARGE_INTEGER Timeout)) \ + \ + X(ULONG, WINAPI, RtlNtStatusToDosError, (NTSTATUS Status)) + +#define X(return_type, attributes, name, parameters) \ + WEPOLL_INTERNAL_EXTERN return_type(attributes* name) parameters; +NT_NTDLL_IMPORT_LIST(X) +#undef X + +#define AFD_POLL_RECEIVE 0x0001 +#define AFD_POLL_RECEIVE_EXPEDITED 0x0002 +#define AFD_POLL_SEND 0x0004 +#define AFD_POLL_DISCONNECT 0x0008 +#define AFD_POLL_ABORT 0x0010 +#define AFD_POLL_LOCAL_CLOSE 0x0020 +#define AFD_POLL_ACCEPT 0x0080 +#define AFD_POLL_CONNECT_FAIL 0x0100 + +typedef struct _AFD_POLL_HANDLE_INFO { + HANDLE Handle; + ULONG Events; + NTSTATUS Status; +} AFD_POLL_HANDLE_INFO, *PAFD_POLL_HANDLE_INFO; + +typedef struct _AFD_POLL_INFO { + LARGE_INTEGER Timeout; + ULONG NumberOfHandles; + ULONG Exclusive; + AFD_POLL_HANDLE_INFO Handles[1]; +} AFD_POLL_INFO, *PAFD_POLL_INFO; + +WEPOLL_INTERNAL int afd_create_device_handle(HANDLE iocp_handle, + HANDLE* afd_device_handle_out); + +WEPOLL_INTERNAL int afd_poll(HANDLE afd_device_handle, + AFD_POLL_INFO* poll_info, + IO_STATUS_BLOCK* io_status_block); +WEPOLL_INTERNAL int afd_cancel_poll(HANDLE afd_device_handle, + IO_STATUS_BLOCK* io_status_block); + +#define return_map_error(value) \ + do { \ + err_map_win_error(); \ + return (value); \ + } while (0) + +#define return_set_error(value, error) \ + do { \ + err_set_win_error(error); \ + return (value); \ + } while (0) + +WEPOLL_INTERNAL void err_map_win_error(void); +WEPOLL_INTERNAL void err_set_win_error(DWORD error); +WEPOLL_INTERNAL int err_check_handle(HANDLE handle); + +#define IOCTL_AFD_POLL 0x00012024 + +static UNICODE_STRING afd__device_name = + RTL_CONSTANT_STRING(L"\\Device\\Afd\\Wepoll"); + +static OBJECT_ATTRIBUTES afd__device_attributes = + RTL_CONSTANT_OBJECT_ATTRIBUTES(&afd__device_name, 0); + +int afd_create_device_handle(HANDLE iocp_handle, + HANDLE* afd_device_handle_out) { + HANDLE afd_device_handle; + IO_STATUS_BLOCK iosb; + NTSTATUS status; + + /* By opening \Device\Afd without specifying any extended attributes, we'll + * get a handle that lets us talk to the AFD driver, but that doesn't have an + * associated endpoint (so it's not a socket). */ + status = NtCreateFile(&afd_device_handle, + SYNCHRONIZE, + &afd__device_attributes, + &iosb, + NULL, + 0, + FILE_SHARE_READ | FILE_SHARE_WRITE, + FILE_OPEN, + 0, + NULL, + 0); + if (status != STATUS_SUCCESS) + return_set_error(-1, RtlNtStatusToDosError(status)); + + if (CreateIoCompletionPort(afd_device_handle, iocp_handle, 0, 0) == NULL) + goto error; + + if (!SetFileCompletionNotificationModes(afd_device_handle, + FILE_SKIP_SET_EVENT_ON_HANDLE)) + goto error; + + *afd_device_handle_out = afd_device_handle; + return 0; + +error: + CloseHandle(afd_device_handle); + return_map_error(-1); +} + +int afd_poll(HANDLE afd_device_handle, + AFD_POLL_INFO* poll_info, + IO_STATUS_BLOCK* io_status_block) { + NTSTATUS status; + + /* Blocking operation is not supported. */ + assert(io_status_block != NULL); + + io_status_block->Status = STATUS_PENDING; + status = NtDeviceIoControlFile(afd_device_handle, + NULL, + NULL, + io_status_block, + io_status_block, + IOCTL_AFD_POLL, + poll_info, + sizeof *poll_info, + poll_info, + sizeof *poll_info); + + if (status == STATUS_SUCCESS) + return 0; + else if (status == STATUS_PENDING) + return_set_error(-1, ERROR_IO_PENDING); + else + return_set_error(-1, RtlNtStatusToDosError(status)); +} + +int afd_cancel_poll(HANDLE afd_device_handle, + IO_STATUS_BLOCK* io_status_block) { + NTSTATUS cancel_status; + IO_STATUS_BLOCK cancel_iosb; + + /* If the poll operation has already completed or has been cancelled earlier, + * there's nothing left for us to do. */ + if (io_status_block->Status != STATUS_PENDING) + return 0; + + cancel_status = + NtCancelIoFileEx(afd_device_handle, io_status_block, &cancel_iosb); + + /* NtCancelIoFileEx() may return STATUS_NOT_FOUND if the operation completed + * just before calling NtCancelIoFileEx(). This is not an error. */ + if (cancel_status == STATUS_SUCCESS || cancel_status == STATUS_NOT_FOUND) + return 0; + else + return_set_error(-1, RtlNtStatusToDosError(cancel_status)); +} + +WEPOLL_INTERNAL int epoll_global_init(void); + +WEPOLL_INTERNAL int init(void); + +typedef struct port_state port_state_t; +typedef struct queue queue_t; +typedef struct sock_state sock_state_t; +typedef struct ts_tree_node ts_tree_node_t; + +WEPOLL_INTERNAL port_state_t* port_new(HANDLE* iocp_handle_out); +WEPOLL_INTERNAL int port_close(port_state_t* port_state); +WEPOLL_INTERNAL int port_delete(port_state_t* port_state); + +WEPOLL_INTERNAL int port_wait(port_state_t* port_state, + struct epoll_event* events, + int maxevents, + int timeout); + +WEPOLL_INTERNAL int port_ctl(port_state_t* port_state, + int op, + SOCKET sock, + struct epoll_event* ev); + +WEPOLL_INTERNAL int port_register_socket(port_state_t* port_state, + sock_state_t* sock_state, + SOCKET socket); +WEPOLL_INTERNAL void port_unregister_socket(port_state_t* port_state, + sock_state_t* sock_state); +WEPOLL_INTERNAL sock_state_t* port_find_socket(port_state_t* port_state, + SOCKET socket); + +WEPOLL_INTERNAL void port_request_socket_update(port_state_t* port_state, + sock_state_t* sock_state); +WEPOLL_INTERNAL void port_cancel_socket_update(port_state_t* port_state, + sock_state_t* sock_state); + +WEPOLL_INTERNAL void port_add_deleted_socket(port_state_t* port_state, + sock_state_t* sock_state); +WEPOLL_INTERNAL void port_remove_deleted_socket(port_state_t* port_state, + sock_state_t* sock_state); + +WEPOLL_INTERNAL HANDLE port_get_iocp_handle(port_state_t* port_state); +WEPOLL_INTERNAL queue_t* port_get_poll_group_queue(port_state_t* port_state); + +WEPOLL_INTERNAL port_state_t* port_state_from_handle_tree_node( + ts_tree_node_t* tree_node); +WEPOLL_INTERNAL ts_tree_node_t* port_state_to_handle_tree_node( + port_state_t* port_state); + +/* The reflock is a special kind of lock that normally prevents a chunk of + * memory from being freed, but does allow the chunk of memory to eventually be + * released in a coordinated fashion. + * + * Under normal operation, threads increase and decrease the reference count, + * which are wait-free operations. + * + * Exactly once during the reflock's lifecycle, a thread holding a reference to + * the lock may "destroy" the lock; this operation blocks until all other + * threads holding a reference to the lock have dereferenced it. After + * "destroy" returns, the calling thread may assume that no other threads have + * a reference to the lock. + * + * Attemmpting to lock or destroy a lock after reflock_unref_and_destroy() has + * been called is invalid and results in undefined behavior. Therefore the user + * should use another lock to guarantee that this can't happen. + */ + +typedef struct reflock { + volatile long state; /* 32-bit Interlocked APIs operate on `long` values. */ +} reflock_t; + +WEPOLL_INTERNAL int reflock_global_init(void); + +WEPOLL_INTERNAL void reflock_init(reflock_t* reflock); +WEPOLL_INTERNAL void reflock_ref(reflock_t* reflock); +WEPOLL_INTERNAL void reflock_unref(reflock_t* reflock); +WEPOLL_INTERNAL void reflock_unref_and_destroy(reflock_t* reflock); + +#include + +/* N.b.: the tree functions do not set errno or LastError when they fail. Each + * of the API functions has at most one failure mode. It is up to the caller to + * set an appropriate error code when necessary. */ + +typedef struct tree tree_t; +typedef struct tree_node tree_node_t; + +typedef struct tree { + tree_node_t* root; +} tree_t; + +typedef struct tree_node { + tree_node_t* left; + tree_node_t* right; + tree_node_t* parent; + uintptr_t key; + bool red; +} tree_node_t; + +WEPOLL_INTERNAL void tree_init(tree_t* tree); +WEPOLL_INTERNAL void tree_node_init(tree_node_t* node); + +WEPOLL_INTERNAL int tree_add(tree_t* tree, tree_node_t* node, uintptr_t key); +WEPOLL_INTERNAL void tree_del(tree_t* tree, tree_node_t* node); + +WEPOLL_INTERNAL tree_node_t* tree_find(const tree_t* tree, uintptr_t key); +WEPOLL_INTERNAL tree_node_t* tree_root(const tree_t* tree); + +typedef struct ts_tree { + tree_t tree; + SRWLOCK lock; +} ts_tree_t; + +typedef struct ts_tree_node { + tree_node_t tree_node; + reflock_t reflock; +} ts_tree_node_t; + +WEPOLL_INTERNAL void ts_tree_init(ts_tree_t* rtl); +WEPOLL_INTERNAL void ts_tree_node_init(ts_tree_node_t* node); + +WEPOLL_INTERNAL int ts_tree_add(ts_tree_t* ts_tree, + ts_tree_node_t* node, + uintptr_t key); + +WEPOLL_INTERNAL ts_tree_node_t* ts_tree_del_and_ref(ts_tree_t* ts_tree, + uintptr_t key); +WEPOLL_INTERNAL ts_tree_node_t* ts_tree_find_and_ref(ts_tree_t* ts_tree, + uintptr_t key); + +WEPOLL_INTERNAL void ts_tree_node_unref(ts_tree_node_t* node); +WEPOLL_INTERNAL void ts_tree_node_unref_and_destroy(ts_tree_node_t* node); + +static ts_tree_t epoll__handle_tree; + +int epoll_global_init(void) { + ts_tree_init(&epoll__handle_tree); + return 0; +} + +static HANDLE epoll__create(void) { + port_state_t* port_state; + HANDLE ephnd; + ts_tree_node_t* tree_node; + + if (init() < 0) + return NULL; + + port_state = port_new(&ephnd); + if (port_state == NULL) + return NULL; + + tree_node = port_state_to_handle_tree_node(port_state); + if (ts_tree_add(&epoll__handle_tree, tree_node, (uintptr_t) ephnd) < 0) { + /* This should never happen. */ + port_delete(port_state); + return_set_error(NULL, ERROR_ALREADY_EXISTS); + } + + return ephnd; +} + +HANDLE epoll_create(int size) { + if (size <= 0) + return_set_error(NULL, ERROR_INVALID_PARAMETER); + + return epoll__create(); +} + +HANDLE epoll_create1(int flags) { + if (flags != 0) + return_set_error(NULL, ERROR_INVALID_PARAMETER); + + return epoll__create(); +} + +int epoll_close(HANDLE ephnd) { + ts_tree_node_t* tree_node; + port_state_t* port_state; + + if (init() < 0) + return -1; + + tree_node = ts_tree_del_and_ref(&epoll__handle_tree, (uintptr_t) ephnd); + if (tree_node == NULL) { + err_set_win_error(ERROR_INVALID_PARAMETER); + goto err; + } + + port_state = port_state_from_handle_tree_node(tree_node); + port_close(port_state); + + ts_tree_node_unref_and_destroy(tree_node); + + return port_delete(port_state); + +err: + err_check_handle(ephnd); + return -1; +} + +int epoll_ctl(HANDLE ephnd, int op, SOCKET sock, struct epoll_event* ev) { + ts_tree_node_t* tree_node; + port_state_t* port_state; + int r; + + if (init() < 0) + return -1; + + tree_node = ts_tree_find_and_ref(&epoll__handle_tree, (uintptr_t) ephnd); + if (tree_node == NULL) { + err_set_win_error(ERROR_INVALID_PARAMETER); + goto err; + } + + port_state = port_state_from_handle_tree_node(tree_node); + r = port_ctl(port_state, op, sock, ev); + + ts_tree_node_unref(tree_node); + + if (r < 0) + goto err; + + return 0; + +err: + /* On Linux, in the case of epoll_ctl(), EBADF takes priority over other + * errors. Wepoll mimics this behavior. */ + err_check_handle(ephnd); + err_check_handle((HANDLE) sock); + return -1; +} + +int epoll_wait(HANDLE ephnd, + struct epoll_event* events, + int maxevents, + int timeout) { + ts_tree_node_t* tree_node; + port_state_t* port_state; + int num_events; + + if (maxevents <= 0) + return_set_error(-1, ERROR_INVALID_PARAMETER); + + if (init() < 0) + return -1; + + tree_node = ts_tree_find_and_ref(&epoll__handle_tree, (uintptr_t) ephnd); + if (tree_node == NULL) { + err_set_win_error(ERROR_INVALID_PARAMETER); + goto err; + } + + port_state = port_state_from_handle_tree_node(tree_node); + num_events = port_wait(port_state, events, maxevents, timeout); + + ts_tree_node_unref(tree_node); + + if (num_events < 0) + goto err; + + return num_events; + +err: + err_check_handle(ephnd); + return -1; +} + +#include + +#define ERR__ERRNO_MAPPINGS(X) \ + X(ERROR_ACCESS_DENIED, EACCES) \ + X(ERROR_ALREADY_EXISTS, EEXIST) \ + X(ERROR_BAD_COMMAND, EACCES) \ + X(ERROR_BAD_EXE_FORMAT, ENOEXEC) \ + X(ERROR_BAD_LENGTH, EACCES) \ + X(ERROR_BAD_NETPATH, ENOENT) \ + X(ERROR_BAD_NET_NAME, ENOENT) \ + X(ERROR_BAD_NET_RESP, ENETDOWN) \ + X(ERROR_BAD_PATHNAME, ENOENT) \ + X(ERROR_BROKEN_PIPE, EPIPE) \ + X(ERROR_CANNOT_MAKE, EACCES) \ + X(ERROR_COMMITMENT_LIMIT, ENOMEM) \ + X(ERROR_CONNECTION_ABORTED, ECONNABORTED) \ + X(ERROR_CONNECTION_ACTIVE, EISCONN) \ + X(ERROR_CONNECTION_REFUSED, ECONNREFUSED) \ + X(ERROR_CRC, EACCES) \ + X(ERROR_DIR_NOT_EMPTY, ENOTEMPTY) \ + X(ERROR_DISK_FULL, ENOSPC) \ + X(ERROR_DUP_NAME, EADDRINUSE) \ + X(ERROR_FILENAME_EXCED_RANGE, ENOENT) \ + X(ERROR_FILE_NOT_FOUND, ENOENT) \ + X(ERROR_GEN_FAILURE, EACCES) \ + X(ERROR_GRACEFUL_DISCONNECT, EPIPE) \ + X(ERROR_HOST_DOWN, EHOSTUNREACH) \ + X(ERROR_HOST_UNREACHABLE, EHOSTUNREACH) \ + X(ERROR_INSUFFICIENT_BUFFER, EFAULT) \ + X(ERROR_INVALID_ADDRESS, EADDRNOTAVAIL) \ + X(ERROR_INVALID_FUNCTION, EINVAL) \ + X(ERROR_INVALID_HANDLE, EBADF) \ + X(ERROR_INVALID_NETNAME, EADDRNOTAVAIL) \ + X(ERROR_INVALID_PARAMETER, EINVAL) \ + X(ERROR_INVALID_USER_BUFFER, EMSGSIZE) \ + X(ERROR_IO_PENDING, EINPROGRESS) \ + X(ERROR_LOCK_VIOLATION, EACCES) \ + X(ERROR_MORE_DATA, EMSGSIZE) \ + X(ERROR_NETNAME_DELETED, ECONNABORTED) \ + X(ERROR_NETWORK_ACCESS_DENIED, EACCES) \ + X(ERROR_NETWORK_BUSY, ENETDOWN) \ + X(ERROR_NETWORK_UNREACHABLE, ENETUNREACH) \ + X(ERROR_NOACCESS, EFAULT) \ + X(ERROR_NONPAGED_SYSTEM_RESOURCES, ENOMEM) \ + X(ERROR_NOT_ENOUGH_MEMORY, ENOMEM) \ + X(ERROR_NOT_ENOUGH_QUOTA, ENOMEM) \ + X(ERROR_NOT_FOUND, ENOENT) \ + X(ERROR_NOT_LOCKED, EACCES) \ + X(ERROR_NOT_READY, EACCES) \ + X(ERROR_NOT_SAME_DEVICE, EXDEV) \ + X(ERROR_NOT_SUPPORTED, ENOTSUP) \ + X(ERROR_NO_MORE_FILES, ENOENT) \ + X(ERROR_NO_SYSTEM_RESOURCES, ENOMEM) \ + X(ERROR_OPERATION_ABORTED, EINTR) \ + X(ERROR_OUT_OF_PAPER, EACCES) \ + X(ERROR_PAGED_SYSTEM_RESOURCES, ENOMEM) \ + X(ERROR_PAGEFILE_QUOTA, ENOMEM) \ + X(ERROR_PATH_NOT_FOUND, ENOENT) \ + X(ERROR_PIPE_NOT_CONNECTED, EPIPE) \ + X(ERROR_PORT_UNREACHABLE, ECONNRESET) \ + X(ERROR_PROTOCOL_UNREACHABLE, ENETUNREACH) \ + X(ERROR_REM_NOT_LIST, ECONNREFUSED) \ + X(ERROR_REQUEST_ABORTED, EINTR) \ + X(ERROR_REQ_NOT_ACCEP, EWOULDBLOCK) \ + X(ERROR_SECTOR_NOT_FOUND, EACCES) \ + X(ERROR_SEM_TIMEOUT, ETIMEDOUT) \ + X(ERROR_SHARING_VIOLATION, EACCES) \ + X(ERROR_TOO_MANY_NAMES, ENOMEM) \ + X(ERROR_TOO_MANY_OPEN_FILES, EMFILE) \ + X(ERROR_UNEXP_NET_ERR, ECONNABORTED) \ + X(ERROR_WAIT_NO_CHILDREN, ECHILD) \ + X(ERROR_WORKING_SET_QUOTA, ENOMEM) \ + X(ERROR_WRITE_PROTECT, EACCES) \ + X(ERROR_WRONG_DISK, EACCES) \ + X(WSAEACCES, EACCES) \ + X(WSAEADDRINUSE, EADDRINUSE) \ + X(WSAEADDRNOTAVAIL, EADDRNOTAVAIL) \ + X(WSAEAFNOSUPPORT, EAFNOSUPPORT) \ + X(WSAECONNABORTED, ECONNABORTED) \ + X(WSAECONNREFUSED, ECONNREFUSED) \ + X(WSAECONNRESET, ECONNRESET) \ + X(WSAEDISCON, EPIPE) \ + X(WSAEFAULT, EFAULT) \ + X(WSAEHOSTDOWN, EHOSTUNREACH) \ + X(WSAEHOSTUNREACH, EHOSTUNREACH) \ + X(WSAEINPROGRESS, EBUSY) \ + X(WSAEINTR, EINTR) \ + X(WSAEINVAL, EINVAL) \ + X(WSAEISCONN, EISCONN) \ + X(WSAEMSGSIZE, EMSGSIZE) \ + X(WSAENETDOWN, ENETDOWN) \ + X(WSAENETRESET, EHOSTUNREACH) \ + X(WSAENETUNREACH, ENETUNREACH) \ + X(WSAENOBUFS, ENOMEM) \ + X(WSAENOTCONN, ENOTCONN) \ + X(WSAENOTSOCK, ENOTSOCK) \ + X(WSAEOPNOTSUPP, EOPNOTSUPP) \ + X(WSAEPROCLIM, ENOMEM) \ + X(WSAESHUTDOWN, EPIPE) \ + X(WSAETIMEDOUT, ETIMEDOUT) \ + X(WSAEWOULDBLOCK, EWOULDBLOCK) \ + X(WSANOTINITIALISED, ENETDOWN) \ + X(WSASYSNOTREADY, ENETDOWN) \ + X(WSAVERNOTSUPPORTED, ENOSYS) + +static errno_t err__map_win_error_to_errno(DWORD error) { + switch (error) { +#define X(error_sym, errno_sym) \ + case error_sym: \ + return errno_sym; + ERR__ERRNO_MAPPINGS(X) +#undef X + } + return EINVAL; +} + +void err_map_win_error(void) { + errno = err__map_win_error_to_errno(GetLastError()); +} + +void err_set_win_error(DWORD error) { + SetLastError(error); + errno = err__map_win_error_to_errno(error); +} + +int err_check_handle(HANDLE handle) { + DWORD flags; + + /* GetHandleInformation() succeeds when passed INVALID_HANDLE_VALUE, so check + * for this condition explicitly. */ + if (handle == INVALID_HANDLE_VALUE) + return_set_error(-1, ERROR_INVALID_HANDLE); + + if (!GetHandleInformation(handle, &flags)) + return_map_error(-1); + + return 0; +} + +#include + +#define array_count(a) (sizeof(a) / (sizeof((a)[0]))) + +#define container_of(ptr, type, member) \ + ((type*) ((uintptr_t) (ptr) - offsetof(type, member))) + +#define unused_var(v) ((void) (v)) + +/* Polyfill `inline` for older versions of msvc (up to Visual Studio 2013) */ +#if defined(_MSC_VER) && _MSC_VER < 1900 +#define inline __inline +#endif + +WEPOLL_INTERNAL int ws_global_init(void); +WEPOLL_INTERNAL SOCKET ws_get_base_socket(SOCKET socket); + +static bool init__done = false; +static INIT_ONCE init__once = INIT_ONCE_STATIC_INIT; + +static BOOL CALLBACK init__once_callback(INIT_ONCE* once, + void* parameter, + void** context) { + unused_var(once); + unused_var(parameter); + unused_var(context); + + /* N.b. that initialization order matters here. */ + if (ws_global_init() < 0 || nt_global_init() < 0 || + reflock_global_init() < 0 || epoll_global_init() < 0) + return FALSE; + + init__done = true; + return TRUE; +} + +int init(void) { + if (!init__done && + !InitOnceExecuteOnce(&init__once, init__once_callback, NULL, NULL)) + /* `InitOnceExecuteOnce()` itself is infallible, and it doesn't set any + * error code when the once-callback returns FALSE. We return -1 here to + * indicate that global initialization failed; the failing init function is + * resposible for setting `errno` and calling `SetLastError()`. */ + return -1; + + return 0; +} + +/* Set up a workaround for the following problem: + * FARPROC addr = GetProcAddress(...); + * MY_FUNC func = (MY_FUNC) addr; <-- GCC 8 warning/error. + * MY_FUNC func = (MY_FUNC) (void*) addr; <-- MSVC warning/error. + * To compile cleanly with either compiler, do casts with this "bridge" type: + * MY_FUNC func = (MY_FUNC) (nt__fn_ptr_cast_t) addr; */ +#ifdef __GNUC__ +typedef void* nt__fn_ptr_cast_t; +#else +typedef FARPROC nt__fn_ptr_cast_t; +#endif + +#define X(return_type, attributes, name, parameters) \ + WEPOLL_INTERNAL return_type(attributes* name) parameters = NULL; +NT_NTDLL_IMPORT_LIST(X) +#undef X + +int nt_global_init(void) { + HMODULE ntdll; + FARPROC fn_ptr; + + ntdll = GetModuleHandleW(L"ntdll.dll"); + if (ntdll == NULL) + return -1; + +#define X(return_type, attributes, name, parameters) \ + fn_ptr = GetProcAddress(ntdll, #name); \ + if (fn_ptr == NULL) \ + return -1; \ + name = (return_type(attributes*) parameters)(nt__fn_ptr_cast_t) fn_ptr; + NT_NTDLL_IMPORT_LIST(X) +#undef X + + return 0; +} + +#include + +typedef struct poll_group poll_group_t; + +typedef struct queue_node queue_node_t; + +WEPOLL_INTERNAL poll_group_t* poll_group_acquire(port_state_t* port); +WEPOLL_INTERNAL void poll_group_release(poll_group_t* poll_group); + +WEPOLL_INTERNAL void poll_group_delete(poll_group_t* poll_group); + +WEPOLL_INTERNAL poll_group_t* poll_group_from_queue_node( + queue_node_t* queue_node); +WEPOLL_INTERNAL HANDLE + poll_group_get_afd_device_handle(poll_group_t* poll_group); + +typedef struct queue_node { + queue_node_t* prev; + queue_node_t* next; +} queue_node_t; + +typedef struct queue { + queue_node_t head; +} queue_t; + +WEPOLL_INTERNAL void queue_init(queue_t* queue); +WEPOLL_INTERNAL void queue_node_init(queue_node_t* node); + +WEPOLL_INTERNAL queue_node_t* queue_first(const queue_t* queue); +WEPOLL_INTERNAL queue_node_t* queue_last(const queue_t* queue); + +WEPOLL_INTERNAL void queue_prepend(queue_t* queue, queue_node_t* node); +WEPOLL_INTERNAL void queue_append(queue_t* queue, queue_node_t* node); +WEPOLL_INTERNAL void queue_move_to_start(queue_t* queue, queue_node_t* node); +WEPOLL_INTERNAL void queue_move_to_end(queue_t* queue, queue_node_t* node); +WEPOLL_INTERNAL void queue_remove(queue_node_t* node); + +WEPOLL_INTERNAL bool queue_is_empty(const queue_t* queue); +WEPOLL_INTERNAL bool queue_is_enqueued(const queue_node_t* node); + +#define POLL_GROUP__MAX_GROUP_SIZE 32 + +typedef struct poll_group { + port_state_t* port_state; + queue_node_t queue_node; + HANDLE afd_device_handle; + size_t group_size; +} poll_group_t; + +static poll_group_t* poll_group__new(port_state_t* port_state) { + HANDLE iocp_handle = port_get_iocp_handle(port_state); + queue_t* poll_group_queue = port_get_poll_group_queue(port_state); + + poll_group_t* poll_group = malloc(sizeof *poll_group); + if (poll_group == NULL) + return_set_error(NULL, ERROR_NOT_ENOUGH_MEMORY); + + memset(poll_group, 0, sizeof *poll_group); + + queue_node_init(&poll_group->queue_node); + poll_group->port_state = port_state; + + if (afd_create_device_handle(iocp_handle, &poll_group->afd_device_handle) < + 0) { + free(poll_group); + return NULL; + } + + queue_append(poll_group_queue, &poll_group->queue_node); + + return poll_group; +} + +void poll_group_delete(poll_group_t* poll_group) { + assert(poll_group->group_size == 0); + CloseHandle(poll_group->afd_device_handle); + queue_remove(&poll_group->queue_node); + free(poll_group); +} + +poll_group_t* poll_group_from_queue_node(queue_node_t* queue_node) { + return container_of(queue_node, poll_group_t, queue_node); +} + +HANDLE poll_group_get_afd_device_handle(poll_group_t* poll_group) { + return poll_group->afd_device_handle; +} + +poll_group_t* poll_group_acquire(port_state_t* port_state) { + queue_t* poll_group_queue = port_get_poll_group_queue(port_state); + poll_group_t* poll_group = + !queue_is_empty(poll_group_queue) + ? container_of( + queue_last(poll_group_queue), poll_group_t, queue_node) + : NULL; + + if (poll_group == NULL || + poll_group->group_size >= POLL_GROUP__MAX_GROUP_SIZE) + poll_group = poll_group__new(port_state); + if (poll_group == NULL) + return NULL; + + if (++poll_group->group_size == POLL_GROUP__MAX_GROUP_SIZE) + queue_move_to_start(poll_group_queue, &poll_group->queue_node); + + return poll_group; +} + +void poll_group_release(poll_group_t* poll_group) { + port_state_t* port_state = poll_group->port_state; + queue_t* poll_group_queue = port_get_poll_group_queue(port_state); + + poll_group->group_size--; + assert(poll_group->group_size < POLL_GROUP__MAX_GROUP_SIZE); + + queue_move_to_end(poll_group_queue, &poll_group->queue_node); + + /* Poll groups are currently only freed when the epoll port is closed. */ +} + +WEPOLL_INTERNAL sock_state_t* sock_new(port_state_t* port_state, + SOCKET socket); +WEPOLL_INTERNAL void sock_delete(port_state_t* port_state, + sock_state_t* sock_state); +WEPOLL_INTERNAL void sock_force_delete(port_state_t* port_state, + sock_state_t* sock_state); + +WEPOLL_INTERNAL int sock_set_event(port_state_t* port_state, + sock_state_t* sock_state, + const struct epoll_event* ev); + +WEPOLL_INTERNAL int sock_update(port_state_t* port_state, + sock_state_t* sock_state); +WEPOLL_INTERNAL int sock_feed_event(port_state_t* port_state, + IO_STATUS_BLOCK* io_status_block, + struct epoll_event* ev); + +WEPOLL_INTERNAL sock_state_t* sock_state_from_queue_node( + queue_node_t* queue_node); +WEPOLL_INTERNAL queue_node_t* sock_state_to_queue_node( + sock_state_t* sock_state); +WEPOLL_INTERNAL sock_state_t* sock_state_from_tree_node( + tree_node_t* tree_node); +WEPOLL_INTERNAL tree_node_t* sock_state_to_tree_node(sock_state_t* sock_state); + +#define PORT__MAX_ON_STACK_COMPLETIONS 256 + +typedef struct port_state { + HANDLE iocp_handle; + tree_t sock_tree; + queue_t sock_update_queue; + queue_t sock_deleted_queue; + queue_t poll_group_queue; + ts_tree_node_t handle_tree_node; + CRITICAL_SECTION lock; + size_t active_poll_count; +} port_state_t; + +static inline port_state_t* port__alloc(void) { + port_state_t* port_state = malloc(sizeof *port_state); + if (port_state == NULL) + return_set_error(NULL, ERROR_NOT_ENOUGH_MEMORY); + + return port_state; +} + +static inline void port__free(port_state_t* port) { + assert(port != NULL); + free(port); +} + +static inline HANDLE port__create_iocp(void) { + HANDLE iocp_handle = + CreateIoCompletionPort(INVALID_HANDLE_VALUE, NULL, 0, 0); + if (iocp_handle == NULL) + return_map_error(NULL); + + return iocp_handle; +} + +port_state_t* port_new(HANDLE* iocp_handle_out) { + port_state_t* port_state; + HANDLE iocp_handle; + + port_state = port__alloc(); + if (port_state == NULL) + goto err1; + + iocp_handle = port__create_iocp(); + if (iocp_handle == NULL) + goto err2; + + memset(port_state, 0, sizeof *port_state); + + port_state->iocp_handle = iocp_handle; + tree_init(&port_state->sock_tree); + queue_init(&port_state->sock_update_queue); + queue_init(&port_state->sock_deleted_queue); + queue_init(&port_state->poll_group_queue); + ts_tree_node_init(&port_state->handle_tree_node); + InitializeCriticalSection(&port_state->lock); + + *iocp_handle_out = iocp_handle; + return port_state; + +err2: + port__free(port_state); +err1: + return NULL; +} + +static inline int port__close_iocp(port_state_t* port_state) { + HANDLE iocp_handle = port_state->iocp_handle; + port_state->iocp_handle = NULL; + + if (!CloseHandle(iocp_handle)) + return_map_error(-1); + + return 0; +} + +int port_close(port_state_t* port_state) { + int result; + + EnterCriticalSection(&port_state->lock); + result = port__close_iocp(port_state); + LeaveCriticalSection(&port_state->lock); + + return result; +} + +int port_delete(port_state_t* port_state) { + tree_node_t* tree_node; + queue_node_t* queue_node; + + /* At this point the IOCP port should have been closed. */ + assert(port_state->iocp_handle == NULL); + + while ((tree_node = tree_root(&port_state->sock_tree)) != NULL) { + sock_state_t* sock_state = sock_state_from_tree_node(tree_node); + sock_force_delete(port_state, sock_state); + } + + while ((queue_node = queue_first(&port_state->sock_deleted_queue)) != NULL) { + sock_state_t* sock_state = sock_state_from_queue_node(queue_node); + sock_force_delete(port_state, sock_state); + } + + while ((queue_node = queue_first(&port_state->poll_group_queue)) != NULL) { + poll_group_t* poll_group = poll_group_from_queue_node(queue_node); + poll_group_delete(poll_group); + } + + assert(queue_is_empty(&port_state->sock_update_queue)); + + DeleteCriticalSection(&port_state->lock); + + port__free(port_state); + + return 0; +} + +static int port__update_events(port_state_t* port_state) { + queue_t* sock_update_queue = &port_state->sock_update_queue; + + /* Walk the queue, submitting new poll requests for every socket that needs + * it. */ + while (!queue_is_empty(sock_update_queue)) { + queue_node_t* queue_node = queue_first(sock_update_queue); + sock_state_t* sock_state = sock_state_from_queue_node(queue_node); + + if (sock_update(port_state, sock_state) < 0) + return -1; + + /* sock_update() removes the socket from the update queue. */ + } + + return 0; +} + +static inline void port__update_events_if_polling(port_state_t* port_state) { + if (port_state->active_poll_count > 0) + port__update_events(port_state); +} + +static inline int port__feed_events(port_state_t* port_state, + struct epoll_event* epoll_events, + OVERLAPPED_ENTRY* iocp_events, + DWORD iocp_event_count) { + int epoll_event_count = 0; + DWORD i; + + for (i = 0; i < iocp_event_count; i++) { + IO_STATUS_BLOCK* io_status_block = + (IO_STATUS_BLOCK*) iocp_events[i].lpOverlapped; + struct epoll_event* ev = &epoll_events[epoll_event_count]; + + epoll_event_count += sock_feed_event(port_state, io_status_block, ev); + } + + return epoll_event_count; +} + +static inline int port__poll(port_state_t* port_state, + struct epoll_event* epoll_events, + OVERLAPPED_ENTRY* iocp_events, + DWORD maxevents, + DWORD timeout) { + DWORD completion_count; + + if (port__update_events(port_state) < 0) + return -1; + + port_state->active_poll_count++; + + LeaveCriticalSection(&port_state->lock); + + BOOL r = GetQueuedCompletionStatusEx(port_state->iocp_handle, + iocp_events, + maxevents, + &completion_count, + timeout, + FALSE); + + EnterCriticalSection(&port_state->lock); + + port_state->active_poll_count--; + + if (!r) + return_map_error(-1); + + return port__feed_events( + port_state, epoll_events, iocp_events, completion_count); +} + +int port_wait(port_state_t* port_state, + struct epoll_event* events, + int maxevents, + int timeout) { + OVERLAPPED_ENTRY stack_iocp_events[PORT__MAX_ON_STACK_COMPLETIONS]; + OVERLAPPED_ENTRY* iocp_events; + uint64_t due = 0; + DWORD gqcs_timeout; + int result; + + /* Check whether `maxevents` is in range. */ + if (maxevents <= 0) + return_set_error(-1, ERROR_INVALID_PARAMETER); + + /* Decide whether the IOCP completion list can live on the stack, or allocate + * memory for it on the heap. */ + if ((size_t) maxevents <= array_count(stack_iocp_events)) { + iocp_events = stack_iocp_events; + } else if ((iocp_events = + malloc((size_t) maxevents * sizeof *iocp_events)) == NULL) { + iocp_events = stack_iocp_events; + maxevents = array_count(stack_iocp_events); + } + + /* Compute the timeout for GetQueuedCompletionStatus, and the wait end + * time, if the user specified a timeout other than zero or infinite. */ + if (timeout > 0) { + due = GetTickCount64() + (uint64_t) timeout; + gqcs_timeout = (DWORD) timeout; + } else if (timeout == 0) { + gqcs_timeout = 0; + } else { + gqcs_timeout = INFINITE; + } + + EnterCriticalSection(&port_state->lock); + + /* Dequeue completion packets until either at least one interesting event + * has been discovered, or the timeout is reached. */ + for (;;) { + uint64_t now; + + result = port__poll( + port_state, events, iocp_events, (DWORD) maxevents, gqcs_timeout); + if (result < 0 || result > 0) + break; /* Result, error, or time-out. */ + + if (timeout < 0) + continue; /* When timeout is negative, never time out. */ + + /* Update time. */ + now = GetTickCount64(); + + /* Do not allow the due time to be in the past. */ + if (now >= due) { + SetLastError(WAIT_TIMEOUT); + break; + } + + /* Recompute time-out argument for GetQueuedCompletionStatus. */ + gqcs_timeout = (DWORD)(due - now); + } + + port__update_events_if_polling(port_state); + + LeaveCriticalSection(&port_state->lock); + + if (iocp_events != stack_iocp_events) + free(iocp_events); + + if (result >= 0) + return result; + else if (GetLastError() == WAIT_TIMEOUT) + return 0; + else + return -1; +} + +static inline int port__ctl_add(port_state_t* port_state, + SOCKET sock, + struct epoll_event* ev) { + sock_state_t* sock_state = sock_new(port_state, sock); + if (sock_state == NULL) + return -1; + + if (sock_set_event(port_state, sock_state, ev) < 0) { + sock_delete(port_state, sock_state); + return -1; + } + + port__update_events_if_polling(port_state); + + return 0; +} + +static inline int port__ctl_mod(port_state_t* port_state, + SOCKET sock, + struct epoll_event* ev) { + sock_state_t* sock_state = port_find_socket(port_state, sock); + if (sock_state == NULL) + return -1; + + if (sock_set_event(port_state, sock_state, ev) < 0) + return -1; + + port__update_events_if_polling(port_state); + + return 0; +} + +static inline int port__ctl_del(port_state_t* port_state, SOCKET sock) { + sock_state_t* sock_state = port_find_socket(port_state, sock); + if (sock_state == NULL) + return -1; + + sock_delete(port_state, sock_state); + + return 0; +} + +static inline int port__ctl_op(port_state_t* port_state, + int op, + SOCKET sock, + struct epoll_event* ev) { + switch (op) { + case EPOLL_CTL_ADD: + return port__ctl_add(port_state, sock, ev); + case EPOLL_CTL_MOD: + return port__ctl_mod(port_state, sock, ev); + case EPOLL_CTL_DEL: + return port__ctl_del(port_state, sock); + default: + return_set_error(-1, ERROR_INVALID_PARAMETER); + } +} + +int port_ctl(port_state_t* port_state, + int op, + SOCKET sock, + struct epoll_event* ev) { + int result; + + EnterCriticalSection(&port_state->lock); + result = port__ctl_op(port_state, op, sock, ev); + LeaveCriticalSection(&port_state->lock); + + return result; +} + +int port_register_socket(port_state_t* port_state, + sock_state_t* sock_state, + SOCKET socket) { + if (tree_add(&port_state->sock_tree, + sock_state_to_tree_node(sock_state), + socket) < 0) + return_set_error(-1, ERROR_ALREADY_EXISTS); + return 0; +} + +void port_unregister_socket(port_state_t* port_state, + sock_state_t* sock_state) { + tree_del(&port_state->sock_tree, sock_state_to_tree_node(sock_state)); +} + +sock_state_t* port_find_socket(port_state_t* port_state, SOCKET socket) { + tree_node_t* tree_node = tree_find(&port_state->sock_tree, socket); + if (tree_node == NULL) + return_set_error(NULL, ERROR_NOT_FOUND); + return sock_state_from_tree_node(tree_node); +} + +void port_request_socket_update(port_state_t* port_state, + sock_state_t* sock_state) { + if (queue_is_enqueued(sock_state_to_queue_node(sock_state))) + return; + queue_append(&port_state->sock_update_queue, + sock_state_to_queue_node(sock_state)); +} + +void port_cancel_socket_update(port_state_t* port_state, + sock_state_t* sock_state) { + unused_var(port_state); + if (!queue_is_enqueued(sock_state_to_queue_node(sock_state))) + return; + queue_remove(sock_state_to_queue_node(sock_state)); +} + +void port_add_deleted_socket(port_state_t* port_state, + sock_state_t* sock_state) { + if (queue_is_enqueued(sock_state_to_queue_node(sock_state))) + return; + queue_append(&port_state->sock_deleted_queue, + sock_state_to_queue_node(sock_state)); +} + +void port_remove_deleted_socket(port_state_t* port_state, + sock_state_t* sock_state) { + unused_var(port_state); + if (!queue_is_enqueued(sock_state_to_queue_node(sock_state))) + return; + queue_remove(sock_state_to_queue_node(sock_state)); +} + +HANDLE port_get_iocp_handle(port_state_t* port_state) { + assert(port_state->iocp_handle != NULL); + return port_state->iocp_handle; +} + +queue_t* port_get_poll_group_queue(port_state_t* port_state) { + return &port_state->poll_group_queue; +} + +port_state_t* port_state_from_handle_tree_node(ts_tree_node_t* tree_node) { + return container_of(tree_node, port_state_t, handle_tree_node); +} + +ts_tree_node_t* port_state_to_handle_tree_node(port_state_t* port_state) { + return &port_state->handle_tree_node; +} + +void queue_init(queue_t* queue) { + queue_node_init(&queue->head); +} + +void queue_node_init(queue_node_t* node) { + node->prev = node; + node->next = node; +} + +static inline void queue__detach_node(queue_node_t* node) { + node->prev->next = node->next; + node->next->prev = node->prev; +} + +queue_node_t* queue_first(const queue_t* queue) { + return !queue_is_empty(queue) ? queue->head.next : NULL; +} + +queue_node_t* queue_last(const queue_t* queue) { + return !queue_is_empty(queue) ? queue->head.prev : NULL; +} + +void queue_prepend(queue_t* queue, queue_node_t* node) { + node->next = queue->head.next; + node->prev = &queue->head; + node->next->prev = node; + queue->head.next = node; +} + +void queue_append(queue_t* queue, queue_node_t* node) { + node->next = &queue->head; + node->prev = queue->head.prev; + node->prev->next = node; + queue->head.prev = node; +} + +void queue_move_to_start(queue_t* queue, queue_node_t* node) { + queue__detach_node(node); + queue_prepend(queue, node); +} + +void queue_move_to_end(queue_t* queue, queue_node_t* node) { + queue__detach_node(node); + queue_append(queue, node); +} + +void queue_remove(queue_node_t* node) { + queue__detach_node(node); + queue_node_init(node); +} + +bool queue_is_empty(const queue_t* queue) { + return !queue_is_enqueued(&queue->head); +} + +bool queue_is_enqueued(const queue_node_t* node) { + return node->prev != node; +} + +#define REFLOCK__REF ((long) 0x00000001UL) +#define REFLOCK__REF_MASK ((long) 0x0fffffffUL) +#define REFLOCK__DESTROY ((long) 0x10000000UL) +#define REFLOCK__DESTROY_MASK ((long) 0xf0000000UL) +#define REFLOCK__POISON ((long) 0x300dead0UL) + +static HANDLE reflock__keyed_event = NULL; + +int reflock_global_init(void) { + NTSTATUS status = NtCreateKeyedEvent( + &reflock__keyed_event, KEYEDEVENT_ALL_ACCESS, NULL, 0); + if (status != STATUS_SUCCESS) + return_set_error(-1, RtlNtStatusToDosError(status)); + return 0; +} + +void reflock_init(reflock_t* reflock) { + reflock->state = 0; +} + +static void reflock__signal_event(void* address) { + NTSTATUS status = + NtReleaseKeyedEvent(reflock__keyed_event, address, FALSE, NULL); + if (status != STATUS_SUCCESS) + abort(); +} + +static void reflock__await_event(void* address) { + NTSTATUS status = + NtWaitForKeyedEvent(reflock__keyed_event, address, FALSE, NULL); + if (status != STATUS_SUCCESS) + abort(); +} + +void reflock_ref(reflock_t* reflock) { + long state = InterlockedAdd(&reflock->state, REFLOCK__REF); + + /* Verify that the counter didn't overflow and the lock isn't destroyed. */ + assert((state & REFLOCK__DESTROY_MASK) == 0); + unused_var(state); +} + +void reflock_unref(reflock_t* reflock) { + long state = InterlockedAdd(&reflock->state, -REFLOCK__REF); + + /* Verify that the lock was referenced and not already destroyed. */ + assert((state & REFLOCK__DESTROY_MASK & ~REFLOCK__DESTROY) == 0); + + if (state == REFLOCK__DESTROY) + reflock__signal_event(reflock); +} + +void reflock_unref_and_destroy(reflock_t* reflock) { + long state = + InterlockedAdd(&reflock->state, REFLOCK__DESTROY - REFLOCK__REF); + long ref_count = state & REFLOCK__REF_MASK; + + /* Verify that the lock was referenced and not already destroyed. */ + assert((state & REFLOCK__DESTROY_MASK) == REFLOCK__DESTROY); + + if (ref_count != 0) + reflock__await_event(reflock); + + state = InterlockedExchange(&reflock->state, REFLOCK__POISON); + assert(state == REFLOCK__DESTROY); +} + +#define SOCK__KNOWN_EPOLL_EVENTS \ + (EPOLLIN | EPOLLPRI | EPOLLOUT | EPOLLERR | EPOLLHUP | EPOLLRDNORM | \ + EPOLLRDBAND | EPOLLWRNORM | EPOLLWRBAND | EPOLLMSG | EPOLLRDHUP) + +typedef enum sock__poll_status { + SOCK__POLL_IDLE = 0, + SOCK__POLL_PENDING, + SOCK__POLL_CANCELLED +} sock__poll_status_t; + +typedef struct sock_state { + IO_STATUS_BLOCK io_status_block; + AFD_POLL_INFO poll_info; + queue_node_t queue_node; + tree_node_t tree_node; + poll_group_t* poll_group; + SOCKET base_socket; + epoll_data_t user_data; + uint32_t user_events; + uint32_t pending_events; + sock__poll_status_t poll_status; + bool delete_pending; +} sock_state_t; + +static inline sock_state_t* sock__alloc(void) { + sock_state_t* sock_state = malloc(sizeof *sock_state); + if (sock_state == NULL) + return_set_error(NULL, ERROR_NOT_ENOUGH_MEMORY); + return sock_state; +} + +static inline void sock__free(sock_state_t* sock_state) { + assert(sock_state != NULL); + free(sock_state); +} + +static inline int sock__cancel_poll(sock_state_t* sock_state) { + assert(sock_state->poll_status == SOCK__POLL_PENDING); + + if (afd_cancel_poll(poll_group_get_afd_device_handle(sock_state->poll_group), + &sock_state->io_status_block) < 0) + return -1; + + sock_state->poll_status = SOCK__POLL_CANCELLED; + sock_state->pending_events = 0; + return 0; +} + +sock_state_t* sock_new(port_state_t* port_state, SOCKET socket) { + SOCKET base_socket; + poll_group_t* poll_group; + sock_state_t* sock_state; + + if (socket == 0 || socket == INVALID_SOCKET) + return_set_error(NULL, ERROR_INVALID_HANDLE); + + base_socket = ws_get_base_socket(socket); + if (base_socket == INVALID_SOCKET) + return NULL; + + poll_group = poll_group_acquire(port_state); + if (poll_group == NULL) + return NULL; + + sock_state = sock__alloc(); + if (sock_state == NULL) + goto err1; + + memset(sock_state, 0, sizeof *sock_state); + + sock_state->base_socket = base_socket; + sock_state->poll_group = poll_group; + + tree_node_init(&sock_state->tree_node); + queue_node_init(&sock_state->queue_node); + + if (port_register_socket(port_state, sock_state, socket) < 0) + goto err2; + + return sock_state; + +err2: + sock__free(sock_state); +err1: + poll_group_release(poll_group); + + return NULL; +} + +static int sock__delete(port_state_t* port_state, + sock_state_t* sock_state, + bool force) { + if (!sock_state->delete_pending) { + if (sock_state->poll_status == SOCK__POLL_PENDING) + sock__cancel_poll(sock_state); + + port_cancel_socket_update(port_state, sock_state); + port_unregister_socket(port_state, sock_state); + + sock_state->delete_pending = true; + } + + /* If the poll request still needs to complete, the sock_state object can't + * be free()d yet. `sock_feed_event()` or `port_close()` will take care + * of this later. */ + if (force || sock_state->poll_status == SOCK__POLL_IDLE) { + /* Free the sock_state now. */ + port_remove_deleted_socket(port_state, sock_state); + poll_group_release(sock_state->poll_group); + sock__free(sock_state); + } else { + /* Free the socket later. */ + port_add_deleted_socket(port_state, sock_state); + } + + return 0; +} + +void sock_delete(port_state_t* port_state, sock_state_t* sock_state) { + sock__delete(port_state, sock_state, false); +} + +void sock_force_delete(port_state_t* port_state, sock_state_t* sock_state) { + sock__delete(port_state, sock_state, true); +} + +int sock_set_event(port_state_t* port_state, + sock_state_t* sock_state, + const struct epoll_event* ev) { + /* EPOLLERR and EPOLLHUP are always reported, even when not requested by the + * caller. However they are disabled after a event has been reported for a + * socket for which the EPOLLONESHOT flag was set. */ + uint32_t events = ev->events | EPOLLERR | EPOLLHUP; + + sock_state->user_events = events; + sock_state->user_data = ev->data; + + if ((events & SOCK__KNOWN_EPOLL_EVENTS & ~sock_state->pending_events) != 0) + port_request_socket_update(port_state, sock_state); + + return 0; +} + +static inline DWORD sock__epoll_events_to_afd_events(uint32_t epoll_events) { + /* Always monitor for AFD_POLL_LOCAL_CLOSE, which is triggered when the + * socket is closed with closesocket() or CloseHandle(). */ + DWORD afd_events = AFD_POLL_LOCAL_CLOSE; + + if (epoll_events & (EPOLLIN | EPOLLRDNORM)) + afd_events |= AFD_POLL_RECEIVE | AFD_POLL_ACCEPT; + if (epoll_events & (EPOLLPRI | EPOLLRDBAND)) + afd_events |= AFD_POLL_RECEIVE_EXPEDITED; + if (epoll_events & (EPOLLOUT | EPOLLWRNORM | EPOLLWRBAND)) + afd_events |= AFD_POLL_SEND; + if (epoll_events & (EPOLLIN | EPOLLRDNORM | EPOLLRDHUP)) + afd_events |= AFD_POLL_DISCONNECT; + if (epoll_events & EPOLLHUP) + afd_events |= AFD_POLL_ABORT; + if (epoll_events & EPOLLERR) + afd_events |= AFD_POLL_CONNECT_FAIL; + + return afd_events; +} + +static inline uint32_t sock__afd_events_to_epoll_events(DWORD afd_events) { + uint32_t epoll_events = 0; + + if (afd_events & (AFD_POLL_RECEIVE | AFD_POLL_ACCEPT)) + epoll_events |= EPOLLIN | EPOLLRDNORM; + if (afd_events & AFD_POLL_RECEIVE_EXPEDITED) + epoll_events |= EPOLLPRI | EPOLLRDBAND; + if (afd_events & AFD_POLL_SEND) + epoll_events |= EPOLLOUT | EPOLLWRNORM | EPOLLWRBAND; + if (afd_events & AFD_POLL_DISCONNECT) + epoll_events |= EPOLLIN | EPOLLRDNORM | EPOLLRDHUP; + if (afd_events & AFD_POLL_ABORT) + epoll_events |= EPOLLHUP; + if (afd_events & AFD_POLL_CONNECT_FAIL) + /* Linux reports all these events after connect() has failed. */ + epoll_events |= + EPOLLIN | EPOLLOUT | EPOLLERR | EPOLLRDNORM | EPOLLWRNORM | EPOLLRDHUP; + + return epoll_events; +} + +int sock_update(port_state_t* port_state, sock_state_t* sock_state) { + assert(!sock_state->delete_pending); + + if ((sock_state->poll_status == SOCK__POLL_PENDING) && + (sock_state->user_events & SOCK__KNOWN_EPOLL_EVENTS & + ~sock_state->pending_events) == 0) { + /* All the events the user is interested in are already being monitored by + * the pending poll operation. It might spuriously complete because of an + * event that we're no longer interested in; when that happens we'll submit + * a new poll operation with the updated event mask. */ + + } else if (sock_state->poll_status == SOCK__POLL_PENDING) { + /* A poll operation is already pending, but it's not monitoring for all the + * events that the user is interested in. Therefore, cancel the pending + * poll operation; when we receive it's completion package, a new poll + * operation will be submitted with the correct event mask. */ + if (sock__cancel_poll(sock_state) < 0) + return -1; + + } else if (sock_state->poll_status == SOCK__POLL_CANCELLED) { + /* The poll operation has already been cancelled, we're still waiting for + * it to return. For now, there's nothing that needs to be done. */ + + } else if (sock_state->poll_status == SOCK__POLL_IDLE) { + /* No poll operation is pending; start one. */ + sock_state->poll_info.Exclusive = FALSE; + sock_state->poll_info.NumberOfHandles = 1; + sock_state->poll_info.Timeout.QuadPart = INT64_MAX; + sock_state->poll_info.Handles[0].Handle = (HANDLE) sock_state->base_socket; + sock_state->poll_info.Handles[0].Status = 0; + sock_state->poll_info.Handles[0].Events = + sock__epoll_events_to_afd_events(sock_state->user_events); + + if (afd_poll(poll_group_get_afd_device_handle(sock_state->poll_group), + &sock_state->poll_info, + &sock_state->io_status_block) < 0) { + switch (GetLastError()) { + case ERROR_IO_PENDING: + /* Overlapped poll operation in progress; this is expected. */ + break; + case ERROR_INVALID_HANDLE: + /* Socket closed; it'll be dropped from the epoll set. */ + return sock__delete(port_state, sock_state, false); + default: + /* Other errors are propagated to the caller. */ + return_map_error(-1); + } + } + + /* The poll request was successfully submitted. */ + sock_state->poll_status = SOCK__POLL_PENDING; + sock_state->pending_events = sock_state->user_events; + + } else { + /* Unreachable. */ + assert(false); + } + + port_cancel_socket_update(port_state, sock_state); + return 0; +} + +int sock_feed_event(port_state_t* port_state, + IO_STATUS_BLOCK* io_status_block, + struct epoll_event* ev) { + sock_state_t* sock_state = + container_of(io_status_block, sock_state_t, io_status_block); + AFD_POLL_INFO* poll_info = &sock_state->poll_info; + uint32_t epoll_events = 0; + + sock_state->poll_status = SOCK__POLL_IDLE; + sock_state->pending_events = 0; + + if (sock_state->delete_pending) { + /* Socket has been deleted earlier and can now be freed. */ + return sock__delete(port_state, sock_state, false); + + } else if (io_status_block->Status == STATUS_CANCELLED) { + /* The poll request was cancelled by CancelIoEx. */ + + } else if (!NT_SUCCESS(io_status_block->Status)) { + /* The overlapped request itself failed in an unexpected way. */ + epoll_events = EPOLLERR; + + } else if (poll_info->NumberOfHandles < 1) { + /* This poll operation succeeded but didn't report any socket events. */ + + } else if (poll_info->Handles[0].Events & AFD_POLL_LOCAL_CLOSE) { + /* The poll operation reported that the socket was closed. */ + return sock__delete(port_state, sock_state, false); + + } else { + /* Events related to our socket were reported. */ + epoll_events = + sock__afd_events_to_epoll_events(poll_info->Handles[0].Events); + } + + /* Requeue the socket so a new poll request will be submitted. */ + port_request_socket_update(port_state, sock_state); + + /* Filter out events that the user didn't ask for. */ + epoll_events &= sock_state->user_events; + + /* Return if there are no epoll events to report. */ + if (epoll_events == 0) + return 0; + + /* If the the socket has the EPOLLONESHOT flag set, unmonitor all events, + * even EPOLLERR and EPOLLHUP. But always keep looking for closed sockets. */ + if (sock_state->user_events & EPOLLONESHOT) + sock_state->user_events = 0; + + ev->data = sock_state->user_data; + ev->events = epoll_events; + return 1; +} + +sock_state_t* sock_state_from_queue_node(queue_node_t* queue_node) { + return container_of(queue_node, sock_state_t, queue_node); +} + +queue_node_t* sock_state_to_queue_node(sock_state_t* sock_state) { + return &sock_state->queue_node; +} + +sock_state_t* sock_state_from_tree_node(tree_node_t* tree_node) { + return container_of(tree_node, sock_state_t, tree_node); +} + +tree_node_t* sock_state_to_tree_node(sock_state_t* sock_state) { + return &sock_state->tree_node; +} + +void ts_tree_init(ts_tree_t* ts_tree) { + tree_init(&ts_tree->tree); + InitializeSRWLock(&ts_tree->lock); +} + +void ts_tree_node_init(ts_tree_node_t* node) { + tree_node_init(&node->tree_node); + reflock_init(&node->reflock); +} + +int ts_tree_add(ts_tree_t* ts_tree, ts_tree_node_t* node, uintptr_t key) { + int r; + + AcquireSRWLockExclusive(&ts_tree->lock); + r = tree_add(&ts_tree->tree, &node->tree_node, key); + ReleaseSRWLockExclusive(&ts_tree->lock); + + return r; +} + +static inline ts_tree_node_t* ts_tree__find_node(ts_tree_t* ts_tree, + uintptr_t key) { + tree_node_t* tree_node = tree_find(&ts_tree->tree, key); + if (tree_node == NULL) + return NULL; + + return container_of(tree_node, ts_tree_node_t, tree_node); +} + +ts_tree_node_t* ts_tree_del_and_ref(ts_tree_t* ts_tree, uintptr_t key) { + ts_tree_node_t* ts_tree_node; + + AcquireSRWLockExclusive(&ts_tree->lock); + + ts_tree_node = ts_tree__find_node(ts_tree, key); + if (ts_tree_node != NULL) { + tree_del(&ts_tree->tree, &ts_tree_node->tree_node); + reflock_ref(&ts_tree_node->reflock); + } + + ReleaseSRWLockExclusive(&ts_tree->lock); + + return ts_tree_node; +} + +ts_tree_node_t* ts_tree_find_and_ref(ts_tree_t* ts_tree, uintptr_t key) { + ts_tree_node_t* ts_tree_node; + + AcquireSRWLockShared(&ts_tree->lock); + + ts_tree_node = ts_tree__find_node(ts_tree, key); + if (ts_tree_node != NULL) + reflock_ref(&ts_tree_node->reflock); + + ReleaseSRWLockShared(&ts_tree->lock); + + return ts_tree_node; +} + +void ts_tree_node_unref(ts_tree_node_t* node) { + reflock_unref(&node->reflock); +} + +void ts_tree_node_unref_and_destroy(ts_tree_node_t* node) { + reflock_unref_and_destroy(&node->reflock); +} + +void tree_init(tree_t* tree) { + memset(tree, 0, sizeof *tree); +} + +void tree_node_init(tree_node_t* node) { + memset(node, 0, sizeof *node); +} + +#define TREE__ROTATE(cis, trans) \ + tree_node_t* p = node; \ + tree_node_t* q = node->trans; \ + tree_node_t* parent = p->parent; \ + \ + if (parent) { \ + if (parent->left == p) \ + parent->left = q; \ + else \ + parent->right = q; \ + } else { \ + tree->root = q; \ + } \ + \ + q->parent = parent; \ + p->parent = q; \ + p->trans = q->cis; \ + if (p->trans) \ + p->trans->parent = p; \ + q->cis = p; + +static inline void tree__rotate_left(tree_t* tree, tree_node_t* node) { + TREE__ROTATE(left, right) +} + +static inline void tree__rotate_right(tree_t* tree, tree_node_t* node) { + TREE__ROTATE(right, left) +} + +#define TREE__INSERT_OR_DESCEND(side) \ + if (parent->side) { \ + parent = parent->side; \ + } else { \ + parent->side = node; \ + break; \ + } + +#define TREE__REBALANCE_AFTER_INSERT(cis, trans) \ + tree_node_t* grandparent = parent->parent; \ + tree_node_t* uncle = grandparent->trans; \ + \ + if (uncle && uncle->red) { \ + parent->red = uncle->red = false; \ + grandparent->red = true; \ + node = grandparent; \ + } else { \ + if (node == parent->trans) { \ + tree__rotate_##cis(tree, parent); \ + node = parent; \ + parent = node->parent; \ + } \ + parent->red = false; \ + grandparent->red = true; \ + tree__rotate_##trans(tree, grandparent); \ + } + +int tree_add(tree_t* tree, tree_node_t* node, uintptr_t key) { + tree_node_t* parent; + + parent = tree->root; + if (parent) { + for (;;) { + if (key < parent->key) { + TREE__INSERT_OR_DESCEND(left) + } else if (key > parent->key) { + TREE__INSERT_OR_DESCEND(right) + } else { + return -1; + } + } + } else { + tree->root = node; + } + + node->key = key; + node->left = node->right = NULL; + node->parent = parent; + node->red = true; + + for (; parent && parent->red; parent = node->parent) { + if (parent == parent->parent->left) { + TREE__REBALANCE_AFTER_INSERT(left, right) + } else { + TREE__REBALANCE_AFTER_INSERT(right, left) + } + } + tree->root->red = false; + + return 0; +} + +#define TREE__REBALANCE_AFTER_REMOVE(cis, trans) \ + tree_node_t* sibling = parent->trans; \ + \ + if (sibling->red) { \ + sibling->red = false; \ + parent->red = true; \ + tree__rotate_##cis(tree, parent); \ + sibling = parent->trans; \ + } \ + if ((sibling->left && sibling->left->red) || \ + (sibling->right && sibling->right->red)) { \ + if (!sibling->trans || !sibling->trans->red) { \ + sibling->cis->red = false; \ + sibling->red = true; \ + tree__rotate_##trans(tree, sibling); \ + sibling = parent->trans; \ + } \ + sibling->red = parent->red; \ + parent->red = sibling->trans->red = false; \ + tree__rotate_##cis(tree, parent); \ + node = tree->root; \ + break; \ + } \ + sibling->red = true; + +void tree_del(tree_t* tree, tree_node_t* node) { + tree_node_t* parent = node->parent; + tree_node_t* left = node->left; + tree_node_t* right = node->right; + tree_node_t* next; + bool red; + + if (!left) { + next = right; + } else if (!right) { + next = left; + } else { + next = right; + while (next->left) + next = next->left; + } + + if (parent) { + if (parent->left == node) + parent->left = next; + else + parent->right = next; + } else { + tree->root = next; + } + + if (left && right) { + red = next->red; + next->red = node->red; + next->left = left; + left->parent = next; + if (next != right) { + parent = next->parent; + next->parent = node->parent; + node = next->right; + parent->left = node; + next->right = right; + right->parent = next; + } else { + next->parent = parent; + parent = next; + node = next->right; + } + } else { + red = node->red; + node = next; + } + + if (node) + node->parent = parent; + if (red) + return; + if (node && node->red) { + node->red = false; + return; + } + + do { + if (node == tree->root) + break; + if (node == parent->left) { + TREE__REBALANCE_AFTER_REMOVE(left, right) + } else { + TREE__REBALANCE_AFTER_REMOVE(right, left) + } + node = parent; + parent = parent->parent; + } while (!node->red); + + if (node) + node->red = false; +} + +tree_node_t* tree_find(const tree_t* tree, uintptr_t key) { + tree_node_t* node = tree->root; + while (node) { + if (key < node->key) + node = node->left; + else if (key > node->key) + node = node->right; + else + return node; + } + return NULL; +} + +tree_node_t* tree_root(const tree_t* tree) { + return tree->root; +} + +#ifndef SIO_BSP_HANDLE_POLL +#define SIO_BSP_HANDLE_POLL 0x4800001D +#endif + +#ifndef SIO_BASE_HANDLE +#define SIO_BASE_HANDLE 0x48000022 +#endif + +int ws_global_init(void) { + int r; + WSADATA wsa_data; + + r = WSAStartup(MAKEWORD(2, 2), &wsa_data); + if (r != 0) + return_set_error(-1, (DWORD) r); + + return 0; +} + +static inline SOCKET ws__ioctl_get_bsp_socket(SOCKET socket, DWORD ioctl) { + SOCKET bsp_socket; + DWORD bytes; + + if (WSAIoctl(socket, + ioctl, + NULL, + 0, + &bsp_socket, + sizeof bsp_socket, + &bytes, + NULL, + NULL) != SOCKET_ERROR) + return bsp_socket; + else + return INVALID_SOCKET; +} + +SOCKET ws_get_base_socket(SOCKET socket) { + SOCKET base_socket; + DWORD error; + + for (;;) { + base_socket = ws__ioctl_get_bsp_socket(socket, SIO_BASE_HANDLE); + if (base_socket != INVALID_SOCKET) + return base_socket; + + error = GetLastError(); + if (error == WSAENOTSOCK) + return_set_error(INVALID_SOCKET, error); + + /* Even though Microsoft documentation clearly states that LSPs should + * never intercept the `SIO_BASE_HANDLE` ioctl [1], Komodia based LSPs do + * so anyway, breaking it, with the apparent intention of preventing LSP + * bypass [2]. Fortunately they don't handle `SIO_BSP_HANDLE_POLL`, which + * will at least let us obtain the socket associated with the next winsock + * protocol chain entry. If this succeeds, loop around and call + * `SIO_BASE_HANDLE` again with the returned BSP socket, to make sure that + * we unwrap all layers and retrieve the actual base socket. + * [1] https://docs.microsoft.com/en-us/windows/win32/winsock/winsock-ioctls + * [2] https://www.komodia.com/newwiki/index.php?title=Komodia%27s_Redirector_bug_fixes#Version_2.2.2.6 + */ + base_socket = ws__ioctl_get_bsp_socket(socket, SIO_BSP_HANDLE_POLL); + if (base_socket != INVALID_SOCKET && base_socket != socket) + socket = base_socket; + else + return_set_error(INVALID_SOCKET, error); + } +} diff --git a/Net/src/wepoll.h b/Net/src/wepoll.h new file mode 100644 index 000000000..03e2cfb37 --- /dev/null +++ b/Net/src/wepoll.h @@ -0,0 +1,114 @@ +/* + * wepoll - epoll for Windows + * https://github.com/piscisaureus/wepoll + * + * Copyright 2012-2020, Bert Belder + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WEPOLL_H_ +#define WEPOLL_H_ + +#ifndef WEPOLL_EXPORT +#define WEPOLL_EXPORT +#endif + +#include + +enum EPOLL_EVENTS { + EPOLLIN = (int) (1U << 0), + EPOLLPRI = (int) (1U << 1), + EPOLLOUT = (int) (1U << 2), + EPOLLERR = (int) (1U << 3), + EPOLLHUP = (int) (1U << 4), + EPOLLRDNORM = (int) (1U << 6), + EPOLLRDBAND = (int) (1U << 7), + EPOLLWRNORM = (int) (1U << 8), + EPOLLWRBAND = (int) (1U << 9), + EPOLLMSG = (int) (1U << 10), /* Never reported. */ + EPOLLRDHUP = (int) (1U << 13), + EPOLLONESHOT = (int) (1U << 31) +}; + +#define EPOLLIN (1U << 0) +#define EPOLLPRI (1U << 1) +#define EPOLLOUT (1U << 2) +#define EPOLLERR (1U << 3) +#define EPOLLHUP (1U << 4) +#define EPOLLRDNORM (1U << 6) +#define EPOLLRDBAND (1U << 7) +#define EPOLLWRNORM (1U << 8) +#define EPOLLWRBAND (1U << 9) +#define EPOLLMSG (1U << 10) +#define EPOLLRDHUP (1U << 13) +#define EPOLLONESHOT (1U << 31) + +#define EPOLL_CTL_ADD 1 +#define EPOLL_CTL_MOD 2 +#define EPOLL_CTL_DEL 3 + +typedef void* HANDLE; +typedef uintptr_t SOCKET; + +typedef union epoll_data { + void* ptr; + int fd; + uint32_t u32; + uint64_t u64; + SOCKET sock; /* Windows specific */ + HANDLE hnd; /* Windows specific */ +} epoll_data_t; + +struct epoll_event { + uint32_t events; /* Epoll events and flags */ + epoll_data_t data; /* User data variable */ +}; + +#ifdef __cplusplus +extern "C" { +#endif + +WEPOLL_EXPORT HANDLE epoll_create(int size); +WEPOLL_EXPORT HANDLE epoll_create1(int flags); + +WEPOLL_EXPORT int epoll_close(HANDLE ephnd); + +WEPOLL_EXPORT int epoll_ctl(HANDLE ephnd, + int op, + SOCKET sock, + struct epoll_event* event); + +WEPOLL_EXPORT int epoll_wait(HANDLE ephnd, + struct epoll_event* events, + int maxevents, + int timeout); + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* WEPOLL_H_ */ diff --git a/Net/testsuite/TestSuite.progen b/Net/testsuite/TestSuite.progen index 8035acff1..f65485977 100644 --- a/Net/testsuite/TestSuite.progen +++ b/Net/testsuite/TestSuite.progen @@ -7,5 +7,6 @@ vc.project.platforms = Win32 vc.project.configurations = debug_shared, release_shared, debug_static_mt, release_static_mt, debug_static_md, release_static_md vc.project.prototype = TestSuite_vs90.vcproj vc.project.compiler.include = ..\\..\\Foundation\\include +vc.project.compiler.additionalOptions = /Zc:__cplusplus vc.project.linker.dependencies = iphlpapi.lib vc.project.linker.dependencies.Win32 = ws2_32.lib diff --git a/Net/testsuite/TestSuite_vs150.vcxproj b/Net/testsuite/TestSuite_vs150.vcxproj index 1da787fc9..0d63842aa 100644 --- a/Net/testsuite/TestSuite_vs150.vcxproj +++ b/Net/testsuite/TestSuite_vs150.vcxproj @@ -1,4 +1,4 @@ - + @@ -56,120 +56,109 @@ TestSuite Win32Proj - + Application + v142 MultiByte - v141 Application + v142 MultiByte - v141 Application + v142 MultiByte - v141 Application + v142 MultiByte - v141 Application + v142 MultiByte - v141 Application + v142 MultiByte - v141 Application + v142 MultiByte - v141 Application + v142 MultiByte - v141 Application + v142 MultiByte - v141 Application + v142 MultiByte - v141 Application + v142 MultiByte - v141 Application + v142 MultiByte - v141 - - + + + - + - + - + - + - + - + - + - + - + - + - + - + - + - <_ProjectFileVersion>15.0.28307.799 - TestSuited - TestSuited - TestSuited - TestSuite - TestSuite - TestSuite - TestSuited - TestSuited - TestSuited - TestSuite - TestSuite - TestSuite + <_ProjectFileVersion>16.0.32602.291 bin\ @@ -243,11 +232,11 @@ true true true - + Level3 ProgramDatabase Default - true + /Zc:__cplusplus %(AdditionalOptions) CppUnitd.lib;iphlpapi.lib;ws2_32.lib;%(AdditionalDependencies) @@ -275,11 +264,11 @@ true true true - + Level3 - + Default - true + /Zc:__cplusplus %(AdditionalOptions) CppUnit.lib;iphlpapi.lib;ws2_32.lib;%(AdditionalDependencies) @@ -304,11 +293,11 @@ true true true - + Level3 ProgramDatabase Default - true + /Zc:__cplusplus %(AdditionalOptions) CppUnitmtd.lib;iphlpapi.lib;winmm.lib;iphlpapi.lib;ws2_32.lib;%(AdditionalDependencies) @@ -336,11 +325,11 @@ true true true - + Level3 - + Default - true + /Zc:__cplusplus %(AdditionalOptions) CppUnitmt.lib;iphlpapi.lib;winmm.lib;iphlpapi.lib;ws2_32.lib;%(AdditionalDependencies) @@ -365,11 +354,11 @@ true true true - + Level3 ProgramDatabase Default - true + /Zc:__cplusplus %(AdditionalOptions) CppUnitmdd.lib;iphlpapi.lib;winmm.lib;iphlpapi.lib;ws2_32.lib;%(AdditionalDependencies) @@ -397,11 +386,11 @@ true true true - + Level3 - + Default - true + /Zc:__cplusplus %(AdditionalOptions) CppUnitmd.lib;iphlpapi.lib;winmm.lib;iphlpapi.lib;ws2_32.lib;%(AdditionalDependencies) @@ -426,11 +415,11 @@ true true true - + Level3 ProgramDatabase Default - true + /Zc:__cplusplus %(AdditionalOptions) CppUnitd.lib;iphlpapi.lib;ws2_32.lib;%(AdditionalDependencies) @@ -458,11 +447,11 @@ true true true - + Level3 - + Default - true + /Zc:__cplusplus %(AdditionalOptions) CppUnit.lib;iphlpapi.lib;ws2_32.lib;%(AdditionalDependencies) @@ -487,11 +476,11 @@ true true true - + Level3 ProgramDatabase Default - true + /Zc:__cplusplus %(AdditionalOptions) CppUnitmtd.lib;iphlpapi.lib;winmm.lib;iphlpapi.lib;ws2_32.lib;%(AdditionalDependencies) @@ -519,11 +508,11 @@ true true true - + Level3 - + Default - true + /Zc:__cplusplus %(AdditionalOptions) CppUnitmt.lib;iphlpapi.lib;winmm.lib;iphlpapi.lib;ws2_32.lib;%(AdditionalDependencies) @@ -548,11 +537,11 @@ true true true - + Level3 ProgramDatabase Default - true + /Zc:__cplusplus %(AdditionalOptions) CppUnitmdd.lib;iphlpapi.lib;winmm.lib;iphlpapi.lib;ws2_32.lib;%(AdditionalDependencies) @@ -580,11 +569,11 @@ true true true - + Level3 - + Default - true + /Zc:__cplusplus %(AdditionalOptions) CppUnitmd.lib;iphlpapi.lib;winmm.lib;iphlpapi.lib;ws2_32.lib;%(AdditionalDependencies) @@ -598,268 +587,143 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - + + + + \ No newline at end of file diff --git a/Net/testsuite/TestSuite_vs150.vcxproj.filters b/Net/testsuite/TestSuite_vs150.vcxproj.filters index 81f19d736..13de61ede 100644 --- a/Net/testsuite/TestSuite_vs150.vcxproj.filters +++ b/Net/testsuite/TestSuite_vs150.vcxproj.filters @@ -2,172 +2,172 @@ - {622ba277-a191-45e4-be4d-b0c9634aae2a} + {290e910f-8258-482f-9444-16beac6e8da3} - {b988e6c9-804a-4688-a317-b2ec7fb6a1d6} + {4a904fa7-e6c6-4173-8b6f-538f7011c389} - {1c8d6d1a-2a86-4319-825d-57d72ed5be7e} + {1f6d881a-3685-4d80-a9ec-a5ed1660dfdb} - {161f9d3f-3600-4728-bc5e-316da9795ff8} + {e221b87f-30a8-49a9-9913-39760f197805} - {ac02c0d6-c130-4249-9b88-e1e2241528ed} + {7cf9ccff-a805-4512-8a1a-b02511c4e443} - {c8b1d3f2-67be-4b6c-9a3e-c7f681204369} + {10e98ffb-4de6-46ea-a0bb-0136bb0ac541} - {fca74574-ebb7-4b9d-8107-0160aad38a51} + {778e7c83-88d8-4fec-b178-11de58a4cc18} - {4a90f67a-ce30-493b-bc2d-fdb4ec6022a0} + {1b9ce3a8-6b4e-4d8a-94f6-dcde75d07c04} - {79e1d000-adea-47a6-80b2-2e1eb656f37f} + {644af349-0b06-4eb7-b593-5015d66f5ea4} - {f792bde2-f64f-4641-826b-73565b73d7c8} + {c44a7148-b373-4287-aac4-3f800da2f36f} - {7fd6b663-b256-4344-b727-a10bd3969a3f} + {b7235bf9-72ad-4fef-8b0a-e49dad072eeb} - {7011dda2-614e-4220-b8fe-37fb957e491f} + {bbb73ac5-7e6e-4e2d-a72f-af82c3b97e5c} - {dc379e2f-3309-4627-b249-64837bea0684} + {aec2c1cd-fba3-4ad1-b227-121a553491ac} - {35f107fb-8aed-42dc-a048-0b7cfe2a8358} + {61025c01-83bd-4572-aeae-9367d7d029d8} - {44aa1462-1a4b-4432-92a1-99689bc524dd} + {4532ba47-8663-49e4-a208-1a63254570d3} - {a997bdca-0c5c-420e-954d-1245fe0af3a9} + {2510c98e-d78b-454d-a518-160f36fe3cab} - {378356d8-4f3f-423d-8bfa-d1ecce02dd60} + {de242425-0e01-4efa-9629-ba2079bcc816} - {37b2db36-1de3-434d-a5ee-b91d685dc225} + {dcdd9571-2c90-417d-961c-3a4373e20ea5} - {cb9f5c49-610a-4737-8b83-0f3e687efbb2} + {6c26b55a-c819-4c0c-ae62-be7ff7875525} - {71f8d2a9-361b-4e88-b9ed-8e974d03d6c5} + {48e74379-019f-45ce-b88d-e9eb34955fb2} - {2e959e74-d55d-450a-8860-6db234dd4916} + {afb2660e-c61b-400e-8aea-c612d4cdec99} - {804e9b7e-c1b1-4cb8-ad14-b159de2c4e53} + {25447d16-2852-4ffa-8641-058d8a8714ec} - {ebc9766b-4375-4a56-9469-5c29c730607f} + {8372e21b-8bba-48ab-83f7-9723f2f2fab1} - {0a95781f-7fcc-4a8c-b21b-6666392f150c} + {8dee9d15-149d-41d7-8b62-adea2d7fbb8a} - {8d731e3a-6f29-448a-b27c-95c557bd9d85} + {530a5492-9ca0-4fa1-bc16-7e15934bb8b6} - {6c343779-354c-4581-93c8-8a39316eaef7} + {2abd606b-ad40-4d19-96be-ba1374072dbe} - {f01cd53d-2f73-4ea5-9864-caa20ce1429b} + {fc2f5bcd-9f4c-4a06-b007-dce030807554} - {bca2d7d7-6ee8-45dd-965a-969097c0cbbd} + {396845b8-a119-4a50-bf3b-d1a94853418b} - {e6446708-9ff2-4aee-b43d-b36cf779619b} + {4775fa31-630f-4d52-9359-0bab007ddd7d} - {10fe3129-3d2e-4529-b7ed-9f80378cc34e} + {59d03fab-bae2-4170-98f7-b3a925c1840e} - {dcf405bb-f42a-402c-93d5-6c6499d9560d} + {16eb65ae-abb8-4989-b834-f570460f30ef} - {947205b8-420a-4c55-93bb-8f0fbf91a0df} + {996f2e17-a2ba-4598-9ef7-e58f897ac278} - {74eb0a31-b0d6-499a-94c3-3b7311b95e60} + {eb864551-1c2a-495e-aa3e-0262730dd0e6} - {72e6e2a6-e072-48cd-9ce9-ace17c4ccffb} + {b0abac34-aeb8-41cd-ab7e-3626276b9ee2} - {c8a70797-7336-4edf-baa5-82987ea81a2e} + {54bca9f4-4378-4592-9d0a-af77106fca40} - {2207a262-010d-46f1-b374-49be8dc6ed45} + {4e133413-bcd2-4103-80c2-771d8dfdc91a} - {283db660-d575-4df5-9bff-541801664ebe} + {02367186-7405-446d-9dc5-891132d42db4} - {073b550b-d77e-41b7-977f-004a21501922} + {bbed8613-dd56-4a17-b348-af006ab53409} - {b3c92e30-fbb0-4cd0-a2ea-107fe77799df} + {5c3ca180-da38-4c58-8077-24dd8ebe341e} - {f560cb9a-5e6d-4886-9d98-51b551c23a27} + {36dfcf1e-50e5-4c3d-8a2e-32a75459a7e0} - {d5d1c60e-abb4-48c6-9c6f-adb0a11e47db} + {4155e5cb-4a0c-4560-a154-c16beecaeab4} - {8e4804ca-223b-48f2-ac89-fbacc8c250ef} + {6f6117b9-7360-45b2-981a-f06201e6ca49} - {e6e23ca2-4c0b-4cb5-ab56-492808cdc4c4} + {078a34f5-1313-4574-8b92-ca4a388ca80c} - {1e2d9162-aeb9-4c6f-87f4-e2fd921fead3} + {6b740033-bb39-4920-acef-a76d6ce88a70} - {1aec120d-a164-4801-8ce8-2a07c66e949b} + {4bbf234e-cf92-4479-82a1-4bf9af8bfb60} - {fc560f2a-0deb-4b0e-89e9-a9cc45efb839} + {6f6e02af-41f6-412f-82b7-6928f5976b6a} - {60126318-8b4e-40b0-abef-596fb8325889} + {1393cc9f-6050-4319-bab9-ca1ae65785d0} - {fd382fec-1d47-4a46-b748-cadbd24b328d} + {d521fa10-cecc-4d3d-8bcb-7bc73d1042b2} - {93aec30b-4d67-4e45-bf30-5009162a00a8} + {86efaf92-eb90-4a72-a50c-89f6c89aff32} - {091ca473-b07f-440d-8529-ff49698f165a} + {c524f2ed-f837-4acb-b23f-f3342fcf8b6b} - {d812eedb-b616-448f-af07-6a13f0d82117} + {cc4f1641-fa20-4172-b5b1-8413c8adcbcc} - {63a2c039-855d-476c-8b25-f6e12802831f} + {47f2c663-e455-4592-be01-779bd9bb8b76} - {c15f795b-fe8e-4f77-88f4-c61ca7771e0f} + {105ec9a8-1095-491e-823d-4f287d485494} - {33883842-d74a-4b75-ae61-26e7877c77e1} + {594da4c8-0d41-4708-9ac0-c86c1ac1057c} - {3e6c33d7-2d63-48e9-b78c-acf9bc745ca4} + {d4700240-6db5-4dc7-b33b-2f9aa1d661a9} - {3cdaed90-d152-4ce6-a0a8-6978a3b6e2d6} + {38d0073f-e94b-4703-8156-9c2bc62bc24f} @@ -309,6 +309,12 @@ Reactor\Header Files + + Reactor\Header Files + + + Reactor\Header Files + Mail\Header Files @@ -506,6 +512,12 @@ Reactor\Source Files + + Reactor\Source Files + + + Reactor\Source Files + Mail\Source Files diff --git a/Net/testsuite/TestSuite_vs160.vcxproj b/Net/testsuite/TestSuite_vs160.vcxproj index 8e913a5eb..5db41bb88 100644 --- a/Net/testsuite/TestSuite_vs160.vcxproj +++ b/Net/testsuite/TestSuite_vs160.vcxproj @@ -55,121 +55,111 @@ {D5EFBF27-B934-4B8D-8AE5-6EC00374819C} TestSuite Win32Proj + 10.0 Application - MultiByte v142 + MultiByte Application - MultiByte v142 + MultiByte Application - MultiByte v142 + MultiByte Application - MultiByte v142 + MultiByte Application - MultiByte v142 + MultiByte Application - MultiByte v142 + MultiByte Application - MultiByte v142 + MultiByte Application - MultiByte v142 + MultiByte Application - MultiByte v142 + MultiByte Application - MultiByte v142 + MultiByte Application - MultiByte v142 + MultiByte Application - MultiByte v142 + MultiByte - + + - + - + - + - + - + - + - + - + - + - + - + - + - <_ProjectFileVersion>15.0.28307.799 - TestSuited - TestSuited - TestSuited - TestSuite - TestSuite - TestSuite - TestSuited - TestSuited - TestSuited - TestSuite - TestSuite - TestSuite + <_ProjectFileVersion>16.0.32602.291 bin\ @@ -205,6 +195,7 @@ bin64\ obj64\TestSuite\$(Configuration)\ true + $(ProjectName)d bin64\ @@ -215,6 +206,7 @@ bin64\static_mt\ obj64\TestSuite\$(Configuration)\ true + $(ProjectName)d bin64\static_mt\ @@ -225,6 +217,7 @@ bin64\static_md\ obj64\TestSuite\$(Configuration)\ true + $(ProjectName)d bin64\static_md\ @@ -247,7 +240,7 @@ Level3 ProgramDatabase Default - true + /Zc:__cplusplus %(AdditionalOptions) CppUnitd.lib;iphlpapi.lib;ws2_32.lib;%(AdditionalDependencies) @@ -279,7 +272,7 @@ Level3 Default - true + /Zc:__cplusplus %(AdditionalOptions) CppUnit.lib;iphlpapi.lib;ws2_32.lib;%(AdditionalDependencies) @@ -308,7 +301,7 @@ Level3 ProgramDatabase Default - true + /Zc:__cplusplus %(AdditionalOptions) CppUnitmtd.lib;iphlpapi.lib;winmm.lib;iphlpapi.lib;ws2_32.lib;%(AdditionalDependencies) @@ -340,7 +333,7 @@ Level3 Default - true + /Zc:__cplusplus %(AdditionalOptions) CppUnitmt.lib;iphlpapi.lib;winmm.lib;iphlpapi.lib;ws2_32.lib;%(AdditionalDependencies) @@ -369,7 +362,7 @@ Level3 ProgramDatabase Default - true + /Zc:__cplusplus %(AdditionalOptions) CppUnitmdd.lib;iphlpapi.lib;winmm.lib;iphlpapi.lib;ws2_32.lib;%(AdditionalDependencies) @@ -401,7 +394,7 @@ Level3 Default - true + /Zc:__cplusplus %(AdditionalOptions) CppUnitmd.lib;iphlpapi.lib;winmm.lib;iphlpapi.lib;ws2_32.lib;%(AdditionalDependencies) @@ -430,7 +423,7 @@ Level3 ProgramDatabase Default - true + /Zc:__cplusplus %(AdditionalOptions) CppUnitd.lib;iphlpapi.lib;ws2_32.lib;%(AdditionalDependencies) @@ -462,7 +455,7 @@ Level3 Default - true + /Zc:__cplusplus %(AdditionalOptions) CppUnit.lib;iphlpapi.lib;ws2_32.lib;%(AdditionalDependencies) @@ -491,7 +484,7 @@ Level3 ProgramDatabase Default - true + /Zc:__cplusplus %(AdditionalOptions) CppUnitmtd.lib;iphlpapi.lib;winmm.lib;iphlpapi.lib;ws2_32.lib;%(AdditionalDependencies) @@ -523,7 +516,7 @@ Level3 Default - true + /Zc:__cplusplus %(AdditionalOptions) CppUnitmt.lib;iphlpapi.lib;winmm.lib;iphlpapi.lib;ws2_32.lib;%(AdditionalDependencies) @@ -552,7 +545,7 @@ Level3 ProgramDatabase Default - true + /Zc:__cplusplus %(AdditionalOptions) CppUnitmdd.lib;iphlpapi.lib;winmm.lib;iphlpapi.lib;ws2_32.lib;%(AdditionalDependencies) @@ -584,7 +577,7 @@ Level3 Default - true + /Zc:__cplusplus %(AdditionalOptions) CppUnitmd.lib;iphlpapi.lib;winmm.lib;iphlpapi.lib;ws2_32.lib;%(AdditionalDependencies) @@ -650,6 +643,7 @@ + @@ -665,203 +659,75 @@ - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - + + + + + + + + + + + + - + + \ No newline at end of file diff --git a/Net/testsuite/TestSuite_vs160.vcxproj.filters b/Net/testsuite/TestSuite_vs160.vcxproj.filters index 5d348b9cf..1c7f3f10a 100644 --- a/Net/testsuite/TestSuite_vs160.vcxproj.filters +++ b/Net/testsuite/TestSuite_vs160.vcxproj.filters @@ -2,172 +2,172 @@ - {5404fe11-1839-42cf-b51b-5e9b1bf04564} + {53fd487f-2676-4967-a2a7-03b704c0b2de} - {10186ea1-7b50-4382-a510-7b7827a7207c} + {516fb5e1-8cf9-4ecd-a016-b6e10fc2c37c} - {ae58791f-549f-4b44-a83e-1c8e981425d9} + {d8c95e87-ade7-4419-a06a-fdfcfce4fe6d} - {b5e10af2-6504-4d51-b9bb-8fdcc895740e} + {7a5827fe-8acc-4f3c-8692-b3d594b359b5} - {83d98686-03a5-4c51-834e-c617171b2372} + {9255dd72-ea8a-4e1e-81e7-3c875eefdec6} - {7c7b7a3c-be0a-4c00-b81d-8d5636a94767} + {2dda66a2-f4e4-440a-afdd-d01f7bc9d779} - {85626f7e-1bc7-4e2a-bded-b47552f95574} + {af7d82b7-2fb1-4e84-be01-5dcc55bbaab5} - {e08a68c0-01cd-4753-958b-f4f6e5d27627} + {cebe1f99-a8e2-474e-8f97-4e0deb76d4e2} - {bd610a87-2c11-4b32-9bd9-042a244125fc} + {8b218087-b39e-4f83-88d2-6440161def24} - {dec36758-f59d-4e4c-a25f-60302fb31b87} + {d447b532-a865-48cf-9ab7-5e5471653547} - {2ddff7b2-4071-4aa1-abbd-2756fcbc8795} + {2a1c04e4-eadc-461e-80a8-b2d0e921cf87} - {f2c1ecd0-fd56-4db2-b974-2b354f181b85} + {3214b8b1-8f0e-4b9d-83fb-07c424d6b9fd} - {d986b7e9-9850-43e6-bb62-35b020b45498} + {18793768-dc13-4502-9916-21105a7cb752} - {78d5fa55-df7f-4ac0-acc3-84eb2c3f2790} + {f069db00-db25-4150-8e1f-c0af5bad1f37} - {37a26ed5-0669-4b93-b073-4ad2ddd74711} + {abfaed51-e6e2-45d6-b56e-f22041a93a96} - {3b5a355c-5a87-48ea-99ff-90d03acdc416} + {0d97ae05-fa3d-46a5-b9f5-9999364adce4} - {408f258a-a4b2-4a72-8e60-f4ef1e332f3a} + {eca271a2-792a-446e-9863-58da5df28303} - {8e863afc-c74d-4bf8-97d6-7d18904b3508} + {fb487ff6-3078-453e-8530-e732a4d1d817} - {fb04e1c3-43c7-48e4-89d2-44d6d94dc04d} + {13f19f92-6293-49f0-a29b-4f0a7c9049b0} - {44d881cd-afce-4c66-8d8a-dcd23d2d87e1} + {f67598c3-fb04-4e5a-8967-8e4fa6d69991} - {5c5e3271-c1f7-4c28-8ead-aa6e9bee6748} + {f25a3880-7801-4fa5-8298-264b47d80000} - {c4a7c94f-7e34-4cd6-a241-950f0741556f} + {9d76fb63-54da-414a-b7f0-d403e1b254c6} - {aa27a296-ccc2-4c88-adf3-42adc36260e8} + {1efeb7d9-1286-4f1f-9b95-6d1d6c85ea98} - {55bb0826-ebfa-4cf2-a47a-ae75b9cdeed9} + {86b0151e-5611-49f7-940d-7d51dbb5ffdb} - {fa6cf3da-cf9d-4bef-8db7-152f22829f4d} + {2014a214-4ce1-4586-b2f0-fbf446656b51} - {9e2454f2-772e-4427-98f4-f0f4ce0c6925} + {177ff2b8-6ea0-4934-90b0-6bfcb43b33fb} - {b6d09883-3564-495d-b791-2e40a176fc61} + {29921df4-4cbe-4a95-8b87-5b93fd622347} - {e6aafcd8-9d02-4bbb-83c5-ea9ad3fef134} + {a45359a5-54f6-4d4b-be8b-ae3b8dced668} - {e3a724a8-20a5-429e-9d40-8858a9d01f0c} + {db1d37ec-aeb6-42b3-9302-7d6213e4c815} - {33437c8a-12d1-4e8b-b07c-a3f323fd0c20} + {880cdbfb-4a7d-414d-81f4-84322cee68d6} - {6868bd64-4e26-4f39-9b08-2f91808366df} + {6ed029e8-dab3-4e45-a98e-93e8c69b5d20} - {e74c2849-e607-4bb4-87e6-64afebdeb545} + {20aa36ea-0003-40e3-911d-c27e334c26aa} - {13e2d91e-f72a-4514-9583-e4dc6b9689b4} + {ad1e0d55-8e93-4aed-ab53-395508e46fa0} - {cc0ac382-4e88-4138-8024-ad74e9afc620} + {e4853f2d-f5ba-4530-b80b-b3574ba1b14a} - {47311622-fec5-4776-9a58-6fbd1e3483f8} + {e92f0ed4-f1d6-4d86-b06d-53cabd2060cf} - {aea5befd-5e2a-447c-b18e-2740e2acee4f} + {6baccd42-42f4-4011-b547-933596a9b0b6} - {36e4ed28-695d-459a-a3f7-2c2721fe2436} + {581033ad-1413-4513-b59a-76ba2999de52} - {722b1dd1-df29-4355-a6f5-1f815c8a725b} + {1e120667-12e0-41aa-9511-65af1e58926e} - {dbac1bff-a6c6-4df1-bdb4-5735cf8449eb} + {d732dcf8-c864-46e9-b45b-55a7e24d1b43} - {79c4656f-eeb7-4c3d-8407-1248c85ed8e4} + {909393dd-fb39-4ab0-a722-aa7f6de11cf8} - {365c6961-c825-4a86-8174-a94127246964} + {346e5744-d004-49dc-b458-763fcd9f6f71} - {915093c8-89bb-447f-9c20-b3201217d614} + {fb1908e7-d097-45a7-beef-6dfa987d6bfa} - {2463d6e8-5890-47c3-ade5-eabaf4f28d28} + {70db2cb7-ffe6-42df-8d38-3eb12383d3c0} - {76b06a55-58f5-4882-99f1-d4090e04749a} + {d653c743-ee5e-4b93-bbe4-e154d8d9778d} - {658b80fd-2488-4dca-b6a5-5a611a7ce819} + {755c1410-2d17-4eb1-ae61-d416cf1a5b34} - {46be7d47-7ac6-4967-b70d-00c565725876} + {a57af3da-3ad2-4bf1-8d10-4ef8df41d997} - {113f49c9-3a26-4e27-a74a-8e06ddfe3bce} + {5df76de3-d2ac-4f1b-9b9f-82ce3fe6ce06} - {203af477-d3f1-4677-a83d-043d0b814a9e} + {a3a99cec-32d7-4704-8565-62dcf797313c} - {60f8307a-59f6-43c9-a2a3-7c088bc6fa48} + {1758efec-b615-44ef-8417-3087fb9091ea} - {205fd53a-8f6d-43fc-9cbc-a515103cceab} + {00b8eabe-ae9c-497c-965e-62229383592d} - {716a737b-4d0a-4cca-80e1-1fe840cf7024} + {8cc8c65f-b368-4983-9aef-3dab61c9ad3d} - {aaf8c364-18ba-44e2-a505-277d026c6cb2} + {fe25499b-238e-4292-97a1-7458c20a4a50} - {80ea117a-55f1-482e-898a-aae547fe7052} + {4eccce17-da55-4526-a731-fa0bc0f3cd75} - {2c91a081-22d1-488b-a95d-1679abf51bb0} + {3b047729-6bc6-4a63-93d7-e2bb260bef8b} - {ba630b21-48b6-43d2-a754-91edddd56cc6} + {e2abacf9-a055-40a8-9727-a02f2c6ba204} - {6b80eeab-e573-445f-ae9c-5c3825660733} + {9cc59d00-7e95-4008-962b-5a2ee827c0b2} @@ -309,6 +309,12 @@ Reactor\Header Files + + Reactor\Header Files + + + Reactor\Header Files + Mail\Header Files @@ -363,9 +369,6 @@ UDP\Header Files - - Sockets\Header Files - @@ -509,6 +512,12 @@ Reactor\Source Files + + Reactor\Source Files + + + Reactor\Source Files + Mail\Source Files @@ -563,8 +572,5 @@ UDP\Source Files - - Sockets\Source Files - \ No newline at end of file diff --git a/Net/testsuite/TestSuite_vs170.vcxproj b/Net/testsuite/TestSuite_vs170.vcxproj index 37776ef01..0d63842aa 100644 --- a/Net/testsuite/TestSuite_vs170.vcxproj +++ b/Net/testsuite/TestSuite_vs170.vcxproj @@ -1,10 +1,6 @@ - - + + - - debug_shared - ARM64 - debug_shared Win32 @@ -13,10 +9,6 @@ debug_shared x64 - - debug_static_md - ARM64 - debug_static_md Win32 @@ -25,10 +17,6 @@ debug_static_md x64 - - debug_static_mt - ARM64 - debug_static_mt Win32 @@ -37,10 +25,6 @@ debug_static_mt x64 - - release_shared - ARM64 - release_shared Win32 @@ -49,10 +33,6 @@ release_shared x64 - - release_static_md - ARM64 - release_static_md Win32 @@ -61,10 +41,6 @@ release_static_md x64 - - release_static_mt - ARM64 - release_static_mt Win32 @@ -75,210 +51,114 @@ - 17.0 TestSuite {D5EFBF27-B934-4B8D-8AE5-6EC00374819C} TestSuite Win32Proj - + Application + v142 MultiByte - v143 Application + v142 MultiByte - v143 Application + v142 MultiByte - v143 Application + v142 MultiByte - v143 Application + v142 MultiByte - v143 Application + v142 MultiByte - v143 - - - Application - MultiByte - v143 - - - Application - MultiByte - v143 - - - Application - MultiByte - v143 - - - Application - MultiByte - v143 - - - Application - MultiByte - v143 - - - Application - MultiByte - v143 Application + v142 MultiByte - v143 Application + v142 MultiByte - v143 Application + v142 MultiByte - v143 Application + v142 MultiByte - v143 Application + v142 MultiByte - v143 Application + v142 MultiByte - v143 - - + + + - + - + - + - + - + - - - - - - - - - - - - - - - - - - - + - + - + - + - + - + - + - + - <_ProjectFileVersion>17.0.32505.173 - TestSuited - TestSuited - TestSuited - TestSuite - TestSuite - TestSuite - TestSuited - TestSuited - TestSuited - TestSuite - TestSuite - TestSuite - TestSuited - TestSuited - TestSuited - TestSuite - TestSuite - TestSuite - - - binA64\ - objA64\TestSuite\$(Configuration)\ - true - - - binA64\ - objA64\TestSuite\$(Configuration)\ - false - - - binA64\static_mt\ - objA64\TestSuite\$(Configuration)\ - true - - - binA64\static_mt\ - objA64\TestSuite\$(Configuration)\ - false - - - binA64\static_md\ - objA64\TestSuite\$(Configuration)\ - true - - - binA64\static_md\ - objA64\TestSuite\$(Configuration)\ - false + <_ProjectFileVersion>16.0.32602.291 bin\ @@ -340,189 +220,6 @@ obj64\TestSuite\$(Configuration)\ false - - - Disabled - ..\include;..\..\CppUnit\include;..\..\Foundation\include;%(AdditionalIncludeDirectories) - WIN32;_DEBUG;_WINDOWS;WINVER=0x0600;%(PreprocessorDefinitions) - true - EnableFastChecks - MultiThreadedDebugDLL - true - true - true - true - - Level3 - ProgramDatabase - Default - true - - - CppUnitd.lib;iphlpapi.lib;ws2_32.lib;%(AdditionalDependencies) - binA64\TestSuited.exe - ..\..\libA64;%(AdditionalLibraryDirectories) - true - true - binA64\TestSuited.pdb - Console - MachineARM64 - - - - - MaxSpeed - OnlyExplicitInline - true - Speed - true - ..\include;..\..\CppUnit\include;..\..\Foundation\include;%(AdditionalIncludeDirectories) - WIN32;NDEBUG;_WINDOWS;WINVER=0x0600;%(PreprocessorDefinitions) - true - MultiThreadedDLL - false - true - true - true - - Level3 - - Default - true - - - CppUnit.lib;iphlpapi.lib;ws2_32.lib;%(AdditionalDependencies) - binA64\TestSuite.exe - ..\..\libA64;%(AdditionalLibraryDirectories) - false - Console - true - true - MachineARM64 - - - - - Disabled - ..\include;..\..\CppUnit\include;..\..\Foundation\include;%(AdditionalIncludeDirectories) - WIN32;_DEBUG;_WINDOWS;WINVER=0x0600;POCO_STATIC;%(PreprocessorDefinitions) - true - EnableFastChecks - MultiThreadedDebug - true - true - true - true - - Level3 - ProgramDatabase - Default - true - - - CppUnitmtd.lib;iphlpapi.lib;winmm.lib;iphlpapi.lib;ws2_32.lib;%(AdditionalDependencies) - binA64\static_mt\TestSuited.exe - ..\..\libA64;%(AdditionalLibraryDirectories) - true - true - binA64\static_mt\TestSuited.pdb - Console - MachineARM64 - - - - - MaxSpeed - OnlyExplicitInline - true - Speed - true - ..\include;..\..\CppUnit\include;..\..\Foundation\include;%(AdditionalIncludeDirectories) - WIN32;NDEBUG;_WINDOWS;WINVER=0x0600;POCO_STATIC;%(PreprocessorDefinitions) - true - MultiThreaded - false - true - true - true - - Level3 - - Default - true - - - CppUnitmt.lib;iphlpapi.lib;winmm.lib;iphlpapi.lib;ws2_32.lib;%(AdditionalDependencies) - binA64\static_mt\TestSuite.exe - ..\..\libA64;%(AdditionalLibraryDirectories) - false - Console - true - true - MachineARM64 - - - - - Disabled - ..\include;..\..\CppUnit\include;..\..\Foundation\include;%(AdditionalIncludeDirectories) - WIN32;_DEBUG;_WINDOWS;WINVER=0x0600;POCO_STATIC;%(PreprocessorDefinitions) - true - EnableFastChecks - MultiThreadedDebugDLL - true - true - true - true - - Level3 - ProgramDatabase - Default - true - - - CppUnitmdd.lib;iphlpapi.lib;winmm.lib;iphlpapi.lib;ws2_32.lib;%(AdditionalDependencies) - binA64\static_md\TestSuited.exe - ..\..\libA64;%(AdditionalLibraryDirectories) - true - true - binA64\static_md\TestSuited.pdb - Console - MachineARM64 - - - - - MaxSpeed - OnlyExplicitInline - true - Speed - true - ..\include;..\..\CppUnit\include;..\..\Foundation\include;%(AdditionalIncludeDirectories) - WIN32;NDEBUG;_WINDOWS;WINVER=0x0600;POCO_STATIC;%(PreprocessorDefinitions) - true - MultiThreadedDLL - false - true - true - true - - Level3 - - Default - true - - - CppUnitmd.lib;iphlpapi.lib;winmm.lib;iphlpapi.lib;ws2_32.lib;%(AdditionalDependencies) - binA64\static_md\TestSuite.exe - ..\..\libA64;%(AdditionalLibraryDirectories) - false - Console - true - true - MachineARM64 - - Disabled @@ -535,11 +232,11 @@ true true true - + Level3 ProgramDatabase Default - true + /Zc:__cplusplus %(AdditionalOptions) CppUnitd.lib;iphlpapi.lib;ws2_32.lib;%(AdditionalDependencies) @@ -567,11 +264,11 @@ true true true - + Level3 - + Default - true + /Zc:__cplusplus %(AdditionalOptions) CppUnit.lib;iphlpapi.lib;ws2_32.lib;%(AdditionalDependencies) @@ -596,11 +293,11 @@ true true true - + Level3 ProgramDatabase Default - true + /Zc:__cplusplus %(AdditionalOptions) CppUnitmtd.lib;iphlpapi.lib;winmm.lib;iphlpapi.lib;ws2_32.lib;%(AdditionalDependencies) @@ -628,11 +325,11 @@ true true true - + Level3 - + Default - true + /Zc:__cplusplus %(AdditionalOptions) CppUnitmt.lib;iphlpapi.lib;winmm.lib;iphlpapi.lib;ws2_32.lib;%(AdditionalDependencies) @@ -657,11 +354,11 @@ true true true - + Level3 ProgramDatabase Default - true + /Zc:__cplusplus %(AdditionalOptions) CppUnitmdd.lib;iphlpapi.lib;winmm.lib;iphlpapi.lib;ws2_32.lib;%(AdditionalDependencies) @@ -689,11 +386,11 @@ true true true - + Level3 - + Default - true + /Zc:__cplusplus %(AdditionalOptions) CppUnitmd.lib;iphlpapi.lib;winmm.lib;iphlpapi.lib;ws2_32.lib;%(AdditionalDependencies) @@ -718,11 +415,11 @@ true true true - + Level3 ProgramDatabase Default - true + /Zc:__cplusplus %(AdditionalOptions) CppUnitd.lib;iphlpapi.lib;ws2_32.lib;%(AdditionalDependencies) @@ -750,11 +447,11 @@ true true true - + Level3 - + Default - true + /Zc:__cplusplus %(AdditionalOptions) CppUnit.lib;iphlpapi.lib;ws2_32.lib;%(AdditionalDependencies) @@ -779,11 +476,11 @@ true true true - + Level3 ProgramDatabase Default - true + /Zc:__cplusplus %(AdditionalOptions) CppUnitmtd.lib;iphlpapi.lib;winmm.lib;iphlpapi.lib;ws2_32.lib;%(AdditionalDependencies) @@ -811,11 +508,11 @@ true true true - + Level3 - + Default - true + /Zc:__cplusplus %(AdditionalOptions) CppUnitmt.lib;iphlpapi.lib;winmm.lib;iphlpapi.lib;ws2_32.lib;%(AdditionalDependencies) @@ -840,11 +537,11 @@ true true true - + Level3 ProgramDatabase Default - true + /Zc:__cplusplus %(AdditionalOptions) CppUnitmdd.lib;iphlpapi.lib;winmm.lib;iphlpapi.lib;ws2_32.lib;%(AdditionalDependencies) @@ -872,11 +569,11 @@ true true true - + Level3 - + Default - true + /Zc:__cplusplus %(AdditionalOptions) CppUnitmd.lib;iphlpapi.lib;winmm.lib;iphlpapi.lib;ws2_32.lib;%(AdditionalDependencies) @@ -890,272 +587,143 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - + + + + \ No newline at end of file diff --git a/Net/testsuite/TestSuite_vs170.vcxproj.filters b/Net/testsuite/TestSuite_vs170.vcxproj.filters index 9ad128be3..27fd2ff29 100644 --- a/Net/testsuite/TestSuite_vs170.vcxproj.filters +++ b/Net/testsuite/TestSuite_vs170.vcxproj.filters @@ -2,172 +2,172 @@ - {80a23f01-4531-4f3b-a8ca-fe78c03b1408} + {5898fe55-dfe8-4fad-900f-dcd04462a0c2} - {b305921d-e7cf-4a81-99e3-adfe8d0a537c} + {43c7eeb4-ced2-4ebc-bf9f-abe4be4895ab} - {dccbf492-f74a-4d6c-bb87-8003ff3a9e9d} + {d26ecae9-0e0d-45b6-99d3-1142cb32f630} - {07b95595-e829-42ef-b837-8cad68d8f193} + {bc7094c1-8e74-47ea-b871-b61955140557} - {0fc30d77-4358-4f87-90c0-d714a0eb19b9} + {630ef8f5-3181-4709-96ab-a815a2e755fe} - {f0f54f17-cada-443d-9d03-7b1418289ed8} + {dc933a23-00a1-40b0-bb5a-762bfc148d38} - {dcb3c123-083f-4ee0-98be-799a2d2366fd} + {35dc52d3-d793-40d9-9903-167f9e1388f1} - {1b435f0d-5fa5-431f-bd17-766e2a2459cd} + {703a78a9-bd5a-4138-81ba-2c9db026bf7a} - {43d2f8eb-4cda-46bc-9585-3dadfc88a950} + {dfca377b-8796-4454-a62a-3041f2e788d3} - {28a66a03-7776-4eec-bba2-f87359f6d809} + {51c264aa-adf0-4eb8-9bf8-c866bd225044} - {f3b535f9-1e70-4cde-b4e9-5eb67644cd33} + {bf45d268-60ae-4920-9809-82c0010790ed} - {4bb6a7fe-876f-44a6-9e17-0333ab6c1d7f} + {c425456d-7699-4341-82b5-115f8ee92354} - {4cc8c197-7e23-4c1c-8b7a-2a2dba8de2af} + {406fa5f6-acff-46bf-a569-016ea6782bcd} - {8623dea2-813f-4205-8a6c-715b91e61a2c} + {13627793-f2cd-4319-a5bc-d1379e61b40c} - {719153b6-2c83-45f3-8cfc-fc80a73567ae} + {0450819f-2f0a-4fbc-854d-e198ddf4a4b7} - {53477182-261e-4727-8b9d-9539e7a1edff} + {7dc90e4e-d2a4-4bd9-8dd8-bffad04ea929} - {4b7f1319-a364-47f3-9ae4-8811e883a192} + {4137afc4-ef23-447d-95d4-705b74657f41} - {3ba1dd27-4c82-4eab-ad4a-5e1ed20f28bf} + {f1c60c64-df1f-4671-b37d-ebfd4024082c} - {edbb5a8c-0318-4710-b88b-ae719d68f077} + {196a5441-eb0c-4594-8b77-759f4aecbb77} - {03f9312f-dae4-4fb4-a28c-a4ce5da2624d} + {81d42834-f72e-42f3-bcf0-6836d51c0d77} - {3b810fae-162f-4bcc-8234-9fcefdba2cf6} + {90caa34a-aeae-4a42-b127-50d6935edb2c} - {21b9cc82-6773-48d4-aa63-3cff40ab1ec2} + {1ee715f9-4fe1-44c6-951b-3bbe3483855d} - {370a8827-d61e-4399-8eb2-33701b7021c4} + {4a159595-afa8-430d-b1bf-4b0ae6fbdd16} - {6c02c84c-25bc-49e1-86db-abff65560751} + {81d2a4f5-e28e-4095-a83f-8108f9bb395c} - {30c64a4d-748a-4a68-97d3-cde3e52b557d} + {ff0f6e27-8910-4aaa-9af5-52492d154fa5} - {1f3f1846-5369-4466-9418-fc889ca52f69} + {2abcf16e-584b-449f-ac3e-c4dbde721a5b} - {7ca19ff0-c7a3-4b9b-8495-c3ec1fc50a9f} + {d9aec560-798c-4a3e-80c4-1d5d977b9383} - {e042b21a-6bcf-4f43-ba85-3086cbbee2a8} + {35f6916a-c254-4edc-a684-1043af2e58ab} - {84e40084-f0b8-4a21-8904-2faa832bdd03} + {c27ebd51-1926-497f-b86d-3384dcf04501} - {d0de955f-29d4-4a81-955a-3c784c01cf7e} + {1177b06d-3bee-46cc-85e2-f9bee8e7e760} - {819ea085-061f-4ea8-9028-98568051d097} + {93dc2ca2-7f9d-4496-9129-ba8bd9199832} - {d8ccb88d-e769-47a8-b36f-9aeea80bd691} + {1a5fbd4d-5812-4f34-ba83-15db167d354c} - {a3d082d9-39ec-4c11-87f0-7f58579a359b} + {8c733b11-fa79-4428-9c73-273386e3e2be} - {e4eddd0f-9e2b-4f64-bedc-b86737d4092a} + {c60af4e0-e4fb-4cec-8230-487c9e3a6e68} - {9cfd54aa-2da9-4edf-bb59-0d602c93ccb2} + {88d7a4d0-ee5f-4b7c-a5eb-cd37404caa88} - {3b904c33-c3a2-4d87-82af-17f854c42055} + {0b4f36f2-ca3f-424d-a19a-d33b502e5dbc} - {fa8639c1-4c30-47a0-9f9c-231d40f2cb50} + {f83aea42-5063-43e2-ab9e-12088faf94cf} - {0ee3c1d2-93c4-487b-b28b-cfbb55fd6ece} + {e4400e03-0830-4e2f-9479-a0e40c267c2f} - {604f1097-7648-4148-a82c-a120fd6c188c} + {79dc0885-641a-428e-8f8d-79c1a34f97b0} - {1d707628-bf82-4192-96f9-422ee627964b} + {6d181c6d-2b48-4111-b015-bce67016b07d} - {8a697d9f-806f-459d-8c5d-7d7c932d3770} + {e424eeed-c029-46c7-a9de-b6f46f876c0d} - {20cf1891-7950-407a-a6c7-2492512d55f7} + {fb2b8256-a967-408a-96fa-d966b106675a} - {dc2a5cf2-dc5b-4241-a7b5-9609e5d967f6} + {f3187b17-6b66-4f66-ac24-6cacc376a5b7} - {e2ddc463-cabd-4107-9676-225e0e09976a} + {5469f0f3-faaf-4be3-9f9d-1fa149ce17ee} - {8d645c2f-f0ff-4fed-bab0-358fbccbacd2} + {4130e0d4-5c1f-4426-8d79-5ae3e56cff3c} - {23a616c5-b310-4469-b7b1-31af5f9e9b26} + {e9970423-72eb-48ff-95c4-270267eb1c26} - {3e6292d5-dbe3-41f5-a72f-11503458171f} + {629ca2af-b91d-47a7-9fd9-494a940f5e29} - {c6646cf7-b42b-400a-ab97-ee2ff5643b87} + {8ba7e213-7787-48eb-8804-c02b3e835c2e} - {5c950f05-6893-4d55-b76f-842d86c30521} + {42229128-e586-47d5-907b-650fb245558a} - {6abc6401-3ba5-4db7-bee7-874a0aac149e} + {ef7831d7-320f-433f-bb81-c93ab13e454d} - {8853ce9e-ec54-45cf-9ffd-65d449b53bc8} + {19193e7e-4f91-49f2-a2b9-c704d0f223bd} - {4f56fe61-0453-4599-afc4-030494d65493} + {2a4b6f63-15e3-4bec-b37c-1ee75f8aaa8c} - {ee96aa55-9832-429f-b733-d58d354cf6a3} + {fb34c5ec-de62-4084-bd7e-66d1d4d203f9} - {560db2da-4e78-4912-83e3-dd6de45228b1} + {094ff6e9-9dee-4097-836f-84f4bde51636} - {92ebe717-b3ae-404d-97cd-ee8ea4522544} + {b6e58266-3554-4dc6-addc-d8fe857fe24d} - {83c2c157-48a3-48f3-b876-ca52b860fb69} + {9b444aa7-efd0-480f-8612-262eb74366ce} @@ -309,6 +309,9 @@ Reactor\Header Files + + Reactor\Header Files + Reactor\Header Files @@ -509,6 +512,9 @@ Reactor\Source Files + + Reactor\Source Files + Reactor\Source Files diff --git a/Net/testsuite/TestSuite_vs90.vcproj b/Net/testsuite/TestSuite_vs90.vcproj index 58c4cf1ec..68d782f5e 100644 --- a/Net/testsuite/TestSuite_vs90.vcproj +++ b/Net/testsuite/TestSuite_vs90.vcproj @@ -1050,6 +1050,10 @@ RelativePath=".\src\ReactorTestSuite.h" > + + @@ -1066,6 +1070,10 @@ RelativePath=".\src\ReactorTestSuite.cpp" > + + @@ -1307,4 +1315,4 @@ - + \ No newline at end of file