mirror of
https://github.com/amnezia-vpn/OpenVPNAdapter.git
synced 2026-05-17 08:15:45 +03:00
Merge branch 'release/0.8.0'
This commit is contained in:
13
CHANGELOG.md
13
CHANGELOG.md
@@ -1,15 +1,20 @@
|
||||
# Changelog
|
||||
|
||||
## 0.8.0
|
||||
- **Added**: Configuration properties to override tls-cipher and tls-ciphersuites.
|
||||
- **Updated**: openvpn3 library to 3.6.1 version, ASIO library to 1.16.1 version.
|
||||
- **Fixed**: Broken support ot the SPM.
|
||||
|
||||
## 0.7.0
|
||||
- **Added**: An option to evaluate configuration without creating an instance of `OpenVPNAdapter`.
|
||||
- **Updated**: Class `OpenVPNProperties` renamed to `OpenVPNConfigurationEvaluation`.
|
||||
- **Updated**: openvpn3 library to 3.5.6 version, mbedTLS library to 2.7.13 version;
|
||||
- **Updated**: openvpn3 library to 3.5.6 version, mbedTLS library to 2.7.13 version.
|
||||
|
||||
## 0.6.0
|
||||
- **Updated**: Slightly changed API of the framework.
|
||||
- **Fixed**: Reading packets issue affecting on connection when network interface is changed.
|
||||
- **Fixed**: Reading packets issue affecting connection when network interface is changed.
|
||||
|
||||
## 0.5.0
|
||||
- **Added**: Swift Package Manager support;
|
||||
- **Updated**: openvpn3 library to 3.5.4 version;
|
||||
- **Added**: Swift Package Manager support.
|
||||
- **Updated**: openvpn3 library to 3.5.4 version.
|
||||
- **Fixed**: Network issue when adapter used in macOS projects.
|
||||
|
||||
@@ -3,7 +3,7 @@ Pod::Spec.new do |s|
|
||||
# ――― Spec Metadata ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
|
||||
|
||||
s.name = "OpenVPNAdapter"
|
||||
s.version = "0.7.0"
|
||||
s.version = "0.8.0"
|
||||
s.summary = "Objective-C wrapper for OpenVPN library. Compatible with iOS and macOS."
|
||||
s.description = <<-DESC
|
||||
OpenVPNAdapter is an Objective-C framework that allows to easily configure and establish VPN connection using OpenVPN protocol.
|
||||
|
||||
@@ -13,10 +13,11 @@
|
||||
C910EAEF24EBBFB60081AF13 /* ca.crt in Resources */ = {isa = PBXBuildFile; fileRef = C910EAEC24EBBFB60081AF13 /* ca.crt */; };
|
||||
C910EAF024EBBFB60081AF13 /* client.key in Resources */ = {isa = PBXBuildFile; fileRef = C910EAED24EBBFB60081AF13 /* client.key */; };
|
||||
C910EAF224EBC6F90081AF13 /* client.ovpn in Resources */ = {isa = PBXBuildFile; fileRef = C910EAF124EBC6F90081AF13 /* client.ovpn */; };
|
||||
C96B36B326888CF20054CA12 /* OpenVPNAdapterImpl.h in Headers */ = {isa = PBXBuildFile; fileRef = C96B36B226888CF20054CA12 /* OpenVPNAdapterImpl.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
C97E5F6E24122F12005C2EBC /* NSArray+OpenVPNAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = C97E5F6D24122F12005C2EBC /* NSArray+OpenVPNAdditions.h */; };
|
||||
C97E5F7024122F22005C2EBC /* NSError+OpenVPNError.h in Headers */ = {isa = PBXBuildFile; fileRef = C97E5F6F24122F22005C2EBC /* NSError+OpenVPNError.h */; };
|
||||
C97E5F7224122F5C005C2EBC /* OpenVPNClient.h in Headers */ = {isa = PBXBuildFile; fileRef = C97E5F7124122F5C005C2EBC /* OpenVPNClient.h */; };
|
||||
C97E5F7424122FE6005C2EBC /* OpenVPNAdapter.h in Headers */ = {isa = PBXBuildFile; fileRef = C97E5F7324122FE6005C2EBC /* OpenVPNAdapter.h */; };
|
||||
C97E5F7424122FE6005C2EBC /* OpenVPNAdapterImpl.h in Headers */ = {isa = PBXBuildFile; fileRef = C97E5F7324122FE6005C2EBC /* OpenVPNAdapterImpl.h */; };
|
||||
C97E5F762412300A005C2EBC /* OpenVPNAdapterEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = C97E5F752412300A005C2EBC /* OpenVPNAdapterEvent.h */; };
|
||||
C97E5F7824123019005C2EBC /* OpenVPNAdapterPacketFlow.h in Headers */ = {isa = PBXBuildFile; fileRef = C97E5F7724123019005C2EBC /* OpenVPNAdapterPacketFlow.h */; };
|
||||
C97E5F7A24123022005C2EBC /* OpenVPNCertificate.h in Headers */ = {isa = PBXBuildFile; fileRef = C97E5F7924123022005C2EBC /* OpenVPNCertificate.h */; };
|
||||
@@ -66,7 +67,7 @@
|
||||
OBJ_253 /* xxhash.c in Sources */ = {isa = PBXBuildFile; fileRef = OBJ_19 /* xxhash.c */; };
|
||||
OBJ_260 /* NSArray+OpenVPNAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = OBJ_28 /* NSArray+OpenVPNAdditions.m */; };
|
||||
OBJ_261 /* NSError+OpenVPNError.m in Sources */ = {isa = PBXBuildFile; fileRef = OBJ_29 /* NSError+OpenVPNError.m */; };
|
||||
OBJ_262 /* OpenVPNAdapter.mm in Sources */ = {isa = PBXBuildFile; fileRef = OBJ_30 /* OpenVPNAdapter.mm */; };
|
||||
OBJ_262 /* OpenVPNAdapterImpl.mm in Sources */ = {isa = PBXBuildFile; fileRef = OBJ_30 /* OpenVPNAdapterImpl.mm */; };
|
||||
OBJ_263 /* OpenVPNCertificate.m in Sources */ = {isa = PBXBuildFile; fileRef = OBJ_31 /* OpenVPNCertificate.m */; };
|
||||
OBJ_264 /* OpenVPNClient.mm in Sources */ = {isa = PBXBuildFile; fileRef = OBJ_32 /* OpenVPNClient.mm */; };
|
||||
OBJ_265 /* OpenVPNConfiguration.mm in Sources */ = {isa = PBXBuildFile; fileRef = OBJ_33 /* OpenVPNConfiguration.mm */; };
|
||||
@@ -96,7 +97,6 @@
|
||||
OBJ_291 /* OpenVPNIPv6Preference.h in Headers */ = {isa = PBXBuildFile; fileRef = OBJ_59 /* OpenVPNIPv6Preference.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
OBJ_292 /* OpenVPNAdapterPacketFlow.h in Headers */ = {isa = PBXBuildFile; fileRef = OBJ_60 /* OpenVPNAdapterPacketFlow.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
OBJ_293 /* OpenVPNMinTLSVersion.h in Headers */ = {isa = PBXBuildFile; fileRef = OBJ_61 /* OpenVPNMinTLSVersion.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
OBJ_294 /* OpenVPNAdapter.h in Headers */ = {isa = PBXBuildFile; fileRef = OBJ_62 /* OpenVPNAdapter.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
OBJ_295 /* OpenVPNConnectionInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = OBJ_63 /* OpenVPNConnectionInfo.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
OBJ_296 /* OpenVPNReachabilityStatus.h in Headers */ = {isa = PBXBuildFile; fileRef = OBJ_64 /* OpenVPNReachabilityStatus.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
OBJ_297 /* OpenVPNServerEntry.h in Headers */ = {isa = PBXBuildFile; fileRef = OBJ_65 /* OpenVPNServerEntry.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
@@ -229,15 +229,16 @@
|
||||
/* End PBXContainerItemProxy section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
C910EAE624EBB5210081AF13 /* OpenVPNConfigurationEvaluation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OpenVPNConfigurationEvaluation.h; sourceTree = "<group>"; };
|
||||
C910EAE624EBB5210081AF13 /* OpenVPNConfigurationEvaluation.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.c.h; fileEncoding = 4; path = OpenVPNConfigurationEvaluation.h; sourceTree = "<group>"; };
|
||||
C910EAEB24EBBFB60081AF13 /* client.crt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = client.crt; sourceTree = "<group>"; };
|
||||
C910EAEC24EBBFB60081AF13 /* ca.crt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = ca.crt; sourceTree = "<group>"; };
|
||||
C910EAED24EBBFB60081AF13 /* client.key */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = client.key; sourceTree = "<group>"; };
|
||||
C910EAF124EBC6F90081AF13 /* client.ovpn */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = client.ovpn; sourceTree = "<group>"; };
|
||||
C96B36B226888CF20054CA12 /* OpenVPNAdapterImpl.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.c.h; fileEncoding = 4; path = OpenVPNAdapterImpl.h; sourceTree = "<group>"; };
|
||||
C97E5F6D24122F12005C2EBC /* NSArray+OpenVPNAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSArray+OpenVPNAdditions.h"; sourceTree = "<group>"; };
|
||||
C97E5F6F24122F22005C2EBC /* NSError+OpenVPNError.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSError+OpenVPNError.h"; sourceTree = "<group>"; };
|
||||
C97E5F7124122F5C005C2EBC /* OpenVPNClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OpenVPNClient.h; sourceTree = "<group>"; };
|
||||
C97E5F7324122FE6005C2EBC /* OpenVPNAdapter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OpenVPNAdapter.h; sourceTree = "<group>"; };
|
||||
C97E5F7324122FE6005C2EBC /* OpenVPNAdapterImpl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OpenVPNAdapterImpl.h; sourceTree = "<group>"; };
|
||||
C97E5F752412300A005C2EBC /* OpenVPNAdapterEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OpenVPNAdapterEvent.h; sourceTree = "<group>"; };
|
||||
C97E5F7724123019005C2EBC /* OpenVPNAdapterPacketFlow.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OpenVPNAdapterPacketFlow.h; sourceTree = "<group>"; };
|
||||
C97E5F7924123022005C2EBC /* OpenVPNCertificate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OpenVPNCertificate.h; sourceTree = "<group>"; };
|
||||
@@ -282,7 +283,7 @@
|
||||
C97E5FDB24123F48005C2EBC /* Bundle.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Bundle.swift; sourceTree = "<group>"; };
|
||||
C9EABF3024110BE200D828D4 /* SystemConfiguration.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SystemConfiguration.framework; path = System/Library/Frameworks/SystemConfiguration.framework; sourceTree = SDKROOT; };
|
||||
C9EABF3224110E7500D828D4 /* ovpnapi.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = ovpnapi.hpp; sourceTree = "<group>"; };
|
||||
C9EABF3324110E7500D828D4 /* ovpncli.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = ovpncli.hpp; sourceTree = "<group>"; };
|
||||
C9EABF3324110E7500D828D4 /* ovpncli.hpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.h; path = ovpncli.hpp; sourceTree = "<group>"; };
|
||||
C9EABF492411133400D828D4 /* Project.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Project.xcconfig; sourceTree = "<group>"; };
|
||||
C9EABF642411189800D828D4 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.2.sdk/System/Library/Frameworks/UIKit.framework; sourceTree = DEVELOPER_DIR; };
|
||||
C9EABF7324111AEE00D828D4 /* OpenVPNClient.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = OpenVPNClient.xcconfig; sourceTree = "<group>"; };
|
||||
@@ -427,7 +428,7 @@
|
||||
OBJ_24 /* lz4frame.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = lz4frame.h; sourceTree = "<group>"; };
|
||||
OBJ_28 /* NSArray+OpenVPNAdditions.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "NSArray+OpenVPNAdditions.m"; sourceTree = "<group>"; };
|
||||
OBJ_29 /* NSError+OpenVPNError.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "NSError+OpenVPNError.m"; sourceTree = "<group>"; };
|
||||
OBJ_30 /* OpenVPNAdapter.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = OpenVPNAdapter.mm; sourceTree = "<group>"; };
|
||||
OBJ_30 /* OpenVPNAdapterImpl.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = OpenVPNAdapterImpl.mm; sourceTree = "<group>"; };
|
||||
OBJ_31 /* OpenVPNCertificate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = OpenVPNCertificate.m; sourceTree = "<group>"; };
|
||||
OBJ_32 /* OpenVPNClient.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = OpenVPNClient.mm; sourceTree = "<group>"; };
|
||||
OBJ_33 /* OpenVPNConfiguration.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = OpenVPNConfiguration.mm; sourceTree = "<group>"; };
|
||||
@@ -445,28 +446,27 @@
|
||||
OBJ_45 /* OpenVPNServerEntry.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = OpenVPNServerEntry.mm; sourceTree = "<group>"; };
|
||||
OBJ_46 /* OpenVPNSessionToken.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = OpenVPNSessionToken.mm; sourceTree = "<group>"; };
|
||||
OBJ_47 /* OpenVPNTransportStats.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = OpenVPNTransportStats.mm; sourceTree = "<group>"; };
|
||||
OBJ_49 /* OpenVPNCompressionMode.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = OpenVPNCompressionMode.h; sourceTree = "<group>"; };
|
||||
OBJ_50 /* OpenVPNKeyType.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = OpenVPNKeyType.h; sourceTree = "<group>"; };
|
||||
OBJ_51 /* OpenVPNAdapterEvent.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = OpenVPNAdapterEvent.h; sourceTree = "<group>"; };
|
||||
OBJ_52 /* OpenVPNError.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = OpenVPNError.h; sourceTree = "<group>"; };
|
||||
OBJ_53 /* OpenVPNTransportProtocol.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = OpenVPNTransportProtocol.h; sourceTree = "<group>"; };
|
||||
OBJ_54 /* OpenVPNTLSCertProfile.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = OpenVPNTLSCertProfile.h; sourceTree = "<group>"; };
|
||||
OBJ_55 /* OpenVPNPrivateKey.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = OpenVPNPrivateKey.h; sourceTree = "<group>"; };
|
||||
OBJ_56 /* OpenVPNInterfaceStats.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = OpenVPNInterfaceStats.h; sourceTree = "<group>"; };
|
||||
OBJ_58 /* OpenVPNReachability.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = OpenVPNReachability.h; sourceTree = "<group>"; };
|
||||
OBJ_59 /* OpenVPNIPv6Preference.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = OpenVPNIPv6Preference.h; sourceTree = "<group>"; };
|
||||
OBJ_60 /* OpenVPNAdapterPacketFlow.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = OpenVPNAdapterPacketFlow.h; sourceTree = "<group>"; };
|
||||
OBJ_61 /* OpenVPNMinTLSVersion.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = OpenVPNMinTLSVersion.h; sourceTree = "<group>"; };
|
||||
OBJ_62 /* OpenVPNAdapter.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = OpenVPNAdapter.h; sourceTree = "<group>"; };
|
||||
OBJ_63 /* OpenVPNConnectionInfo.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = OpenVPNConnectionInfo.h; sourceTree = "<group>"; };
|
||||
OBJ_64 /* OpenVPNReachabilityStatus.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = OpenVPNReachabilityStatus.h; sourceTree = "<group>"; };
|
||||
OBJ_65 /* OpenVPNServerEntry.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = OpenVPNServerEntry.h; sourceTree = "<group>"; };
|
||||
OBJ_66 /* OpenVPNConfiguration.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = OpenVPNConfiguration.h; sourceTree = "<group>"; };
|
||||
OBJ_67 /* OpenVPNCredentials.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = OpenVPNCredentials.h; sourceTree = "<group>"; };
|
||||
OBJ_68 /* OpenVPNTransportStats.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = OpenVPNTransportStats.h; sourceTree = "<group>"; };
|
||||
OBJ_69 /* OpenVPNSessionToken.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = OpenVPNSessionToken.h; sourceTree = "<group>"; };
|
||||
OBJ_70 /* OpenVPNCertificate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = OpenVPNCertificate.h; sourceTree = "<group>"; };
|
||||
OBJ_73 /* ovpncli.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = ovpncli.mm; sourceTree = "<group>"; };
|
||||
OBJ_49 /* OpenVPNCompressionMode.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.c.h; path = OpenVPNCompressionMode.h; sourceTree = "<group>"; };
|
||||
OBJ_50 /* OpenVPNKeyType.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.c.h; path = OpenVPNKeyType.h; sourceTree = "<group>"; };
|
||||
OBJ_51 /* OpenVPNAdapterEvent.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.c.h; path = OpenVPNAdapterEvent.h; sourceTree = "<group>"; };
|
||||
OBJ_52 /* OpenVPNError.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.c.h; path = OpenVPNError.h; sourceTree = "<group>"; };
|
||||
OBJ_53 /* OpenVPNTransportProtocol.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.c.h; path = OpenVPNTransportProtocol.h; sourceTree = "<group>"; };
|
||||
OBJ_54 /* OpenVPNTLSCertProfile.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.c.h; path = OpenVPNTLSCertProfile.h; sourceTree = "<group>"; };
|
||||
OBJ_55 /* OpenVPNPrivateKey.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.c.h; path = OpenVPNPrivateKey.h; sourceTree = "<group>"; };
|
||||
OBJ_56 /* OpenVPNInterfaceStats.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.c.h; path = OpenVPNInterfaceStats.h; sourceTree = "<group>"; };
|
||||
OBJ_58 /* OpenVPNReachability.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.c.h; path = OpenVPNReachability.h; sourceTree = "<group>"; };
|
||||
OBJ_59 /* OpenVPNIPv6Preference.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.c.h; path = OpenVPNIPv6Preference.h; sourceTree = "<group>"; };
|
||||
OBJ_60 /* OpenVPNAdapterPacketFlow.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.c.h; path = OpenVPNAdapterPacketFlow.h; sourceTree = "<group>"; };
|
||||
OBJ_61 /* OpenVPNMinTLSVersion.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.c.h; path = OpenVPNMinTLSVersion.h; sourceTree = "<group>"; };
|
||||
OBJ_63 /* OpenVPNConnectionInfo.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.c.h; path = OpenVPNConnectionInfo.h; sourceTree = "<group>"; };
|
||||
OBJ_64 /* OpenVPNReachabilityStatus.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.c.h; path = OpenVPNReachabilityStatus.h; sourceTree = "<group>"; };
|
||||
OBJ_65 /* OpenVPNServerEntry.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.c.h; path = OpenVPNServerEntry.h; sourceTree = "<group>"; };
|
||||
OBJ_66 /* OpenVPNConfiguration.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.c.h; path = OpenVPNConfiguration.h; sourceTree = "<group>"; };
|
||||
OBJ_67 /* OpenVPNCredentials.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.c.h; path = OpenVPNCredentials.h; sourceTree = "<group>"; };
|
||||
OBJ_68 /* OpenVPNTransportStats.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.c.h; path = OpenVPNTransportStats.h; sourceTree = "<group>"; };
|
||||
OBJ_69 /* OpenVPNSessionToken.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.c.h; path = OpenVPNSessionToken.h; sourceTree = "<group>"; };
|
||||
OBJ_70 /* OpenVPNCertificate.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.c.h; path = OpenVPNCertificate.h; sourceTree = "<group>"; };
|
||||
OBJ_73 /* ovpncli.mm */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; path = ovpncli.mm; sourceTree = "<group>"; };
|
||||
OBJ_85 /* aes.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = aes.c; sourceTree = "<group>"; };
|
||||
OBJ_86 /* aesni.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = aesni.c; sourceTree = "<group>"; };
|
||||
OBJ_87 /* arc4.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = arc4.c; sourceTree = "<group>"; };
|
||||
@@ -737,8 +737,8 @@
|
||||
OBJ_28 /* NSArray+OpenVPNAdditions.m */,
|
||||
C97E5F6F24122F22005C2EBC /* NSError+OpenVPNError.h */,
|
||||
OBJ_29 /* NSError+OpenVPNError.m */,
|
||||
C97E5F7324122FE6005C2EBC /* OpenVPNAdapter.h */,
|
||||
OBJ_30 /* OpenVPNAdapter.mm */,
|
||||
C97E5F7324122FE6005C2EBC /* OpenVPNAdapterImpl.h */,
|
||||
OBJ_30 /* OpenVPNAdapterImpl.mm */,
|
||||
C97E5F7924123022005C2EBC /* OpenVPNCertificate.h */,
|
||||
OBJ_31 /* OpenVPNCertificate.m */,
|
||||
C97E5F7124122F5C005C2EBC /* OpenVPNClient.h */,
|
||||
@@ -800,9 +800,9 @@
|
||||
C910EAE624EBB5210081AF13 /* OpenVPNConfigurationEvaluation.h */,
|
||||
OBJ_58 /* OpenVPNReachability.h */,
|
||||
OBJ_59 /* OpenVPNIPv6Preference.h */,
|
||||
C96B36B226888CF20054CA12 /* OpenVPNAdapterImpl.h */,
|
||||
OBJ_60 /* OpenVPNAdapterPacketFlow.h */,
|
||||
OBJ_61 /* OpenVPNMinTLSVersion.h */,
|
||||
OBJ_62 /* OpenVPNAdapter.h */,
|
||||
OBJ_63 /* OpenVPNConnectionInfo.h */,
|
||||
OBJ_64 /* OpenVPNReachabilityStatus.h */,
|
||||
OBJ_65 /* OpenVPNServerEntry.h */,
|
||||
@@ -996,7 +996,7 @@
|
||||
C97E5F9E2412314A005C2EBC /* OpenVPNConfigurationEvaluation.h in Headers */,
|
||||
C97E5FA62412317B005C2EBC /* OpenVPNReachabilityStatus.h in Headers */,
|
||||
OBJ_287 /* OpenVPNPrivateKey.h in Headers */,
|
||||
C97E5F7424122FE6005C2EBC /* OpenVPNAdapter.h in Headers */,
|
||||
C97E5F7424122FE6005C2EBC /* OpenVPNAdapterImpl.h in Headers */,
|
||||
OBJ_288 /* OpenVPNInterfaceStats.h in Headers */,
|
||||
OBJ_290 /* OpenVPNReachability.h in Headers */,
|
||||
OBJ_291 /* OpenVPNIPv6Preference.h in Headers */,
|
||||
@@ -1011,7 +1011,6 @@
|
||||
C97E5FA824123186005C2EBC /* OpenVPNReachabilityTracker.h in Headers */,
|
||||
OBJ_293 /* OpenVPNMinTLSVersion.h in Headers */,
|
||||
C97E5F7224122F5C005C2EBC /* OpenVPNClient.h in Headers */,
|
||||
OBJ_294 /* OpenVPNAdapter.h in Headers */,
|
||||
OBJ_295 /* OpenVPNConnectionInfo.h in Headers */,
|
||||
OBJ_296 /* OpenVPNReachabilityStatus.h in Headers */,
|
||||
C97E5F822412305C005C2EBC /* OpenVPNConnectionInfo.h in Headers */,
|
||||
@@ -1023,6 +1022,7 @@
|
||||
C97E5FB0241231BB005C2EBC /* OpenVPNSessionToken+Internal.h in Headers */,
|
||||
C97E5F8024123051005C2EBC /* OpenVPNConfiguration+Internal.h in Headers */,
|
||||
OBJ_299 /* OpenVPNCredentials.h in Headers */,
|
||||
C96B36B326888CF20054CA12 /* OpenVPNAdapterImpl.h in Headers */,
|
||||
OBJ_300 /* OpenVPNTransportStats.h in Headers */,
|
||||
OBJ_301 /* OpenVPNSessionToken.h in Headers */,
|
||||
C97E5FA424123168005C2EBC /* OpenVPNReachability+Internal.h in Headers */,
|
||||
@@ -1205,7 +1205,7 @@
|
||||
files = (
|
||||
OBJ_260 /* NSArray+OpenVPNAdditions.m in Sources */,
|
||||
OBJ_261 /* NSError+OpenVPNError.m in Sources */,
|
||||
OBJ_262 /* OpenVPNAdapter.mm in Sources */,
|
||||
OBJ_262 /* OpenVPNAdapterImpl.mm in Sources */,
|
||||
OBJ_263 /* OpenVPNCertificate.m in Sources */,
|
||||
OBJ_264 /* OpenVPNClient.mm in Sources */,
|
||||
OBJ_265 /* OpenVPNConfiguration.mm in Sources */,
|
||||
@@ -1547,7 +1547,7 @@
|
||||
"$(inherited)",
|
||||
"$(TOOLCHAIN_DIR)/usr/lib/swift/macosx",
|
||||
);
|
||||
MARKETING_VERSION = 0.7.0;
|
||||
MARKETING_VERSION = 0.8.0;
|
||||
OTHER_SWIFT_FLAGS = "$(inherited)";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = OpenVPNAdapter;
|
||||
PRODUCT_MODULE_NAME = "$(TARGET_NAME:c99extidentifier)";
|
||||
@@ -1576,7 +1576,7 @@
|
||||
"$(inherited)",
|
||||
"$(TOOLCHAIN_DIR)/usr/lib/swift/macosx",
|
||||
);
|
||||
MARKETING_VERSION = 0.7.0;
|
||||
MARKETING_VERSION = 0.8.0;
|
||||
OTHER_SWIFT_FLAGS = "$(inherited)";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = OpenVPNAdapter;
|
||||
PRODUCT_MODULE_NAME = "$(TARGET_NAME:c99extidentifier)";
|
||||
|
||||
29
README.md
29
README.md
@@ -35,7 +35,7 @@ To install OpenVPNAdapter with Cocoapods, add the following lines to your `Podfi
|
||||
```ruby
|
||||
target 'Your Target Name' do
|
||||
use_frameworks!
|
||||
pod 'OpenVPNAdapter', :git => 'https://github.com/ss-abramchuk/OpenVPNAdapter.git', :tag => '0.7.0'
|
||||
pod 'OpenVPNAdapter', :git => 'https://github.com/ss-abramchuk/OpenVPNAdapter.git', :tag => '0.8.0'
|
||||
end
|
||||
```
|
||||
|
||||
@@ -160,7 +160,10 @@ class PacketTunnelProvider: NEPacketTunnelProvider {
|
||||
var startHandler: ((Error?) -> Void)?
|
||||
var stopHandler: (() -> Void)?
|
||||
|
||||
override func startTunnel(options: [String : NSObject]?, completionHandler: @escaping (Error?) -> Void) {
|
||||
override func startTunnel(
|
||||
options: [String : NSObject]?,
|
||||
completionHandler: @escaping (Error?) -> Void
|
||||
) {
|
||||
// There are many ways to provide OpenVPN settings to the tunnel provider. For instance,
|
||||
// you can use `options` argument of `startTunnel(options:completionHandler:)` method or get
|
||||
// settings from `protocolConfiguration.providerConfiguration` property of `NEPacketTunnelProvider`
|
||||
@@ -240,7 +243,10 @@ class PacketTunnelProvider: NEPacketTunnelProvider {
|
||||
vpnAdapter.connect(using: packetFlow)
|
||||
}
|
||||
|
||||
override func stopTunnel(with reason: NEProviderStopReason, completionHandler: @escaping () -> Void) {
|
||||
override func stopTunnel(
|
||||
with reason: NEProviderStopReason,
|
||||
completionHandler: @escaping () -> Void
|
||||
) {
|
||||
stopHandler = completionHandler
|
||||
|
||||
if vpnReachability.isTracking {
|
||||
@@ -260,7 +266,11 @@ extension PacketTunnelProvider: OpenVPNAdapterDelegate {
|
||||
// `OpenVPNAdapterPacketFlow` method signatures are similar to `NEPacketTunnelFlow` so
|
||||
// you can just extend that class to adopt `OpenVPNAdapterPacketFlow` protocol and
|
||||
// send `self.packetFlow` to `completionHandler` callback.
|
||||
func openVPNAdapter(_ openVPNAdapter: OpenVPNAdapter, configureTunnelWithNetworkSettings networkSettings: NEPacketTunnelNetworkSettings?, completionHandler: @escaping (Error?) -> Void) {
|
||||
func openVPNAdapter(
|
||||
_ openVPNAdapter: OpenVPNAdapter,
|
||||
configureTunnelWithNetworkSettings networkSettings: NEPacketTunnelNetworkSettings?,
|
||||
completionHandler: @escaping (Error?) -> Void
|
||||
) {
|
||||
// In order to direct all DNS queries first to the VPN DNS servers before the primary DNS servers
|
||||
// send empty string to NEDNSSettings.matchDomains
|
||||
networkSettings?.dnsSettings?.matchDomains = [""]
|
||||
@@ -270,7 +280,11 @@ extension PacketTunnelProvider: OpenVPNAdapterDelegate {
|
||||
}
|
||||
|
||||
// Process events returned by the OpenVPN library
|
||||
func openVPNAdapter(_ openVPNAdapter: OpenVPNAdapter, handleEvent event: OpenVPNAdapterEvent, message: String?) {
|
||||
func openVPNAdapter(
|
||||
_ openVPNAdapter: OpenVPNAdapter,
|
||||
handleEvent event:
|
||||
OpenVPNAdapterEvent, message: String?
|
||||
) {
|
||||
switch event {
|
||||
case .connected:
|
||||
if reasserting {
|
||||
@@ -303,9 +317,8 @@ extension PacketTunnelProvider: OpenVPNAdapterDelegate {
|
||||
// Handle errors thrown by the OpenVPN library
|
||||
func openVPNAdapter(_ openVPNAdapter: OpenVPNAdapter, handleError error: Error) {
|
||||
// Handle only fatal errors
|
||||
guard let fatal = (error as NSError).userInfo[OpenVPNAdapterErrorFatalKey] as? Bool, fatal == true else {
|
||||
return
|
||||
}
|
||||
guard let fatal = (error as NSError).userInfo[OpenVPNAdapterErrorFatalKey] as? Bool,
|
||||
fatal == true else { return }
|
||||
|
||||
if vpnReachability.isTracking {
|
||||
vpnReachability.stopTracking()
|
||||
|
||||
@@ -2,13 +2,51 @@
|
||||
|
||||
set -e
|
||||
|
||||
. functions.sh
|
||||
function apply_patches()
|
||||
{
|
||||
DEP_SRC_DIR=$1
|
||||
DEP_PATCH_DIR=$2
|
||||
|
||||
CURRENT_DIR=$(pwd)
|
||||
|
||||
ASIO_SRC_DIR="../Sources/ASIO"
|
||||
ASIO_PATCH_DIR="../Sources/OpenVPN3/deps/asio/patches"
|
||||
pushd ${CURRENT_DIR}
|
||||
|
||||
MBEDTLS_SRC_DIR="../Sources/mbedTLS"
|
||||
MBEDTLS_PATCH_DIR="../Sources/OpenVPN3/deps/mbedtls/patches"
|
||||
cd /tmp
|
||||
|
||||
for FILE in ${CURRENT_DIR}/${DEP_PATCH_DIR}/*.patch; do
|
||||
echo Applying patch: $FILE
|
||||
git apply --directory ${CURRENT_DIR}/${DEP_SRC_DIR} --unsafe-path $FILE
|
||||
done
|
||||
|
||||
popd
|
||||
}
|
||||
|
||||
function reverse_patches()
|
||||
{
|
||||
DEP_SRC_DIR=$1
|
||||
DEP_PATCH_DIR=$2
|
||||
|
||||
CURRENT_DIR=$(pwd)
|
||||
|
||||
pushd ${CURRENT_DIR}
|
||||
|
||||
cd /tmp
|
||||
|
||||
REVERSED_PATCHES=$(ls -1 ${CURRENT_DIR}/${DEP_PATCH_DIR}/*.patch | sort -r)
|
||||
|
||||
for FILE in $REVERSED_PATCHES; do
|
||||
echo Reverse patch: $FILE
|
||||
git apply --reverse --directory ${CURRENT_DIR}/${DEP_SRC_DIR} --unsafe-path $FILE
|
||||
done
|
||||
|
||||
popd
|
||||
}
|
||||
|
||||
ASIO_SRC_DIR="Sources/ASIO"
|
||||
ASIO_PATCH_DIR="Sources/OpenVPN3/deps/asio/patches"
|
||||
|
||||
MBEDTLS_SRC_DIR="Sources/mbedTLS"
|
||||
MBEDTLS_PATCH_DIR="Sources/OpenVPN3/deps/mbedtls/patches"
|
||||
|
||||
if [ "$1" = "--reverse" ]; then
|
||||
reverse_patches ${ASIO_SRC_DIR} ${ASIO_PATCH_DIR}
|
||||
|
||||
@@ -1,37 +0,0 @@
|
||||
function apply_patches()
|
||||
{
|
||||
DEP_SRC_DIR=$1
|
||||
DEP_PATCH_DIR=$2
|
||||
|
||||
CURRENT_DIR=$(pwd)
|
||||
|
||||
pushd ${CURRENT_DIR}
|
||||
|
||||
cd /tmp
|
||||
|
||||
for file in ${CURRENT_DIR}/${DEP_PATCH_DIR}/*.patch; do
|
||||
echo Applying patch: $file
|
||||
git apply --directory ${CURRENT_DIR}/${DEP_SRC_DIR} --unsafe-path $file
|
||||
done
|
||||
|
||||
popd
|
||||
}
|
||||
|
||||
function reverse_patches()
|
||||
{
|
||||
DEP_SRC_DIR=$1
|
||||
DEP_PATCH_DIR=$2
|
||||
|
||||
CURRENT_DIR=$(pwd)
|
||||
|
||||
pushd ${CURRENT_DIR}
|
||||
|
||||
cd /tmp
|
||||
|
||||
for file in ${CURRENT_DIR}/${DEP_PATCH_DIR}/*.patch; do
|
||||
echo Reverse patch: $file
|
||||
git apply --reverse --directory ${CURRENT_DIR}/${DEP_SRC_DIR} --unsafe-path $file
|
||||
done
|
||||
|
||||
popd
|
||||
}
|
||||
13
Scripts/pull_dependencies.sh
Executable file
13
Scripts/pull_dependencies.sh
Executable file
@@ -0,0 +1,13 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
OPENVPN3_VERSION="release/3.6.1"
|
||||
|
||||
git subtree pull --prefix Sources/OpenVPN3 git@github.com:OpenVPN/openvpn3.git ${OPENVPN3_VERSION} --squash
|
||||
|
||||
source Sources/OpenVPN3/deps/lib-versions
|
||||
|
||||
git subtree pull --prefix Sources/ASIO git@github.com:chriskohlhoff/asio.git ${ASIO_VERSION} --squash
|
||||
git subtree pull --prefix Sources/LZ4 git@github.com:lz4/lz4.git ${LZ4_VERSION/lz4-/v} --squash
|
||||
git subtree pull --prefix Sources/mbedTLS git@github.com:ARMmbed/mbedtls.git ${MBEDTLS_VERSION} --squash
|
||||
@@ -1,4 +1,4 @@
|
||||
asio version 1.14.0
|
||||
Released Sunday, 14 April 2019.
|
||||
asio version 1.16.0
|
||||
Released Thursday, 12 December 2019.
|
||||
|
||||
See doc/index.html for API documentation and a tutorial.
|
||||
|
||||
@@ -387,6 +387,9 @@
|
||||
/doc/asio/reference/basic_deadline_timer/get_executor.html
|
||||
/doc/asio/reference/basic_deadline_timer.html
|
||||
/doc/asio/reference/basic_deadline_timer/operator_eq_.html
|
||||
/doc/asio/reference/basic_deadline_timer__rebind_executor/
|
||||
/doc/asio/reference/basic_deadline_timer__rebind_executor.html
|
||||
/doc/asio/reference/basic_deadline_timer__rebind_executor/other.html
|
||||
/doc/asio/reference/basic_deadline_timer/time_type.html
|
||||
/doc/asio/reference/basic_deadline_timer/traits_type.html
|
||||
/doc/asio/reference/basic_deadline_timer/wait/
|
||||
@@ -783,6 +786,9 @@
|
||||
/doc/asio/reference/basic_serial_port/read_some.html
|
||||
/doc/asio/reference/basic_serial_port/read_some/overload1.html
|
||||
/doc/asio/reference/basic_serial_port/read_some/overload2.html
|
||||
/doc/asio/reference/basic_serial_port__rebind_executor/
|
||||
/doc/asio/reference/basic_serial_port__rebind_executor.html
|
||||
/doc/asio/reference/basic_serial_port__rebind_executor/other.html
|
||||
/doc/asio/reference/basic_serial_port/send_break/
|
||||
/doc/asio/reference/basic_serial_port/send_break.html
|
||||
/doc/asio/reference/basic_serial_port/send_break/overload1.html
|
||||
@@ -823,6 +829,9 @@
|
||||
/doc/asio/reference/basic_signal_set/executor_type.html
|
||||
/doc/asio/reference/basic_signal_set/get_executor.html
|
||||
/doc/asio/reference/basic_signal_set.html
|
||||
/doc/asio/reference/basic_signal_set__rebind_executor/
|
||||
/doc/asio/reference/basic_signal_set__rebind_executor.html
|
||||
/doc/asio/reference/basic_signal_set__rebind_executor/other.html
|
||||
/doc/asio/reference/basic_signal_set/remove/
|
||||
/doc/asio/reference/basic_signal_set/remove.html
|
||||
/doc/asio/reference/basic_signal_set/remove/overload1.html
|
||||
@@ -944,6 +953,9 @@
|
||||
/doc/asio/reference/basic_socket_acceptor/operator_eq_/overload2.html
|
||||
/doc/asio/reference/basic_socket_acceptor/out_of_band_inline.html
|
||||
/doc/asio/reference/basic_socket_acceptor/protocol_type.html
|
||||
/doc/asio/reference/basic_socket_acceptor__rebind_executor/
|
||||
/doc/asio/reference/basic_socket_acceptor__rebind_executor.html
|
||||
/doc/asio/reference/basic_socket_acceptor__rebind_executor/other.html
|
||||
/doc/asio/reference/basic_socket_acceptor/receive_buffer_size.html
|
||||
/doc/asio/reference/basic_socket_acceptor/receive_low_watermark.html
|
||||
/doc/asio/reference/basic_socket_acceptor/release/
|
||||
@@ -1394,6 +1406,9 @@
|
||||
/doc/asio/reference/basic_waitable_timer/get_executor.html
|
||||
/doc/asio/reference/basic_waitable_timer.html
|
||||
/doc/asio/reference/basic_waitable_timer/operator_eq_.html
|
||||
/doc/asio/reference/basic_waitable_timer__rebind_executor/
|
||||
/doc/asio/reference/basic_waitable_timer__rebind_executor.html
|
||||
/doc/asio/reference/basic_waitable_timer__rebind_executor/other.html
|
||||
/doc/asio/reference/basic_waitable_timer/time_point.html
|
||||
/doc/asio/reference/basic_waitable_timer/traits_type.html
|
||||
/doc/asio/reference/basic_waitable_timer/wait/
|
||||
@@ -1702,6 +1717,9 @@
|
||||
/doc/asio/reference/co_spawn/overload1.html
|
||||
/doc/asio/reference/co_spawn/overload2.html
|
||||
/doc/asio/reference/deadline_timer.html
|
||||
/doc/asio/reference/default_completion_token/
|
||||
/doc/asio/reference/default_completion_token.html
|
||||
/doc/asio/reference/default_completion_token/type.html
|
||||
/doc/asio/reference/defer/
|
||||
/doc/asio/reference/defer.html
|
||||
/doc/asio/reference/defer/overload1.html
|
||||
@@ -2505,6 +2523,9 @@
|
||||
/doc/asio/reference/ip__basic_resolver_query/protocol_type.html
|
||||
/doc/asio/reference/ip__basic_resolver_query/service_name.html
|
||||
/doc/asio/reference/ip__basic_resolver_query/v4_mapped.html
|
||||
/doc/asio/reference/ip__basic_resolver__rebind_executor/
|
||||
/doc/asio/reference/ip__basic_resolver__rebind_executor.html
|
||||
/doc/asio/reference/ip__basic_resolver__rebind_executor/other.html
|
||||
/doc/asio/reference/ip__basic_resolver/resolve/
|
||||
/doc/asio/reference/ip__basic_resolver/resolve.html
|
||||
/doc/asio/reference/ip__basic_resolver/resolve/overload10.html
|
||||
@@ -2881,6 +2902,9 @@
|
||||
/doc/asio/reference/posix__basic_descriptor/non_blocking/overload2.html
|
||||
/doc/asio/reference/posix__basic_descriptor/non_blocking/overload3.html
|
||||
/doc/asio/reference/posix__basic_descriptor/operator_eq_.html
|
||||
/doc/asio/reference/posix__basic_descriptor__rebind_executor/
|
||||
/doc/asio/reference/posix__basic_descriptor__rebind_executor.html
|
||||
/doc/asio/reference/posix__basic_descriptor__rebind_executor/other.html
|
||||
/doc/asio/reference/posix__basic_descriptor/release.html
|
||||
/doc/asio/reference/posix__basic_descriptor/wait/
|
||||
/doc/asio/reference/posix__basic_descriptor/wait.html
|
||||
@@ -2942,6 +2966,9 @@
|
||||
/doc/asio/reference/posix__basic_stream_descriptor/read_some.html
|
||||
/doc/asio/reference/posix__basic_stream_descriptor/read_some/overload1.html
|
||||
/doc/asio/reference/posix__basic_stream_descriptor/read_some/overload2.html
|
||||
/doc/asio/reference/posix__basic_stream_descriptor__rebind_executor/
|
||||
/doc/asio/reference/posix__basic_stream_descriptor__rebind_executor.html
|
||||
/doc/asio/reference/posix__basic_stream_descriptor__rebind_executor/other.html
|
||||
/doc/asio/reference/posix__basic_stream_descriptor/release.html
|
||||
/doc/asio/reference/posix__basic_stream_descriptor/wait/
|
||||
/doc/asio/reference/posix__basic_stream_descriptor/wait.html
|
||||
@@ -3445,6 +3472,11 @@
|
||||
/doc/asio/reference/transfer_exactly.html
|
||||
/doc/asio/reference/use_awaitable.html
|
||||
/doc/asio/reference/use_awaitable_t/
|
||||
/doc/asio/reference/use_awaitable_t/as_default_on.html
|
||||
/doc/asio/reference/use_awaitable_t__executor_with_default/
|
||||
/doc/asio/reference/use_awaitable_t__executor_with_default/default_completion_token_type.html
|
||||
/doc/asio/reference/use_awaitable_t__executor_with_default/executor_with_default.html
|
||||
/doc/asio/reference/use_awaitable_t__executor_with_default.html
|
||||
/doc/asio/reference/use_awaitable_t.html
|
||||
/doc/asio/reference/use_awaitable_t/use_awaitable_t.html
|
||||
/doc/asio/reference/use_future.html
|
||||
@@ -3501,6 +3533,9 @@
|
||||
/doc/asio/reference/windows__basic_object_handle/native_handle.html
|
||||
/doc/asio/reference/windows__basic_object_handle/native_handle_type.html
|
||||
/doc/asio/reference/windows__basic_object_handle/operator_eq_.html
|
||||
/doc/asio/reference/windows__basic_object_handle__rebind_executor/
|
||||
/doc/asio/reference/windows__basic_object_handle__rebind_executor.html
|
||||
/doc/asio/reference/windows__basic_object_handle__rebind_executor/other.html
|
||||
/doc/asio/reference/windows__basic_object_handle/wait/
|
||||
/doc/asio/reference/windows__basic_object_handle/wait.html
|
||||
/doc/asio/reference/windows__basic_object_handle/wait/overload1.html
|
||||
@@ -3539,6 +3574,9 @@
|
||||
/doc/asio/reference/windows__basic_overlapped_handle/native_handle.html
|
||||
/doc/asio/reference/windows__basic_overlapped_handle/native_handle_type.html
|
||||
/doc/asio/reference/windows__basic_overlapped_handle/operator_eq_.html
|
||||
/doc/asio/reference/windows__basic_overlapped_handle__rebind_executor/
|
||||
/doc/asio/reference/windows__basic_overlapped_handle__rebind_executor.html
|
||||
/doc/asio/reference/windows__basic_overlapped_handle__rebind_executor/other.html
|
||||
/doc/asio/reference/windows__basic_random_access_handle/
|
||||
/doc/asio/reference/windows__basic_random_access_handle/assign/
|
||||
/doc/asio/reference/windows__basic_random_access_handle/assign.html
|
||||
@@ -3578,6 +3616,9 @@
|
||||
/doc/asio/reference/windows__basic_random_access_handle/read_some_at.html
|
||||
/doc/asio/reference/windows__basic_random_access_handle/read_some_at/overload1.html
|
||||
/doc/asio/reference/windows__basic_random_access_handle/read_some_at/overload2.html
|
||||
/doc/asio/reference/windows__basic_random_access_handle__rebind_executor/
|
||||
/doc/asio/reference/windows__basic_random_access_handle__rebind_executor.html
|
||||
/doc/asio/reference/windows__basic_random_access_handle__rebind_executor/other.html
|
||||
/doc/asio/reference/windows__basic_random_access_handle/write_some_at/
|
||||
/doc/asio/reference/windows__basic_random_access_handle/write_some_at.html
|
||||
/doc/asio/reference/windows__basic_random_access_handle/write_some_at/overload1.html
|
||||
@@ -3621,6 +3662,9 @@
|
||||
/doc/asio/reference/windows__basic_stream_handle/read_some.html
|
||||
/doc/asio/reference/windows__basic_stream_handle/read_some/overload1.html
|
||||
/doc/asio/reference/windows__basic_stream_handle/read_some/overload2.html
|
||||
/doc/asio/reference/windows__basic_stream_handle__rebind_executor/
|
||||
/doc/asio/reference/windows__basic_stream_handle__rebind_executor.html
|
||||
/doc/asio/reference/windows__basic_stream_handle__rebind_executor/other.html
|
||||
/doc/asio/reference/windows__basic_stream_handle/write_some/
|
||||
/doc/asio/reference/windows__basic_stream_handle/write_some.html
|
||||
/doc/asio/reference/windows__basic_stream_handle/write_some/overload1.html
|
||||
@@ -3718,9 +3762,7 @@
|
||||
/doc/asio/tutorial/tuttimer5.html
|
||||
/doc/asio/tutorial/tuttimer5/src.html
|
||||
/doc/asio/using.html
|
||||
/doc/._async_op1.png
|
||||
/doc/async_op1.png
|
||||
/doc/._async_op2.png
|
||||
/doc/async_op2.png
|
||||
/doc/blank.png
|
||||
/doc/boostbook.css
|
||||
@@ -3778,7 +3820,6 @@
|
||||
/doc/examples/diffs/http/server/server.hpp.html
|
||||
/doc/examples/diffs/invocation/
|
||||
/doc/examples/diffs/invocation/prioritised_handlers.cpp.html
|
||||
/doc/examples/diffs/invocation/test.cpp.html
|
||||
/doc/examples/diffs/iostreams/
|
||||
/doc/examples/diffs/iostreams/http_client.cpp.html
|
||||
/doc/examples/diffs/local/
|
||||
@@ -3830,10 +3871,8 @@
|
||||
/doc/note.png
|
||||
/doc/prev_disabled.png
|
||||
/doc/prev.png
|
||||
/doc/._proactor.png
|
||||
/doc/proactor.png
|
||||
/doc/standalone_HTML.manifest
|
||||
/doc/._sync_op.png
|
||||
/doc/sync_op.png
|
||||
/doc/tip.png
|
||||
/doc/up_disabled.png
|
||||
|
||||
@@ -721,6 +721,8 @@
|
||||
/doc/html/boost_asio/example/cpp11/multicast/
|
||||
/doc/html/boost_asio/example/cpp11/multicast/receiver.cpp
|
||||
/doc/html/boost_asio/example/cpp11/multicast/sender.cpp
|
||||
/doc/html/boost_asio/example/cpp11/nonblocking/
|
||||
/doc/html/boost_asio/example/cpp11/nonblocking/third_party_lib.cpp
|
||||
/doc/html/boost_asio/example/cpp11/operations/
|
||||
/doc/html/boost_asio/example/cpp11/operations/composed_1.cpp
|
||||
/doc/html/boost_asio/example/cpp11/operations/composed_2.cpp
|
||||
@@ -761,6 +763,7 @@
|
||||
/doc/html/boost_asio/example/cpp17/coroutines_ts/
|
||||
/doc/html/boost_asio/example/cpp17/coroutines_ts/chat_server.cpp
|
||||
/doc/html/boost_asio/example/cpp17/coroutines_ts/echo_server.cpp
|
||||
/doc/html/boost_asio/example/cpp17/coroutines_ts/echo_server_with_default.cpp
|
||||
/doc/html/boost_asio/example/cpp17/coroutines_ts/range_based_for.cpp
|
||||
/doc/html/boost_asio/example/cpp17/coroutines_ts/refactored_echo_server.cpp
|
||||
/doc/html/boost_asio/examples/
|
||||
@@ -1141,6 +1144,9 @@
|
||||
/doc/html/boost_asio/reference/basic_deadline_timer/get_executor.html
|
||||
/doc/html/boost_asio/reference/basic_deadline_timer.html
|
||||
/doc/html/boost_asio/reference/basic_deadline_timer/operator_eq_.html
|
||||
/doc/html/boost_asio/reference/basic_deadline_timer__rebind_executor/
|
||||
/doc/html/boost_asio/reference/basic_deadline_timer__rebind_executor.html
|
||||
/doc/html/boost_asio/reference/basic_deadline_timer__rebind_executor/other.html
|
||||
/doc/html/boost_asio/reference/basic_deadline_timer/time_type.html
|
||||
/doc/html/boost_asio/reference/basic_deadline_timer/traits_type.html
|
||||
/doc/html/boost_asio/reference/basic_deadline_timer/wait/
|
||||
@@ -1537,6 +1543,9 @@
|
||||
/doc/html/boost_asio/reference/basic_serial_port/read_some.html
|
||||
/doc/html/boost_asio/reference/basic_serial_port/read_some/overload1.html
|
||||
/doc/html/boost_asio/reference/basic_serial_port/read_some/overload2.html
|
||||
/doc/html/boost_asio/reference/basic_serial_port__rebind_executor/
|
||||
/doc/html/boost_asio/reference/basic_serial_port__rebind_executor.html
|
||||
/doc/html/boost_asio/reference/basic_serial_port__rebind_executor/other.html
|
||||
/doc/html/boost_asio/reference/basic_serial_port/send_break/
|
||||
/doc/html/boost_asio/reference/basic_serial_port/send_break.html
|
||||
/doc/html/boost_asio/reference/basic_serial_port/send_break/overload1.html
|
||||
@@ -1577,6 +1586,9 @@
|
||||
/doc/html/boost_asio/reference/basic_signal_set/executor_type.html
|
||||
/doc/html/boost_asio/reference/basic_signal_set/get_executor.html
|
||||
/doc/html/boost_asio/reference/basic_signal_set.html
|
||||
/doc/html/boost_asio/reference/basic_signal_set__rebind_executor/
|
||||
/doc/html/boost_asio/reference/basic_signal_set__rebind_executor.html
|
||||
/doc/html/boost_asio/reference/basic_signal_set__rebind_executor/other.html
|
||||
/doc/html/boost_asio/reference/basic_signal_set/remove/
|
||||
/doc/html/boost_asio/reference/basic_signal_set/remove.html
|
||||
/doc/html/boost_asio/reference/basic_signal_set/remove/overload1.html
|
||||
@@ -1698,6 +1710,9 @@
|
||||
/doc/html/boost_asio/reference/basic_socket_acceptor/operator_eq_/overload2.html
|
||||
/doc/html/boost_asio/reference/basic_socket_acceptor/out_of_band_inline.html
|
||||
/doc/html/boost_asio/reference/basic_socket_acceptor/protocol_type.html
|
||||
/doc/html/boost_asio/reference/basic_socket_acceptor__rebind_executor/
|
||||
/doc/html/boost_asio/reference/basic_socket_acceptor__rebind_executor.html
|
||||
/doc/html/boost_asio/reference/basic_socket_acceptor__rebind_executor/other.html
|
||||
/doc/html/boost_asio/reference/basic_socket_acceptor/receive_buffer_size.html
|
||||
/doc/html/boost_asio/reference/basic_socket_acceptor/receive_low_watermark.html
|
||||
/doc/html/boost_asio/reference/basic_socket_acceptor/release/
|
||||
@@ -2148,6 +2163,9 @@
|
||||
/doc/html/boost_asio/reference/basic_waitable_timer/get_executor.html
|
||||
/doc/html/boost_asio/reference/basic_waitable_timer.html
|
||||
/doc/html/boost_asio/reference/basic_waitable_timer/operator_eq_.html
|
||||
/doc/html/boost_asio/reference/basic_waitable_timer__rebind_executor/
|
||||
/doc/html/boost_asio/reference/basic_waitable_timer__rebind_executor.html
|
||||
/doc/html/boost_asio/reference/basic_waitable_timer__rebind_executor/other.html
|
||||
/doc/html/boost_asio/reference/basic_waitable_timer/time_point.html
|
||||
/doc/html/boost_asio/reference/basic_waitable_timer/traits_type.html
|
||||
/doc/html/boost_asio/reference/basic_waitable_timer/wait/
|
||||
@@ -2456,6 +2474,9 @@
|
||||
/doc/html/boost_asio/reference/co_spawn/overload1.html
|
||||
/doc/html/boost_asio/reference/co_spawn/overload2.html
|
||||
/doc/html/boost_asio/reference/deadline_timer.html
|
||||
/doc/html/boost_asio/reference/default_completion_token/
|
||||
/doc/html/boost_asio/reference/default_completion_token.html
|
||||
/doc/html/boost_asio/reference/default_completion_token/type.html
|
||||
/doc/html/boost_asio/reference/defer/
|
||||
/doc/html/boost_asio/reference/defer.html
|
||||
/doc/html/boost_asio/reference/defer/overload1.html
|
||||
@@ -3233,6 +3254,9 @@
|
||||
/doc/html/boost_asio/reference/ip__basic_resolver_query/protocol_type.html
|
||||
/doc/html/boost_asio/reference/ip__basic_resolver_query/service_name.html
|
||||
/doc/html/boost_asio/reference/ip__basic_resolver_query/v4_mapped.html
|
||||
/doc/html/boost_asio/reference/ip__basic_resolver__rebind_executor/
|
||||
/doc/html/boost_asio/reference/ip__basic_resolver__rebind_executor.html
|
||||
/doc/html/boost_asio/reference/ip__basic_resolver__rebind_executor/other.html
|
||||
/doc/html/boost_asio/reference/ip__basic_resolver/resolve/
|
||||
/doc/html/boost_asio/reference/ip__basic_resolver/resolve.html
|
||||
/doc/html/boost_asio/reference/ip__basic_resolver/resolve/overload10.html
|
||||
@@ -3626,6 +3650,9 @@
|
||||
/doc/html/boost_asio/reference/posix__basic_descriptor/non_blocking/overload2.html
|
||||
/doc/html/boost_asio/reference/posix__basic_descriptor/non_blocking/overload3.html
|
||||
/doc/html/boost_asio/reference/posix__basic_descriptor/operator_eq_.html
|
||||
/doc/html/boost_asio/reference/posix__basic_descriptor__rebind_executor/
|
||||
/doc/html/boost_asio/reference/posix__basic_descriptor__rebind_executor.html
|
||||
/doc/html/boost_asio/reference/posix__basic_descriptor__rebind_executor/other.html
|
||||
/doc/html/boost_asio/reference/posix__basic_descriptor/release.html
|
||||
/doc/html/boost_asio/reference/posix__basic_descriptor/wait/
|
||||
/doc/html/boost_asio/reference/posix__basic_descriptor/wait.html
|
||||
@@ -3687,6 +3714,9 @@
|
||||
/doc/html/boost_asio/reference/posix__basic_stream_descriptor/read_some.html
|
||||
/doc/html/boost_asio/reference/posix__basic_stream_descriptor/read_some/overload1.html
|
||||
/doc/html/boost_asio/reference/posix__basic_stream_descriptor/read_some/overload2.html
|
||||
/doc/html/boost_asio/reference/posix__basic_stream_descriptor__rebind_executor/
|
||||
/doc/html/boost_asio/reference/posix__basic_stream_descriptor__rebind_executor.html
|
||||
/doc/html/boost_asio/reference/posix__basic_stream_descriptor__rebind_executor/other.html
|
||||
/doc/html/boost_asio/reference/posix__basic_stream_descriptor/release.html
|
||||
/doc/html/boost_asio/reference/posix__basic_stream_descriptor/wait/
|
||||
/doc/html/boost_asio/reference/posix__basic_stream_descriptor/wait.html
|
||||
@@ -4173,6 +4203,11 @@
|
||||
/doc/html/boost_asio/reference/transfer_exactly.html
|
||||
/doc/html/boost_asio/reference/use_awaitable.html
|
||||
/doc/html/boost_asio/reference/use_awaitable_t/
|
||||
/doc/html/boost_asio/reference/use_awaitable_t/as_default_on.html
|
||||
/doc/html/boost_asio/reference/use_awaitable_t__executor_with_default/
|
||||
/doc/html/boost_asio/reference/use_awaitable_t__executor_with_default/default_completion_token_type.html
|
||||
/doc/html/boost_asio/reference/use_awaitable_t__executor_with_default/executor_with_default.html
|
||||
/doc/html/boost_asio/reference/use_awaitable_t__executor_with_default.html
|
||||
/doc/html/boost_asio/reference/use_awaitable_t.html
|
||||
/doc/html/boost_asio/reference/use_awaitable_t/use_awaitable_t.html
|
||||
/doc/html/boost_asio/reference/use_future.html
|
||||
@@ -4229,6 +4264,9 @@
|
||||
/doc/html/boost_asio/reference/windows__basic_object_handle/native_handle.html
|
||||
/doc/html/boost_asio/reference/windows__basic_object_handle/native_handle_type.html
|
||||
/doc/html/boost_asio/reference/windows__basic_object_handle/operator_eq_.html
|
||||
/doc/html/boost_asio/reference/windows__basic_object_handle__rebind_executor/
|
||||
/doc/html/boost_asio/reference/windows__basic_object_handle__rebind_executor.html
|
||||
/doc/html/boost_asio/reference/windows__basic_object_handle__rebind_executor/other.html
|
||||
/doc/html/boost_asio/reference/windows__basic_object_handle/wait/
|
||||
/doc/html/boost_asio/reference/windows__basic_object_handle/wait.html
|
||||
/doc/html/boost_asio/reference/windows__basic_object_handle/wait/overload1.html
|
||||
@@ -4267,6 +4305,9 @@
|
||||
/doc/html/boost_asio/reference/windows__basic_overlapped_handle/native_handle.html
|
||||
/doc/html/boost_asio/reference/windows__basic_overlapped_handle/native_handle_type.html
|
||||
/doc/html/boost_asio/reference/windows__basic_overlapped_handle/operator_eq_.html
|
||||
/doc/html/boost_asio/reference/windows__basic_overlapped_handle__rebind_executor/
|
||||
/doc/html/boost_asio/reference/windows__basic_overlapped_handle__rebind_executor.html
|
||||
/doc/html/boost_asio/reference/windows__basic_overlapped_handle__rebind_executor/other.html
|
||||
/doc/html/boost_asio/reference/windows__basic_random_access_handle/
|
||||
/doc/html/boost_asio/reference/windows__basic_random_access_handle/assign/
|
||||
/doc/html/boost_asio/reference/windows__basic_random_access_handle/assign.html
|
||||
@@ -4306,6 +4347,9 @@
|
||||
/doc/html/boost_asio/reference/windows__basic_random_access_handle/read_some_at.html
|
||||
/doc/html/boost_asio/reference/windows__basic_random_access_handle/read_some_at/overload1.html
|
||||
/doc/html/boost_asio/reference/windows__basic_random_access_handle/read_some_at/overload2.html
|
||||
/doc/html/boost_asio/reference/windows__basic_random_access_handle__rebind_executor/
|
||||
/doc/html/boost_asio/reference/windows__basic_random_access_handle__rebind_executor.html
|
||||
/doc/html/boost_asio/reference/windows__basic_random_access_handle__rebind_executor/other.html
|
||||
/doc/html/boost_asio/reference/windows__basic_random_access_handle/write_some_at/
|
||||
/doc/html/boost_asio/reference/windows__basic_random_access_handle/write_some_at.html
|
||||
/doc/html/boost_asio/reference/windows__basic_random_access_handle/write_some_at/overload1.html
|
||||
@@ -4349,6 +4393,9 @@
|
||||
/doc/html/boost_asio/reference/windows__basic_stream_handle/read_some.html
|
||||
/doc/html/boost_asio/reference/windows__basic_stream_handle/read_some/overload1.html
|
||||
/doc/html/boost_asio/reference/windows__basic_stream_handle/read_some/overload2.html
|
||||
/doc/html/boost_asio/reference/windows__basic_stream_handle__rebind_executor/
|
||||
/doc/html/boost_asio/reference/windows__basic_stream_handle__rebind_executor.html
|
||||
/doc/html/boost_asio/reference/windows__basic_stream_handle__rebind_executor/other.html
|
||||
/doc/html/boost_asio/reference/windows__basic_stream_handle/write_some/
|
||||
/doc/html/boost_asio/reference/windows__basic_stream_handle/write_some.html
|
||||
/doc/html/boost_asio/reference/windows__basic_stream_handle/write_some/overload1.html
|
||||
@@ -4880,6 +4927,15 @@
|
||||
/libs/asio/example/cpp11/timers/Jamfile.v2
|
||||
/libs/asio/example/cpp11/timers/time_t_timer.cpp
|
||||
/libs/asio/example/cpp14/
|
||||
/libs/asio/example/cpp14/executors/
|
||||
/libs/asio/example/cpp14/executors/actor.cpp
|
||||
/libs/asio/example/cpp14/executors/async_1.cpp
|
||||
/libs/asio/example/cpp14/executors/async_2.cpp
|
||||
/libs/asio/example/cpp14/executors/bank_account_1.cpp
|
||||
/libs/asio/example/cpp14/executors/bank_account_2.cpp
|
||||
/libs/asio/example/cpp14/executors/fork_join.cpp
|
||||
/libs/asio/example/cpp14/executors/pipeline.cpp
|
||||
/libs/asio/example/cpp14/executors/priority_scheduler.cpp
|
||||
/libs/asio/example/cpp14/operations/
|
||||
/libs/asio/example/cpp14/operations/composed_1.cpp
|
||||
/libs/asio/example/cpp14/operations/composed_2.cpp
|
||||
@@ -4894,6 +4950,7 @@
|
||||
/libs/asio/example/cpp17/coroutines_ts/
|
||||
/libs/asio/example/cpp17/coroutines_ts/chat_server.cpp
|
||||
/libs/asio/example/cpp17/coroutines_ts/echo_server.cpp
|
||||
/libs/asio/example/cpp17/coroutines_ts/echo_server_with_default.cpp
|
||||
/libs/asio/example/cpp17/coroutines_ts/range_based_for.cpp
|
||||
/libs/asio/example/cpp17/coroutines_ts/refactored_echo_server.cpp
|
||||
/libs/asio/index.html
|
||||
@@ -5112,10 +5169,14 @@
|
||||
/libs/system/test/single_instance_test.cpp
|
||||
/libs/system/test/std_interop_test.cpp
|
||||
/libs/system/test/std_mismatch_test.cpp
|
||||
/libs/system/test/std_single_instance_1.cpp
|
||||
/libs/system/test/std_single_instance_2.cpp
|
||||
/libs/system/test/std_single_instance_test.cpp
|
||||
/libs/system/test/system_category_test.cpp
|
||||
/libs/system/test/system_error_test.cpp
|
||||
/libs/system/test/throws_assign_fail.cpp
|
||||
/libs/system/test/throw_test.cpp
|
||||
/libs/system/test/warnings_test.cpp
|
||||
/libs/system/test/win32_hresult_test.cpp
|
||||
/libs/system/.travis.yml
|
||||
/README.txt
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
AC_INIT(asio, [1.14.0])
|
||||
AC_INIT(asio, [1.16.0])
|
||||
AC_CONFIG_SRCDIR(include/asio.hpp)
|
||||
AM_MAINTAINER_MODE
|
||||
AM_INIT_AUTOMAKE([tar-ustar])
|
||||
|
||||
@@ -23,6 +23,66 @@
|
||||
|
||||
namespace asio {
|
||||
|
||||
#if defined(ASIO_HAS_CONCEPTS) \
|
||||
&& defined(ASIO_HAS_VARIADIC_TEMPLATES) \
|
||||
&& defined(ASIO_HAS_DECLTYPE)
|
||||
|
||||
namespace detail {
|
||||
|
||||
template <typename T>
|
||||
struct is_completion_signature : false_type
|
||||
{
|
||||
};
|
||||
|
||||
template <typename R, typename... Args>
|
||||
struct is_completion_signature<R(Args...)> : true_type
|
||||
{
|
||||
};
|
||||
|
||||
template <typename T, typename... Args>
|
||||
ASIO_CONCEPT callable_with = requires(T t, Args&&... args)
|
||||
{
|
||||
t(static_cast<Args&&>(args)...);
|
||||
};
|
||||
|
||||
template <typename T, typename Signature>
|
||||
struct is_completion_handler_for : false_type
|
||||
{
|
||||
};
|
||||
|
||||
template <typename T, typename R, typename... Args>
|
||||
struct is_completion_handler_for<T, R(Args...)>
|
||||
: integral_constant<bool, (callable_with<T, Args...>)>
|
||||
{
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
|
||||
template <typename T>
|
||||
ASIO_CONCEPT completion_signature =
|
||||
detail::is_completion_signature<T>::value;
|
||||
|
||||
#define ASIO_COMPLETION_SIGNATURE \
|
||||
::asio::completion_signature
|
||||
|
||||
template <typename T, completion_signature Signature>
|
||||
ASIO_CONCEPT completion_handler_for =
|
||||
detail::is_completion_handler_for<T, Signature>::value;
|
||||
|
||||
#define ASIO_COMPLETION_HANDLER_FOR(s) \
|
||||
::asio::completion_handler_for<s>
|
||||
|
||||
#else // defined(ASIO_HAS_CONCEPTS)
|
||||
// && defined(ASIO_HAS_VARIADIC_TEMPLATES)
|
||||
// && defined(ASIO_HAS_DECLTYPE)
|
||||
|
||||
#define ASIO_COMPLETION_SIGNATURE typename
|
||||
#define ASIO_COMPLETION_HANDLER_FOR(s) typename
|
||||
|
||||
#endif // defined(ASIO_HAS_CONCEPTS)
|
||||
// && defined(ASIO_HAS_VARIADIC_TEMPLATES)
|
||||
// && defined(ASIO_HAS_DECLTYPE)
|
||||
|
||||
/// An interface for customising the behaviour of an initiating function.
|
||||
/**
|
||||
* The async_result traits class is used for determining:
|
||||
@@ -41,7 +101,7 @@ namespace asio {
|
||||
* The primary template assumes that the CompletionToken is the completion
|
||||
* handler.
|
||||
*/
|
||||
template <typename CompletionToken, typename Signature>
|
||||
template <typename CompletionToken, ASIO_COMPLETION_SIGNATURE Signature>
|
||||
class async_result
|
||||
{
|
||||
public:
|
||||
@@ -67,12 +127,21 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
#if defined(ASIO_HAS_VARIADIC_TEMPLATES) \
|
||||
|| defined(GENERATING_DOCUMENTATION)
|
||||
#if defined(GENERATING_DOCUMENTATION)
|
||||
|
||||
/// Initiate the asynchronous operation that will produce the result, and
|
||||
/// obtain the value to be returned from the initiating function.
|
||||
template <typename Initiation, typename RawCompletionToken, typename... Args>
|
||||
static return_type initiate(
|
||||
ASIO_MOVE_ARG(Initiation) initiation,
|
||||
ASIO_MOVE_ARG(RawCompletionToken) token,
|
||||
ASIO_MOVE_ARG(Args)... args);
|
||||
|
||||
#elif defined(ASIO_HAS_VARIADIC_TEMPLATES)
|
||||
|
||||
template <typename Initiation,
|
||||
ASIO_COMPLETION_HANDLER_FOR(Signature) RawCompletionToken,
|
||||
typename... Args>
|
||||
static return_type initiate(
|
||||
ASIO_MOVE_ARG(Initiation) initiation,
|
||||
ASIO_MOVE_ARG(RawCompletionToken) token,
|
||||
@@ -84,9 +153,9 @@ public:
|
||||
}
|
||||
|
||||
#else // defined(ASIO_HAS_VARIADIC_TEMPLATES)
|
||||
// || defined(GENERATING_DOCUMENTATION)
|
||||
|
||||
template <typename Initiation, typename RawCompletionToken>
|
||||
template <typename Initiation,
|
||||
ASIO_COMPLETION_HANDLER_FOR(Signature) RawCompletionToken>
|
||||
static return_type initiate(
|
||||
ASIO_MOVE_ARG(Initiation) initiation,
|
||||
ASIO_MOVE_ARG(RawCompletionToken) token)
|
||||
@@ -96,7 +165,8 @@ public:
|
||||
}
|
||||
|
||||
#define ASIO_PRIVATE_INITIATE_DEF(n) \
|
||||
template <typename Initiation, typename RawCompletionToken, \
|
||||
template <typename Initiation, \
|
||||
ASIO_COMPLETION_HANDLER_FOR(Signature) RawCompletionToken, \
|
||||
ASIO_VARIADIC_TPARAMS(n)> \
|
||||
static return_type initiate( \
|
||||
ASIO_MOVE_ARG(Initiation) initiation, \
|
||||
@@ -112,17 +182,26 @@ public:
|
||||
#undef ASIO_PRIVATE_INITIATE_DEF
|
||||
|
||||
#endif // defined(ASIO_HAS_VARIADIC_TEMPLATES)
|
||||
// || defined(GENERATING_DOCUMENTATION)
|
||||
|
||||
private:
|
||||
async_result(const async_result&) ASIO_DELETED;
|
||||
async_result& operator=(const async_result&) ASIO_DELETED;
|
||||
};
|
||||
|
||||
#if !defined(GENERATING_DOCUMENTATION)
|
||||
|
||||
template <ASIO_COMPLETION_SIGNATURE Signature>
|
||||
class async_result<void, Signature>
|
||||
{
|
||||
// Empty.
|
||||
};
|
||||
|
||||
#endif // !defined(GENERATING_DOCUMENTATION)
|
||||
|
||||
/// Helper template to deduce the handler type from a CompletionToken, capture
|
||||
/// a local copy of the handler, and then create an async_result for the
|
||||
/// handler.
|
||||
template <typename CompletionToken, typename Signature>
|
||||
template <typename CompletionToken, ASIO_COMPLETION_SIGNATURE Signature>
|
||||
struct async_completion
|
||||
{
|
||||
/// The real handler type to be used for the asynchronous operation.
|
||||
@@ -232,22 +311,50 @@ struct async_result_has_initiate_memfn
|
||||
typename ::asio::decay<ct>::type, sig>::completion_handler_type
|
||||
#endif
|
||||
|
||||
#if defined(GENERATION_DOCUMENTATION)
|
||||
# define ASIO_INITFN_AUTO_RESULT_TYPE(ct, sig) \
|
||||
auto
|
||||
#elif defined(ASIO_HAS_RETURN_TYPE_DEDUCTION)
|
||||
# define ASIO_INITFN_AUTO_RESULT_TYPE(ct, sig) \
|
||||
auto
|
||||
#else
|
||||
# define ASIO_INITFN_AUTO_RESULT_TYPE(ct, sig) \
|
||||
ASIO_INITFN_RESULT_TYPE(ct, sig)
|
||||
#endif
|
||||
|
||||
#if defined(GENERATION_DOCUMENTATION)
|
||||
# define ASIO_INITFN_DEDUCED_RESULT_TYPE(ct, sig, expr) \
|
||||
void_or_deduced
|
||||
#elif defined(ASIO_HAS_DECLTYPE)
|
||||
# define ASIO_INITFN_DEDUCED_RESULT_TYPE(ct, sig, expr) \
|
||||
decltype expr
|
||||
#else
|
||||
# define ASIO_INITFN_DEDUCED_RESULT_TYPE(ct, sig, expr) \
|
||||
ASIO_INITFN_RESULT_TYPE(ct, sig)
|
||||
#endif
|
||||
|
||||
#if defined(GENERATING_DOCUMENTATION)
|
||||
|
||||
template <typename CompletionToken, typename Signature,
|
||||
template <typename CompletionToken,
|
||||
completion_signature Signature,
|
||||
typename Initiation, typename... Args>
|
||||
ASIO_INITFN_RESULT_TYPE(CompletionToken, Signature)
|
||||
async_initiate(ASIO_MOVE_ARG(Initiation) initiation,
|
||||
void_or_deduced async_initiate(
|
||||
ASIO_MOVE_ARG(Initiation) initiation,
|
||||
ASIO_NONDEDUCED_MOVE_ARG(CompletionToken),
|
||||
ASIO_MOVE_ARG(Args)... args);
|
||||
|
||||
#elif defined(ASIO_HAS_VARIADIC_TEMPLATES)
|
||||
|
||||
template <typename CompletionToken, typename Signature,
|
||||
template <typename CompletionToken,
|
||||
ASIO_COMPLETION_SIGNATURE Signature,
|
||||
typename Initiation, typename... Args>
|
||||
inline typename enable_if<
|
||||
detail::async_result_has_initiate_memfn<CompletionToken, Signature>::value,
|
||||
ASIO_INITFN_RESULT_TYPE(CompletionToken, Signature)>::type
|
||||
ASIO_INITFN_DEDUCED_RESULT_TYPE(CompletionToken, Signature,
|
||||
(async_result<typename decay<CompletionToken>::type,
|
||||
Signature>::initiate(declval<ASIO_MOVE_ARG(Initiation)>(),
|
||||
declval<ASIO_MOVE_ARG(CompletionToken)>(),
|
||||
declval<ASIO_MOVE_ARG(Args)>()...)))>::type
|
||||
async_initiate(ASIO_MOVE_ARG(Initiation) initiation,
|
||||
ASIO_NONDEDUCED_MOVE_ARG(CompletionToken) token,
|
||||
ASIO_MOVE_ARG(Args)... args)
|
||||
@@ -258,7 +365,8 @@ async_initiate(ASIO_MOVE_ARG(Initiation) initiation,
|
||||
ASIO_MOVE_CAST(Args)(args)...);
|
||||
}
|
||||
|
||||
template <typename CompletionToken, typename Signature,
|
||||
template <typename CompletionToken,
|
||||
ASIO_COMPLETION_SIGNATURE Signature,
|
||||
typename Initiation, typename... Args>
|
||||
inline typename enable_if<
|
||||
!detail::async_result_has_initiate_memfn<CompletionToken, Signature>::value,
|
||||
@@ -279,10 +387,15 @@ async_initiate(ASIO_MOVE_ARG(Initiation) initiation,
|
||||
|
||||
#else // defined(ASIO_HAS_VARIADIC_TEMPLATES)
|
||||
|
||||
template <typename CompletionToken, typename Signature, typename Initiation>
|
||||
template <typename CompletionToken,
|
||||
ASIO_COMPLETION_SIGNATURE Signature,
|
||||
typename Initiation>
|
||||
inline typename enable_if<
|
||||
detail::async_result_has_initiate_memfn<CompletionToken, Signature>::value,
|
||||
ASIO_INITFN_RESULT_TYPE(CompletionToken, Signature)>::type
|
||||
ASIO_INITFN_DEDUCED_RESULT_TYPE(CompletionToken, Signature,
|
||||
(async_result<typename decay<CompletionToken>::type,
|
||||
Signature>::initiate(declval<ASIO_MOVE_ARG(Initiation)>(),
|
||||
declval<ASIO_MOVE_ARG(CompletionToken)>())))>::type
|
||||
async_initiate(ASIO_MOVE_ARG(Initiation) initiation,
|
||||
ASIO_NONDEDUCED_MOVE_ARG(CompletionToken) token)
|
||||
{
|
||||
@@ -291,7 +404,9 @@ async_initiate(ASIO_MOVE_ARG(Initiation) initiation,
|
||||
ASIO_MOVE_CAST(CompletionToken)(token));
|
||||
}
|
||||
|
||||
template <typename CompletionToken, typename Signature, typename Initiation>
|
||||
template <typename CompletionToken,
|
||||
ASIO_COMPLETION_SIGNATURE Signature,
|
||||
typename Initiation>
|
||||
inline typename enable_if<
|
||||
!detail::async_result_has_initiate_memfn<CompletionToken, Signature>::value,
|
||||
ASIO_INITFN_RESULT_TYPE(CompletionToken, Signature)>::type
|
||||
@@ -308,12 +423,17 @@ async_initiate(ASIO_MOVE_ARG(Initiation) initiation,
|
||||
}
|
||||
|
||||
#define ASIO_PRIVATE_INITIATE_DEF(n) \
|
||||
template <typename CompletionToken, typename Signature, \
|
||||
template <typename CompletionToken, \
|
||||
ASIO_COMPLETION_SIGNATURE Signature, \
|
||||
typename Initiation, ASIO_VARIADIC_TPARAMS(n)> \
|
||||
inline typename enable_if< \
|
||||
detail::async_result_has_initiate_memfn< \
|
||||
CompletionToken, Signature>::value, \
|
||||
ASIO_INITFN_RESULT_TYPE(CompletionToken, Signature)>::type \
|
||||
ASIO_INITFN_DEDUCED_RESULT_TYPE(CompletionToken, Signature, \
|
||||
(async_result<typename decay<CompletionToken>::type, \
|
||||
Signature>::initiate(declval<ASIO_MOVE_ARG(Initiation)>(), \
|
||||
declval<ASIO_MOVE_ARG(CompletionToken)>(), \
|
||||
ASIO_VARIADIC_MOVE_DECLVAL(n))))>::type \
|
||||
async_initiate(ASIO_MOVE_ARG(Initiation) initiation, \
|
||||
ASIO_NONDEDUCED_MOVE_ARG(CompletionToken) token, \
|
||||
ASIO_VARIADIC_MOVE_PARAMS(n)) \
|
||||
@@ -324,7 +444,8 @@ async_initiate(ASIO_MOVE_ARG(Initiation) initiation,
|
||||
ASIO_VARIADIC_MOVE_ARGS(n)); \
|
||||
} \
|
||||
\
|
||||
template <typename CompletionToken, typename Signature, \
|
||||
template <typename CompletionToken, \
|
||||
ASIO_COMPLETION_SIGNATURE Signature, \
|
||||
typename Initiation, ASIO_VARIADIC_TPARAMS(n)> \
|
||||
inline typename enable_if< \
|
||||
!detail::async_result_has_initiate_memfn< \
|
||||
@@ -349,6 +470,114 @@ async_initiate(ASIO_MOVE_ARG(Initiation) initiation,
|
||||
|
||||
#endif // defined(ASIO_HAS_VARIADIC_TEMPLATES)
|
||||
|
||||
#if defined(ASIO_HAS_CONCEPTS) \
|
||||
&& defined(ASIO_HAS_VARIADIC_TEMPLATES) \
|
||||
&& defined(ASIO_HAS_DECLTYPE)
|
||||
|
||||
namespace detail {
|
||||
|
||||
template <typename Signature>
|
||||
struct initiation_archetype
|
||||
{
|
||||
template <completion_handler_for<Signature> CompletionHandler>
|
||||
void operator()(CompletionHandler&&) const
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
|
||||
template <typename T, completion_signature Signature>
|
||||
ASIO_CONCEPT completion_token_for = requires(T&& t)
|
||||
{
|
||||
async_initiate<T, Signature>(detail::initiation_archetype<Signature>{}, t);
|
||||
};
|
||||
|
||||
#define ASIO_COMPLETION_TOKEN_FOR(s) \
|
||||
::asio::completion_token_for<s>
|
||||
|
||||
#else // defined(ASIO_HAS_CONCEPTS)
|
||||
// && defined(ASIO_HAS_VARIADIC_TEMPLATES)
|
||||
// && defined(ASIO_HAS_DECLTYPE)
|
||||
|
||||
#define ASIO_COMPLETION_TOKEN_FOR(s) typename
|
||||
|
||||
#endif // defined(ASIO_HAS_CONCEPTS)
|
||||
// && defined(ASIO_HAS_VARIADIC_TEMPLATES)
|
||||
// && defined(ASIO_HAS_DECLTYPE)
|
||||
|
||||
namespace detail {
|
||||
|
||||
template <typename>
|
||||
struct default_completion_token_check
|
||||
{
|
||||
typedef void type;
|
||||
};
|
||||
|
||||
template <typename T, typename = void>
|
||||
struct default_completion_token_impl
|
||||
{
|
||||
typedef void type;
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct default_completion_token_impl<T,
|
||||
typename default_completion_token_check<
|
||||
typename T::default_completion_token_type>::type>
|
||||
{
|
||||
typedef typename T::default_completion_token_type type;
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
|
||||
#if defined(GENERATING_DOCUMENTATION)
|
||||
|
||||
/// Traits type used to determine the default completion token type associated
|
||||
/// with a type (such as an executor).
|
||||
/**
|
||||
* A program may specialise this traits type if the @c T template parameter in
|
||||
* the specialisation is a user-defined type.
|
||||
*
|
||||
* Specialisations of this trait may provide a nested typedef @c type, which is
|
||||
* a default-constructible completion token type.
|
||||
*/
|
||||
template <typename T>
|
||||
struct default_completion_token
|
||||
{
|
||||
/// If @c T has a nested type @c default_completion_token_type,
|
||||
/// <tt>T::default_completion_token_type</tt>. Otherwise the typedef @c type
|
||||
/// is not defined.
|
||||
typedef see_below type;
|
||||
};
|
||||
#else
|
||||
template <typename T>
|
||||
struct default_completion_token
|
||||
: detail::default_completion_token_impl<T>
|
||||
{
|
||||
};
|
||||
#endif
|
||||
|
||||
#if defined(ASIO_HAS_ALIAS_TEMPLATES)
|
||||
|
||||
template <typename T>
|
||||
using default_completion_token_t = typename default_completion_token<T>::type;
|
||||
|
||||
#endif // defined(ASIO_HAS_ALIAS_TEMPLATES)
|
||||
|
||||
#if defined(ASIO_HAS_DEFAULT_FUNCTION_TEMPLATE_ARGUMENTS)
|
||||
|
||||
#define ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(e) \
|
||||
= typename ::asio::default_completion_token<e>::type
|
||||
#define ASIO_DEFAULT_COMPLETION_TOKEN(e) \
|
||||
= typename ::asio::default_completion_token<e>::type()
|
||||
|
||||
#else // defined(ASIO_HAS_DEFAULT_FUNCTION_TEMPLATE_ARGUMENTS)
|
||||
|
||||
#define ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(e)
|
||||
#define ASIO_DEFAULT_COMPLETION_TOKEN(e)
|
||||
|
||||
#endif // defined(ASIO_HAS_DEFAULT_FUNCTION_TEMPLATE_ARGUMENTS)
|
||||
|
||||
} // namespace asio
|
||||
|
||||
#include "asio/detail/pop_options.hpp"
|
||||
|
||||
@@ -248,7 +248,7 @@ public:
|
||||
* constructed using the @c basic_datagram_socket(const executor_type&)
|
||||
* constructor.
|
||||
*/
|
||||
basic_datagram_socket(basic_datagram_socket&& other)
|
||||
basic_datagram_socket(basic_datagram_socket&& other) ASIO_NOEXCEPT
|
||||
: basic_socket<Protocol, Executor>(std::move(other))
|
||||
{
|
||||
}
|
||||
@@ -447,15 +447,19 @@ public:
|
||||
* buffers in one go, and how to use it with arrays, boost::array or
|
||||
* std::vector.
|
||||
*/
|
||||
template <typename ConstBufferSequence, typename WriteHandler>
|
||||
ASIO_INITFN_RESULT_TYPE(WriteHandler,
|
||||
template <typename ConstBufferSequence,
|
||||
ASIO_COMPLETION_TOKEN_FOR(void (asio::error_code,
|
||||
std::size_t)) WriteHandler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(executor_type)>
|
||||
ASIO_INITFN_AUTO_RESULT_TYPE(WriteHandler,
|
||||
void (asio::error_code, std::size_t))
|
||||
async_send(const ConstBufferSequence& buffers,
|
||||
ASIO_MOVE_ARG(WriteHandler) handler)
|
||||
ASIO_MOVE_ARG(WriteHandler) handler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN(executor_type))
|
||||
{
|
||||
return async_initiate<WriteHandler,
|
||||
void (asio::error_code, std::size_t)>(
|
||||
initiate_async_send(), handler, this,
|
||||
initiate_async_send(this), handler,
|
||||
buffers, socket_base::message_flags(0));
|
||||
}
|
||||
|
||||
@@ -487,16 +491,20 @@ public:
|
||||
* Use the async_send_to function to send data on an unconnected datagram
|
||||
* socket.
|
||||
*/
|
||||
template <typename ConstBufferSequence, typename WriteHandler>
|
||||
ASIO_INITFN_RESULT_TYPE(WriteHandler,
|
||||
template <typename ConstBufferSequence,
|
||||
ASIO_COMPLETION_TOKEN_FOR(void (asio::error_code,
|
||||
std::size_t)) WriteHandler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(executor_type)>
|
||||
ASIO_INITFN_AUTO_RESULT_TYPE(WriteHandler,
|
||||
void (asio::error_code, std::size_t))
|
||||
async_send(const ConstBufferSequence& buffers,
|
||||
socket_base::message_flags flags,
|
||||
ASIO_MOVE_ARG(WriteHandler) handler)
|
||||
ASIO_MOVE_ARG(WriteHandler) handler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN(executor_type))
|
||||
{
|
||||
return async_initiate<WriteHandler,
|
||||
void (asio::error_code, std::size_t)>(
|
||||
initiate_async_send(), handler, this, buffers, flags);
|
||||
initiate_async_send(this), handler, buffers, flags);
|
||||
}
|
||||
|
||||
/// Send a datagram to the specified endpoint.
|
||||
@@ -624,16 +632,20 @@ public:
|
||||
* buffers in one go, and how to use it with arrays, boost::array or
|
||||
* std::vector.
|
||||
*/
|
||||
template <typename ConstBufferSequence, typename WriteHandler>
|
||||
ASIO_INITFN_RESULT_TYPE(WriteHandler,
|
||||
template <typename ConstBufferSequence,
|
||||
ASIO_COMPLETION_TOKEN_FOR(void (asio::error_code,
|
||||
std::size_t)) WriteHandler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(executor_type)>
|
||||
ASIO_INITFN_AUTO_RESULT_TYPE(WriteHandler,
|
||||
void (asio::error_code, std::size_t))
|
||||
async_send_to(const ConstBufferSequence& buffers,
|
||||
const endpoint_type& destination,
|
||||
ASIO_MOVE_ARG(WriteHandler) handler)
|
||||
ASIO_MOVE_ARG(WriteHandler) handler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN(executor_type))
|
||||
{
|
||||
return async_initiate<WriteHandler,
|
||||
void (asio::error_code, std::size_t)>(
|
||||
initiate_async_send_to(), handler, this, buffers,
|
||||
initiate_async_send_to(this), handler, buffers,
|
||||
destination, socket_base::message_flags(0));
|
||||
}
|
||||
|
||||
@@ -664,16 +676,20 @@ public:
|
||||
* immediate completion, invocation of the handler will be performed in a
|
||||
* manner equivalent to using asio::post().
|
||||
*/
|
||||
template <typename ConstBufferSequence, typename WriteHandler>
|
||||
ASIO_INITFN_RESULT_TYPE(WriteHandler,
|
||||
template <typename ConstBufferSequence,
|
||||
ASIO_COMPLETION_TOKEN_FOR(void (asio::error_code,
|
||||
std::size_t)) WriteHandler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(executor_type)>
|
||||
ASIO_INITFN_AUTO_RESULT_TYPE(WriteHandler,
|
||||
void (asio::error_code, std::size_t))
|
||||
async_send_to(const ConstBufferSequence& buffers,
|
||||
const endpoint_type& destination, socket_base::message_flags flags,
|
||||
ASIO_MOVE_ARG(WriteHandler) handler)
|
||||
ASIO_MOVE_ARG(WriteHandler) handler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN(executor_type))
|
||||
{
|
||||
return async_initiate<WriteHandler,
|
||||
void (asio::error_code, std::size_t)>(
|
||||
initiate_async_send_to(), handler, this, buffers, destination, flags);
|
||||
initiate_async_send_to(this), handler, buffers, destination, flags);
|
||||
}
|
||||
|
||||
/// Receive some data on a connected socket.
|
||||
@@ -801,15 +817,19 @@ public:
|
||||
* multiple buffers in one go, and how to use it with arrays, boost::array or
|
||||
* std::vector.
|
||||
*/
|
||||
template <typename MutableBufferSequence, typename ReadHandler>
|
||||
ASIO_INITFN_RESULT_TYPE(ReadHandler,
|
||||
template <typename MutableBufferSequence,
|
||||
ASIO_COMPLETION_TOKEN_FOR(void (asio::error_code,
|
||||
std::size_t)) ReadHandler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(executor_type)>
|
||||
ASIO_INITFN_AUTO_RESULT_TYPE(ReadHandler,
|
||||
void (asio::error_code, std::size_t))
|
||||
async_receive(const MutableBufferSequence& buffers,
|
||||
ASIO_MOVE_ARG(ReadHandler) handler)
|
||||
ASIO_MOVE_ARG(ReadHandler) handler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN(executor_type))
|
||||
{
|
||||
return async_initiate<ReadHandler,
|
||||
void (asio::error_code, std::size_t)>(
|
||||
initiate_async_receive(), handler, this,
|
||||
initiate_async_receive(this), handler,
|
||||
buffers, socket_base::message_flags(0));
|
||||
}
|
||||
|
||||
@@ -841,16 +861,20 @@ public:
|
||||
* Use the async_receive_from function to receive data on an unconnected
|
||||
* datagram socket.
|
||||
*/
|
||||
template <typename MutableBufferSequence, typename ReadHandler>
|
||||
ASIO_INITFN_RESULT_TYPE(ReadHandler,
|
||||
template <typename MutableBufferSequence,
|
||||
ASIO_COMPLETION_TOKEN_FOR(void (asio::error_code,
|
||||
std::size_t)) ReadHandler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(executor_type)>
|
||||
ASIO_INITFN_AUTO_RESULT_TYPE(ReadHandler,
|
||||
void (asio::error_code, std::size_t))
|
||||
async_receive(const MutableBufferSequence& buffers,
|
||||
socket_base::message_flags flags,
|
||||
ASIO_MOVE_ARG(ReadHandler) handler)
|
||||
ASIO_MOVE_ARG(ReadHandler) handler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN(executor_type))
|
||||
{
|
||||
return async_initiate<ReadHandler,
|
||||
void (asio::error_code, std::size_t)>(
|
||||
initiate_async_receive(), handler, this, buffers, flags);
|
||||
initiate_async_receive(this), handler, buffers, flags);
|
||||
}
|
||||
|
||||
/// Receive a datagram with the endpoint of the sender.
|
||||
@@ -978,16 +1002,20 @@ public:
|
||||
* multiple buffers in one go, and how to use it with arrays, boost::array or
|
||||
* std::vector.
|
||||
*/
|
||||
template <typename MutableBufferSequence, typename ReadHandler>
|
||||
ASIO_INITFN_RESULT_TYPE(ReadHandler,
|
||||
template <typename MutableBufferSequence,
|
||||
ASIO_COMPLETION_TOKEN_FOR(void (asio::error_code,
|
||||
std::size_t)) ReadHandler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(executor_type)>
|
||||
ASIO_INITFN_AUTO_RESULT_TYPE(ReadHandler,
|
||||
void (asio::error_code, std::size_t))
|
||||
async_receive_from(const MutableBufferSequence& buffers,
|
||||
endpoint_type& sender_endpoint,
|
||||
ASIO_MOVE_ARG(ReadHandler) handler)
|
||||
ASIO_MOVE_ARG(ReadHandler) handler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN(executor_type))
|
||||
{
|
||||
return async_initiate<ReadHandler,
|
||||
void (asio::error_code, std::size_t)>(
|
||||
initiate_async_receive_from(), handler, this, buffers,
|
||||
initiate_async_receive_from(this), handler, buffers,
|
||||
&sender_endpoint, socket_base::message_flags(0));
|
||||
}
|
||||
|
||||
@@ -1020,25 +1048,42 @@ public:
|
||||
* immediate completion, invocation of the handler will be performed in a
|
||||
* manner equivalent to using asio::post().
|
||||
*/
|
||||
template <typename MutableBufferSequence, typename ReadHandler>
|
||||
ASIO_INITFN_RESULT_TYPE(ReadHandler,
|
||||
template <typename MutableBufferSequence,
|
||||
ASIO_COMPLETION_TOKEN_FOR(void (asio::error_code,
|
||||
std::size_t)) ReadHandler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(executor_type)>
|
||||
ASIO_INITFN_AUTO_RESULT_TYPE(ReadHandler,
|
||||
void (asio::error_code, std::size_t))
|
||||
async_receive_from(const MutableBufferSequence& buffers,
|
||||
endpoint_type& sender_endpoint, socket_base::message_flags flags,
|
||||
ASIO_MOVE_ARG(ReadHandler) handler)
|
||||
ASIO_MOVE_ARG(ReadHandler) handler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN(executor_type))
|
||||
{
|
||||
return async_initiate<ReadHandler,
|
||||
void (asio::error_code, std::size_t)>(
|
||||
initiate_async_receive_from(), handler,
|
||||
this, buffers, &sender_endpoint, flags);
|
||||
initiate_async_receive_from(this), handler,
|
||||
buffers, &sender_endpoint, flags);
|
||||
}
|
||||
|
||||
private:
|
||||
struct initiate_async_send
|
||||
{
|
||||
class initiate_async_send
|
||||
{
|
||||
public:
|
||||
typedef Executor executor_type;
|
||||
|
||||
explicit initiate_async_send(basic_datagram_socket* self)
|
||||
: self_(self)
|
||||
{
|
||||
}
|
||||
|
||||
executor_type get_executor() const ASIO_NOEXCEPT
|
||||
{
|
||||
return self_->get_executor();
|
||||
}
|
||||
|
||||
template <typename WriteHandler, typename ConstBufferSequence>
|
||||
void operator()(ASIO_MOVE_ARG(WriteHandler) handler,
|
||||
basic_datagram_socket* self, const ConstBufferSequence& buffers,
|
||||
const ConstBufferSequence& buffers,
|
||||
socket_base::message_flags flags) const
|
||||
{
|
||||
// If you get an error on the following line it means that your handler
|
||||
@@ -1046,18 +1091,33 @@ private:
|
||||
ASIO_WRITE_HANDLER_CHECK(WriteHandler, handler) type_check;
|
||||
|
||||
detail::non_const_lvalue<WriteHandler> handler2(handler);
|
||||
self->impl_.get_service().async_send(
|
||||
self->impl_.get_implementation(), buffers, flags,
|
||||
handler2.value, self->impl_.get_implementation_executor());
|
||||
self_->impl_.get_service().async_send(
|
||||
self_->impl_.get_implementation(), buffers, flags,
|
||||
handler2.value, self_->impl_.get_implementation_executor());
|
||||
}
|
||||
|
||||
private:
|
||||
basic_datagram_socket* self_;
|
||||
};
|
||||
|
||||
struct initiate_async_send_to
|
||||
class initiate_async_send_to
|
||||
{
|
||||
public:
|
||||
typedef Executor executor_type;
|
||||
|
||||
explicit initiate_async_send_to(basic_datagram_socket* self)
|
||||
: self_(self)
|
||||
{
|
||||
}
|
||||
|
||||
executor_type get_executor() const ASIO_NOEXCEPT
|
||||
{
|
||||
return self_->get_executor();
|
||||
}
|
||||
|
||||
template <typename WriteHandler, typename ConstBufferSequence>
|
||||
void operator()(ASIO_MOVE_ARG(WriteHandler) handler,
|
||||
basic_datagram_socket* self, const ConstBufferSequence& buffers,
|
||||
const endpoint_type& destination,
|
||||
const ConstBufferSequence& buffers, const endpoint_type& destination,
|
||||
socket_base::message_flags flags) const
|
||||
{
|
||||
// If you get an error on the following line it means that your handler
|
||||
@@ -1065,17 +1125,33 @@ private:
|
||||
ASIO_WRITE_HANDLER_CHECK(WriteHandler, handler) type_check;
|
||||
|
||||
detail::non_const_lvalue<WriteHandler> handler2(handler);
|
||||
self->impl_.get_service().async_send_to(
|
||||
self->impl_.get_implementation(), buffers, destination, flags,
|
||||
handler2.value, self->impl_.get_implementation_executor());
|
||||
self_->impl_.get_service().async_send_to(
|
||||
self_->impl_.get_implementation(), buffers, destination, flags,
|
||||
handler2.value, self_->impl_.get_implementation_executor());
|
||||
}
|
||||
|
||||
private:
|
||||
basic_datagram_socket* self_;
|
||||
};
|
||||
|
||||
struct initiate_async_receive
|
||||
class initiate_async_receive
|
||||
{
|
||||
public:
|
||||
typedef Executor executor_type;
|
||||
|
||||
explicit initiate_async_receive(basic_datagram_socket* self)
|
||||
: self_(self)
|
||||
{
|
||||
}
|
||||
|
||||
executor_type get_executor() const ASIO_NOEXCEPT
|
||||
{
|
||||
return self_->get_executor();
|
||||
}
|
||||
|
||||
template <typename ReadHandler, typename MutableBufferSequence>
|
||||
void operator()(ASIO_MOVE_ARG(ReadHandler) handler,
|
||||
basic_datagram_socket* self, const MutableBufferSequence& buffers,
|
||||
const MutableBufferSequence& buffers,
|
||||
socket_base::message_flags flags) const
|
||||
{
|
||||
// If you get an error on the following line it means that your handler
|
||||
@@ -1083,28 +1159,47 @@ private:
|
||||
ASIO_READ_HANDLER_CHECK(ReadHandler, handler) type_check;
|
||||
|
||||
detail::non_const_lvalue<ReadHandler> handler2(handler);
|
||||
self->impl_.get_service().async_receive(
|
||||
self->impl_.get_implementation(), buffers, flags,
|
||||
handler2.value, self->impl_.get_implementation_executor());
|
||||
self_->impl_.get_service().async_receive(
|
||||
self_->impl_.get_implementation(), buffers, flags,
|
||||
handler2.value, self_->impl_.get_implementation_executor());
|
||||
}
|
||||
|
||||
private:
|
||||
basic_datagram_socket* self_;
|
||||
};
|
||||
|
||||
struct initiate_async_receive_from
|
||||
class initiate_async_receive_from
|
||||
{
|
||||
public:
|
||||
typedef Executor executor_type;
|
||||
|
||||
explicit initiate_async_receive_from(basic_datagram_socket* self)
|
||||
: self_(self)
|
||||
{
|
||||
}
|
||||
|
||||
executor_type get_executor() const ASIO_NOEXCEPT
|
||||
{
|
||||
return self_->get_executor();
|
||||
}
|
||||
|
||||
template <typename ReadHandler, typename MutableBufferSequence>
|
||||
void operator()(ASIO_MOVE_ARG(ReadHandler) handler,
|
||||
basic_datagram_socket* self, const MutableBufferSequence& buffers,
|
||||
endpoint_type* sender_endpoint, socket_base::message_flags flags) const
|
||||
const MutableBufferSequence& buffers, endpoint_type* sender_endpoint,
|
||||
socket_base::message_flags flags) const
|
||||
{
|
||||
// If you get an error on the following line it means that your handler
|
||||
// does not meet the documented type requirements for a ReadHandler.
|
||||
ASIO_READ_HANDLER_CHECK(ReadHandler, handler) type_check;
|
||||
|
||||
detail::non_const_lvalue<ReadHandler> handler2(handler);
|
||||
self->impl_.get_service().async_receive_from(
|
||||
self->impl_.get_implementation(), buffers, *sender_endpoint, flags,
|
||||
handler2.value, self->impl_.get_implementation_executor());
|
||||
self_->impl_.get_service().async_receive_from(
|
||||
self_->impl_.get_implementation(), buffers, *sender_endpoint, flags,
|
||||
handler2.value, self_->impl_.get_implementation_executor());
|
||||
}
|
||||
|
||||
private:
|
||||
basic_datagram_socket* self_;
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
@@ -132,6 +132,14 @@ public:
|
||||
/// The type of the executor associated with the object.
|
||||
typedef Executor executor_type;
|
||||
|
||||
/// Rebinds the timer type to another executor.
|
||||
template <typename Executor1>
|
||||
struct rebind_executor
|
||||
{
|
||||
/// The timer type when rebound to the specified executor.
|
||||
typedef basic_deadline_timer<Time, TimeTraits, Executor1> other;
|
||||
};
|
||||
|
||||
/// The time traits type.
|
||||
typedef TimeTraits traits_type;
|
||||
|
||||
@@ -620,13 +628,17 @@ public:
|
||||
* immediate completion, invocation of the handler will be performed in a
|
||||
* manner equivalent to using asio::post().
|
||||
*/
|
||||
template <typename WaitHandler>
|
||||
ASIO_INITFN_RESULT_TYPE(WaitHandler,
|
||||
template <
|
||||
ASIO_COMPLETION_TOKEN_FOR(void (asio::error_code))
|
||||
WaitHandler ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(executor_type)>
|
||||
ASIO_INITFN_AUTO_RESULT_TYPE(WaitHandler,
|
||||
void (asio::error_code))
|
||||
async_wait(ASIO_MOVE_ARG(WaitHandler) handler)
|
||||
async_wait(
|
||||
ASIO_MOVE_ARG(WaitHandler) handler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN(executor_type))
|
||||
{
|
||||
return async_initiate<WaitHandler, void (asio::error_code)>(
|
||||
initiate_async_wait(), handler, this);
|
||||
initiate_async_wait(this), handler);
|
||||
}
|
||||
|
||||
private:
|
||||
@@ -635,21 +647,36 @@ private:
|
||||
basic_deadline_timer& operator=(
|
||||
const basic_deadline_timer&) ASIO_DELETED;
|
||||
|
||||
struct initiate_async_wait
|
||||
class initiate_async_wait
|
||||
{
|
||||
public:
|
||||
typedef Executor executor_type;
|
||||
|
||||
explicit initiate_async_wait(basic_deadline_timer* self)
|
||||
: self_(self)
|
||||
{
|
||||
}
|
||||
|
||||
executor_type get_executor() const ASIO_NOEXCEPT
|
||||
{
|
||||
return self_->get_executor();
|
||||
}
|
||||
|
||||
template <typename WaitHandler>
|
||||
void operator()(ASIO_MOVE_ARG(WaitHandler) handler,
|
||||
basic_deadline_timer* self) const
|
||||
void operator()(ASIO_MOVE_ARG(WaitHandler) handler) const
|
||||
{
|
||||
// If you get an error on the following line it means that your handler
|
||||
// does not meet the documented type requirements for a WaitHandler.
|
||||
ASIO_WAIT_HANDLER_CHECK(WaitHandler, handler) type_check;
|
||||
|
||||
detail::non_const_lvalue<WaitHandler> handler2(handler);
|
||||
self->impl_.get_service().async_wait(
|
||||
self->impl_.get_implementation(), handler2.value,
|
||||
self->impl_.get_implementation_executor());
|
||||
self_->impl_.get_service().async_wait(
|
||||
self_->impl_.get_implementation(), handler2.value,
|
||||
self_->impl_.get_implementation_executor());
|
||||
}
|
||||
|
||||
private:
|
||||
basic_deadline_timer* self_;
|
||||
};
|
||||
|
||||
detail::io_object_impl<
|
||||
|
||||
@@ -246,7 +246,7 @@ public:
|
||||
* constructed using the @c basic_raw_socket(const executor_type&)
|
||||
* constructor.
|
||||
*/
|
||||
basic_raw_socket(basic_raw_socket&& other)
|
||||
basic_raw_socket(basic_raw_socket&& other) ASIO_NOEXCEPT
|
||||
: basic_socket<Protocol, Executor>(std::move(other))
|
||||
{
|
||||
}
|
||||
@@ -439,15 +439,19 @@ public:
|
||||
* buffers in one go, and how to use it with arrays, boost::array or
|
||||
* std::vector.
|
||||
*/
|
||||
template <typename ConstBufferSequence, typename WriteHandler>
|
||||
ASIO_INITFN_RESULT_TYPE(WriteHandler,
|
||||
template <typename ConstBufferSequence,
|
||||
ASIO_COMPLETION_TOKEN_FOR(void (asio::error_code,
|
||||
std::size_t)) WriteHandler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(executor_type)>
|
||||
ASIO_INITFN_AUTO_RESULT_TYPE(WriteHandler,
|
||||
void (asio::error_code, std::size_t))
|
||||
async_send(const ConstBufferSequence& buffers,
|
||||
ASIO_MOVE_ARG(WriteHandler) handler)
|
||||
ASIO_MOVE_ARG(WriteHandler) handler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN(executor_type))
|
||||
{
|
||||
return async_initiate<WriteHandler,
|
||||
void (asio::error_code, std::size_t)>(
|
||||
initiate_async_send(), handler, this,
|
||||
initiate_async_send(this), handler,
|
||||
buffers, socket_base::message_flags(0));
|
||||
}
|
||||
|
||||
@@ -479,16 +483,20 @@ public:
|
||||
* Use the async_send_to function to send data on an unconnected raw
|
||||
* socket.
|
||||
*/
|
||||
template <typename ConstBufferSequence, typename WriteHandler>
|
||||
ASIO_INITFN_RESULT_TYPE(WriteHandler,
|
||||
template <typename ConstBufferSequence,
|
||||
ASIO_COMPLETION_TOKEN_FOR(void (asio::error_code,
|
||||
std::size_t)) WriteHandler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(executor_type)>
|
||||
ASIO_INITFN_AUTO_RESULT_TYPE(WriteHandler,
|
||||
void (asio::error_code, std::size_t))
|
||||
async_send(const ConstBufferSequence& buffers,
|
||||
socket_base::message_flags flags,
|
||||
ASIO_MOVE_ARG(WriteHandler) handler)
|
||||
ASIO_MOVE_ARG(WriteHandler) handler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN(executor_type))
|
||||
{
|
||||
return async_initiate<WriteHandler,
|
||||
void (asio::error_code, std::size_t)>(
|
||||
initiate_async_send(), handler, this, buffers, flags);
|
||||
initiate_async_send(this), handler, buffers, flags);
|
||||
}
|
||||
|
||||
/// Send raw data to the specified endpoint.
|
||||
@@ -616,16 +624,20 @@ public:
|
||||
* buffers in one go, and how to use it with arrays, boost::array or
|
||||
* std::vector.
|
||||
*/
|
||||
template <typename ConstBufferSequence, typename WriteHandler>
|
||||
ASIO_INITFN_RESULT_TYPE(WriteHandler,
|
||||
template <typename ConstBufferSequence,
|
||||
ASIO_COMPLETION_TOKEN_FOR(void (asio::error_code,
|
||||
std::size_t)) WriteHandler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(executor_type)>
|
||||
ASIO_INITFN_AUTO_RESULT_TYPE(WriteHandler,
|
||||
void (asio::error_code, std::size_t))
|
||||
async_send_to(const ConstBufferSequence& buffers,
|
||||
const endpoint_type& destination,
|
||||
ASIO_MOVE_ARG(WriteHandler) handler)
|
||||
ASIO_MOVE_ARG(WriteHandler) handler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN(executor_type))
|
||||
{
|
||||
return async_initiate<WriteHandler,
|
||||
void (asio::error_code, std::size_t)>(
|
||||
initiate_async_send_to(), handler, this, buffers,
|
||||
initiate_async_send_to(this), handler, buffers,
|
||||
destination, socket_base::message_flags(0));
|
||||
}
|
||||
|
||||
@@ -656,16 +668,20 @@ public:
|
||||
* immediate completion, invocation of the handler will be performed in a
|
||||
* manner equivalent to using asio::post().
|
||||
*/
|
||||
template <typename ConstBufferSequence, typename WriteHandler>
|
||||
ASIO_INITFN_RESULT_TYPE(WriteHandler,
|
||||
template <typename ConstBufferSequence,
|
||||
ASIO_COMPLETION_TOKEN_FOR(void (asio::error_code,
|
||||
std::size_t)) WriteHandler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(executor_type)>
|
||||
ASIO_INITFN_AUTO_RESULT_TYPE(WriteHandler,
|
||||
void (asio::error_code, std::size_t))
|
||||
async_send_to(const ConstBufferSequence& buffers,
|
||||
const endpoint_type& destination, socket_base::message_flags flags,
|
||||
ASIO_MOVE_ARG(WriteHandler) handler)
|
||||
ASIO_MOVE_ARG(WriteHandler) handler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN(executor_type))
|
||||
{
|
||||
return async_initiate<WriteHandler,
|
||||
void (asio::error_code, std::size_t)>(
|
||||
initiate_async_send_to(), handler, this, buffers, destination, flags);
|
||||
initiate_async_send_to(this), handler, buffers, destination, flags);
|
||||
}
|
||||
|
||||
/// Receive some data on a connected socket.
|
||||
@@ -793,15 +809,19 @@ public:
|
||||
* multiple buffers in one go, and how to use it with arrays, boost::array or
|
||||
* std::vector.
|
||||
*/
|
||||
template <typename MutableBufferSequence, typename ReadHandler>
|
||||
ASIO_INITFN_RESULT_TYPE(ReadHandler,
|
||||
template <typename MutableBufferSequence,
|
||||
ASIO_COMPLETION_TOKEN_FOR(void (asio::error_code,
|
||||
std::size_t)) ReadHandler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(executor_type)>
|
||||
ASIO_INITFN_AUTO_RESULT_TYPE(ReadHandler,
|
||||
void (asio::error_code, std::size_t))
|
||||
async_receive(const MutableBufferSequence& buffers,
|
||||
ASIO_MOVE_ARG(ReadHandler) handler)
|
||||
ASIO_MOVE_ARG(ReadHandler) handler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN(executor_type))
|
||||
{
|
||||
return async_initiate<ReadHandler,
|
||||
void (asio::error_code, std::size_t)>(
|
||||
initiate_async_receive(), handler, this,
|
||||
initiate_async_receive(this), handler,
|
||||
buffers, socket_base::message_flags(0));
|
||||
}
|
||||
|
||||
@@ -833,16 +853,20 @@ public:
|
||||
* Use the async_receive_from function to receive data on an unconnected
|
||||
* raw socket.
|
||||
*/
|
||||
template <typename MutableBufferSequence, typename ReadHandler>
|
||||
ASIO_INITFN_RESULT_TYPE(ReadHandler,
|
||||
template <typename MutableBufferSequence,
|
||||
ASIO_COMPLETION_TOKEN_FOR(void (asio::error_code,
|
||||
std::size_t)) ReadHandler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(executor_type)>
|
||||
ASIO_INITFN_AUTO_RESULT_TYPE(ReadHandler,
|
||||
void (asio::error_code, std::size_t))
|
||||
async_receive(const MutableBufferSequence& buffers,
|
||||
socket_base::message_flags flags,
|
||||
ASIO_MOVE_ARG(ReadHandler) handler)
|
||||
ASIO_MOVE_ARG(ReadHandler) handler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN(executor_type))
|
||||
{
|
||||
return async_initiate<ReadHandler,
|
||||
void (asio::error_code, std::size_t)>(
|
||||
initiate_async_receive(), handler, this, buffers, flags);
|
||||
initiate_async_receive(this), handler, buffers, flags);
|
||||
}
|
||||
|
||||
/// Receive raw data with the endpoint of the sender.
|
||||
@@ -970,16 +994,20 @@ public:
|
||||
* multiple buffers in one go, and how to use it with arrays, boost::array or
|
||||
* std::vector.
|
||||
*/
|
||||
template <typename MutableBufferSequence, typename ReadHandler>
|
||||
ASIO_INITFN_RESULT_TYPE(ReadHandler,
|
||||
template <typename MutableBufferSequence,
|
||||
ASIO_COMPLETION_TOKEN_FOR(void (asio::error_code,
|
||||
std::size_t)) ReadHandler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(executor_type)>
|
||||
ASIO_INITFN_AUTO_RESULT_TYPE(ReadHandler,
|
||||
void (asio::error_code, std::size_t))
|
||||
async_receive_from(const MutableBufferSequence& buffers,
|
||||
endpoint_type& sender_endpoint,
|
||||
ASIO_MOVE_ARG(ReadHandler) handler)
|
||||
ASIO_MOVE_ARG(ReadHandler) handler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN(executor_type))
|
||||
{
|
||||
return async_initiate<ReadHandler,
|
||||
void (asio::error_code, std::size_t)>(
|
||||
initiate_async_receive_from(), handler, this, buffers,
|
||||
initiate_async_receive_from(this), handler, buffers,
|
||||
&sender_endpoint, socket_base::message_flags(0));
|
||||
}
|
||||
|
||||
@@ -1012,25 +1040,42 @@ public:
|
||||
* immediate completion, invocation of the handler will be performed in a
|
||||
* manner equivalent to using asio::post().
|
||||
*/
|
||||
template <typename MutableBufferSequence, typename ReadHandler>
|
||||
ASIO_INITFN_RESULT_TYPE(ReadHandler,
|
||||
template <typename MutableBufferSequence,
|
||||
ASIO_COMPLETION_TOKEN_FOR(void (asio::error_code,
|
||||
std::size_t)) ReadHandler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(executor_type)>
|
||||
ASIO_INITFN_AUTO_RESULT_TYPE(ReadHandler,
|
||||
void (asio::error_code, std::size_t))
|
||||
async_receive_from(const MutableBufferSequence& buffers,
|
||||
endpoint_type& sender_endpoint, socket_base::message_flags flags,
|
||||
ASIO_MOVE_ARG(ReadHandler) handler)
|
||||
ASIO_MOVE_ARG(ReadHandler) handler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN(executor_type))
|
||||
{
|
||||
return async_initiate<ReadHandler,
|
||||
void (asio::error_code, std::size_t)>(
|
||||
initiate_async_receive_from(), handler,
|
||||
this, buffers, &sender_endpoint, flags);
|
||||
initiate_async_receive_from(this), handler,
|
||||
buffers, &sender_endpoint, flags);
|
||||
}
|
||||
|
||||
private:
|
||||
struct initiate_async_send
|
||||
class initiate_async_send
|
||||
{
|
||||
public:
|
||||
typedef Executor executor_type;
|
||||
|
||||
explicit initiate_async_send(basic_raw_socket* self)
|
||||
: self_(self)
|
||||
{
|
||||
}
|
||||
|
||||
executor_type get_executor() const ASIO_NOEXCEPT
|
||||
{
|
||||
return self_->get_executor();
|
||||
}
|
||||
|
||||
template <typename WriteHandler, typename ConstBufferSequence>
|
||||
void operator()(ASIO_MOVE_ARG(WriteHandler) handler,
|
||||
basic_raw_socket* self, const ConstBufferSequence& buffers,
|
||||
const ConstBufferSequence& buffers,
|
||||
socket_base::message_flags flags) const
|
||||
{
|
||||
// If you get an error on the following line it means that your handler
|
||||
@@ -1038,18 +1083,33 @@ private:
|
||||
ASIO_WRITE_HANDLER_CHECK(WriteHandler, handler) type_check;
|
||||
|
||||
detail::non_const_lvalue<WriteHandler> handler2(handler);
|
||||
self->impl_.get_service().async_send(
|
||||
self->impl_.get_implementation(), buffers, flags,
|
||||
handler2.value, self->impl_.get_implementation_executor());
|
||||
self_->impl_.get_service().async_send(
|
||||
self_->impl_.get_implementation(), buffers, flags,
|
||||
handler2.value, self_->impl_.get_implementation_executor());
|
||||
}
|
||||
|
||||
private:
|
||||
basic_raw_socket* self_;
|
||||
};
|
||||
|
||||
struct initiate_async_send_to
|
||||
class initiate_async_send_to
|
||||
{
|
||||
public:
|
||||
typedef Executor executor_type;
|
||||
|
||||
explicit initiate_async_send_to(basic_raw_socket* self)
|
||||
: self_(self)
|
||||
{
|
||||
}
|
||||
|
||||
executor_type get_executor() const ASIO_NOEXCEPT
|
||||
{
|
||||
return self_->get_executor();
|
||||
}
|
||||
|
||||
template <typename WriteHandler, typename ConstBufferSequence>
|
||||
void operator()(ASIO_MOVE_ARG(WriteHandler) handler,
|
||||
basic_raw_socket* self, const ConstBufferSequence& buffers,
|
||||
const endpoint_type& destination,
|
||||
const ConstBufferSequence& buffers, const endpoint_type& destination,
|
||||
socket_base::message_flags flags) const
|
||||
{
|
||||
// If you get an error on the following line it means that your handler
|
||||
@@ -1057,17 +1117,33 @@ private:
|
||||
ASIO_WRITE_HANDLER_CHECK(WriteHandler, handler) type_check;
|
||||
|
||||
detail::non_const_lvalue<WriteHandler> handler2(handler);
|
||||
self->impl_.get_service().async_send_to(
|
||||
self->impl_.get_implementation(), buffers, destination, flags,
|
||||
handler2.value, self->impl_.get_implementation_executor());
|
||||
self_->impl_.get_service().async_send_to(
|
||||
self_->impl_.get_implementation(), buffers, destination, flags,
|
||||
handler2.value, self_->impl_.get_implementation_executor());
|
||||
}
|
||||
|
||||
private:
|
||||
basic_raw_socket* self_;
|
||||
};
|
||||
|
||||
struct initiate_async_receive
|
||||
class initiate_async_receive
|
||||
{
|
||||
public:
|
||||
typedef Executor executor_type;
|
||||
|
||||
explicit initiate_async_receive(basic_raw_socket* self)
|
||||
: self_(self)
|
||||
{
|
||||
}
|
||||
|
||||
executor_type get_executor() const ASIO_NOEXCEPT
|
||||
{
|
||||
return self_->get_executor();
|
||||
}
|
||||
|
||||
template <typename ReadHandler, typename MutableBufferSequence>
|
||||
void operator()(ASIO_MOVE_ARG(ReadHandler) handler,
|
||||
basic_raw_socket* self, const MutableBufferSequence& buffers,
|
||||
const MutableBufferSequence& buffers,
|
||||
socket_base::message_flags flags) const
|
||||
{
|
||||
// If you get an error on the following line it means that your handler
|
||||
@@ -1075,28 +1151,47 @@ private:
|
||||
ASIO_READ_HANDLER_CHECK(ReadHandler, handler) type_check;
|
||||
|
||||
detail::non_const_lvalue<ReadHandler> handler2(handler);
|
||||
self->impl_.get_service().async_receive(
|
||||
self->impl_.get_implementation(), buffers, flags,
|
||||
handler2.value, self->impl_.get_implementation_executor());
|
||||
self_->impl_.get_service().async_receive(
|
||||
self_->impl_.get_implementation(), buffers, flags,
|
||||
handler2.value, self_->impl_.get_implementation_executor());
|
||||
}
|
||||
|
||||
private:
|
||||
basic_raw_socket* self_;
|
||||
};
|
||||
|
||||
struct initiate_async_receive_from
|
||||
class initiate_async_receive_from
|
||||
{
|
||||
public:
|
||||
typedef Executor executor_type;
|
||||
|
||||
explicit initiate_async_receive_from(basic_raw_socket* self)
|
||||
: self_(self)
|
||||
{
|
||||
}
|
||||
|
||||
executor_type get_executor() const ASIO_NOEXCEPT
|
||||
{
|
||||
return self_->get_executor();
|
||||
}
|
||||
|
||||
template <typename ReadHandler, typename MutableBufferSequence>
|
||||
void operator()(ASIO_MOVE_ARG(ReadHandler) handler,
|
||||
basic_raw_socket* self, const MutableBufferSequence& buffers,
|
||||
endpoint_type* sender_endpoint, socket_base::message_flags flags) const
|
||||
const MutableBufferSequence& buffers, endpoint_type* sender_endpoint,
|
||||
socket_base::message_flags flags) const
|
||||
{
|
||||
// If you get an error on the following line it means that your handler
|
||||
// does not meet the documented type requirements for a ReadHandler.
|
||||
ASIO_READ_HANDLER_CHECK(ReadHandler, handler) type_check;
|
||||
|
||||
detail::non_const_lvalue<ReadHandler> handler2(handler);
|
||||
self->impl_.get_service().async_receive_from(
|
||||
self->impl_.get_implementation(), buffers, *sender_endpoint, flags,
|
||||
handler2.value, self->impl_.get_implementation_executor());
|
||||
self_->impl_.get_service().async_receive_from(
|
||||
self_->impl_.get_implementation(), buffers, *sender_endpoint, flags,
|
||||
handler2.value, self_->impl_.get_implementation_executor());
|
||||
}
|
||||
|
||||
private:
|
||||
basic_raw_socket* self_;
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
@@ -255,7 +255,7 @@ public:
|
||||
* constructed using the @c basic_seq_packet_socket(const executor_type&)
|
||||
* constructor.
|
||||
*/
|
||||
basic_seq_packet_socket(basic_seq_packet_socket&& other)
|
||||
basic_seq_packet_socket(basic_seq_packet_socket&& other) ASIO_NOEXCEPT
|
||||
: basic_socket<Protocol, Executor>(std::move(other))
|
||||
{
|
||||
}
|
||||
@@ -428,16 +428,20 @@ public:
|
||||
* buffers in one go, and how to use it with arrays, boost::array or
|
||||
* std::vector.
|
||||
*/
|
||||
template <typename ConstBufferSequence, typename WriteHandler>
|
||||
ASIO_INITFN_RESULT_TYPE(WriteHandler,
|
||||
template <typename ConstBufferSequence,
|
||||
ASIO_COMPLETION_TOKEN_FOR(void (asio::error_code,
|
||||
std::size_t)) WriteHandler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(executor_type)>
|
||||
ASIO_INITFN_AUTO_RESULT_TYPE(WriteHandler,
|
||||
void (asio::error_code, std::size_t))
|
||||
async_send(const ConstBufferSequence& buffers,
|
||||
socket_base::message_flags flags,
|
||||
ASIO_MOVE_ARG(WriteHandler) handler)
|
||||
ASIO_MOVE_ARG(WriteHandler) handler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN(executor_type))
|
||||
{
|
||||
return async_initiate<WriteHandler,
|
||||
void (asio::error_code, std::size_t)>(
|
||||
initiate_async_send(), handler, this, buffers, flags);
|
||||
initiate_async_send(this), handler, buffers, flags);
|
||||
}
|
||||
|
||||
/// Receive some data on the socket.
|
||||
@@ -597,16 +601,20 @@ public:
|
||||
* multiple buffers in one go, and how to use it with arrays, boost::array or
|
||||
* std::vector.
|
||||
*/
|
||||
template <typename MutableBufferSequence, typename ReadHandler>
|
||||
ASIO_INITFN_RESULT_TYPE(ReadHandler,
|
||||
template <typename MutableBufferSequence,
|
||||
ASIO_COMPLETION_TOKEN_FOR(void (asio::error_code,
|
||||
std::size_t)) ReadHandler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(executor_type)>
|
||||
ASIO_INITFN_AUTO_RESULT_TYPE(ReadHandler,
|
||||
void (asio::error_code, std::size_t))
|
||||
async_receive(const MutableBufferSequence& buffers,
|
||||
socket_base::message_flags& out_flags,
|
||||
ASIO_MOVE_ARG(ReadHandler) handler)
|
||||
ASIO_MOVE_ARG(ReadHandler) handler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN(executor_type))
|
||||
{
|
||||
return async_initiate<ReadHandler,
|
||||
void (asio::error_code, std::size_t)>(
|
||||
initiate_async_receive_with_flags(), handler, this,
|
||||
initiate_async_receive_with_flags(this), handler,
|
||||
buffers, socket_base::message_flags(0), &out_flags);
|
||||
}
|
||||
|
||||
@@ -652,26 +660,43 @@ public:
|
||||
* multiple buffers in one go, and how to use it with arrays, boost::array or
|
||||
* std::vector.
|
||||
*/
|
||||
template <typename MutableBufferSequence, typename ReadHandler>
|
||||
ASIO_INITFN_RESULT_TYPE(ReadHandler,
|
||||
template <typename MutableBufferSequence,
|
||||
ASIO_COMPLETION_TOKEN_FOR(void (asio::error_code,
|
||||
std::size_t)) ReadHandler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(executor_type)>
|
||||
ASIO_INITFN_AUTO_RESULT_TYPE(ReadHandler,
|
||||
void (asio::error_code, std::size_t))
|
||||
async_receive(const MutableBufferSequence& buffers,
|
||||
socket_base::message_flags in_flags,
|
||||
socket_base::message_flags& out_flags,
|
||||
ASIO_MOVE_ARG(ReadHandler) handler)
|
||||
ASIO_MOVE_ARG(ReadHandler) handler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN(executor_type))
|
||||
{
|
||||
return async_initiate<ReadHandler,
|
||||
void (asio::error_code, std::size_t)>(
|
||||
initiate_async_receive_with_flags(), handler,
|
||||
this, buffers, in_flags, &out_flags);
|
||||
initiate_async_receive_with_flags(this),
|
||||
handler, buffers, in_flags, &out_flags);
|
||||
}
|
||||
|
||||
private:
|
||||
struct initiate_async_send
|
||||
class initiate_async_send
|
||||
{
|
||||
public:
|
||||
typedef Executor executor_type;
|
||||
|
||||
explicit initiate_async_send(basic_seq_packet_socket* self)
|
||||
: self_(self)
|
||||
{
|
||||
}
|
||||
|
||||
executor_type get_executor() const ASIO_NOEXCEPT
|
||||
{
|
||||
return self_->get_executor();
|
||||
}
|
||||
|
||||
template <typename WriteHandler, typename ConstBufferSequence>
|
||||
void operator()(ASIO_MOVE_ARG(WriteHandler) handler,
|
||||
basic_seq_packet_socket* self, const ConstBufferSequence& buffers,
|
||||
const ConstBufferSequence& buffers,
|
||||
socket_base::message_flags flags) const
|
||||
{
|
||||
// If you get an error on the following line it means that your handler
|
||||
@@ -679,17 +704,33 @@ private:
|
||||
ASIO_WRITE_HANDLER_CHECK(WriteHandler, handler) type_check;
|
||||
|
||||
detail::non_const_lvalue<WriteHandler> handler2(handler);
|
||||
self->impl_.get_service().async_send(
|
||||
self->impl_.get_implementation(), buffers, flags,
|
||||
handler2.value, self->impl_.get_implementation_executor());
|
||||
self_->impl_.get_service().async_send(
|
||||
self_->impl_.get_implementation(), buffers, flags,
|
||||
handler2.value, self_->impl_.get_implementation_executor());
|
||||
}
|
||||
|
||||
private:
|
||||
basic_seq_packet_socket* self_;
|
||||
};
|
||||
|
||||
struct initiate_async_receive_with_flags
|
||||
class initiate_async_receive_with_flags
|
||||
{
|
||||
public:
|
||||
typedef Executor executor_type;
|
||||
|
||||
explicit initiate_async_receive_with_flags(basic_seq_packet_socket* self)
|
||||
: self_(self)
|
||||
{
|
||||
}
|
||||
|
||||
executor_type get_executor() const ASIO_NOEXCEPT
|
||||
{
|
||||
return self_->get_executor();
|
||||
}
|
||||
|
||||
template <typename ReadHandler, typename MutableBufferSequence>
|
||||
void operator()(ASIO_MOVE_ARG(ReadHandler) handler,
|
||||
basic_seq_packet_socket* self, const MutableBufferSequence& buffers,
|
||||
const MutableBufferSequence& buffers,
|
||||
socket_base::message_flags in_flags,
|
||||
socket_base::message_flags* out_flags) const
|
||||
{
|
||||
@@ -698,10 +739,13 @@ private:
|
||||
ASIO_READ_HANDLER_CHECK(ReadHandler, handler) type_check;
|
||||
|
||||
detail::non_const_lvalue<ReadHandler> handler2(handler);
|
||||
self->impl_.get_service().async_receive_with_flags(
|
||||
self->impl_.get_implementation(), buffers, in_flags, *out_flags,
|
||||
handler2.value, self->impl_.get_implementation_executor());
|
||||
self_->impl_.get_service().async_receive_with_flags(
|
||||
self_->impl_.get_implementation(), buffers, in_flags, *out_flags,
|
||||
handler2.value, self_->impl_.get_implementation_executor());
|
||||
}
|
||||
|
||||
private:
|
||||
basic_seq_packet_socket* self_;
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
@@ -63,6 +63,14 @@ public:
|
||||
/// The type of the executor associated with the object.
|
||||
typedef Executor executor_type;
|
||||
|
||||
/// Rebinds the serial port type to another executor.
|
||||
template <typename Executor1>
|
||||
struct rebind_executor
|
||||
{
|
||||
/// The serial port type when rebound to the specified executor.
|
||||
typedef basic_serial_port<Executor1> other;
|
||||
};
|
||||
|
||||
/// The native representation of a serial port.
|
||||
#if defined(GENERATING_DOCUMENTATION)
|
||||
typedef implementation_defined native_handle_type;
|
||||
@@ -553,7 +561,7 @@ public:
|
||||
* asio::serial_port_base::character_size
|
||||
*/
|
||||
template <typename GettableSerialPortOption>
|
||||
void get_option(GettableSerialPortOption& option)
|
||||
void get_option(GettableSerialPortOption& option) const
|
||||
{
|
||||
asio::error_code ec;
|
||||
impl_.get_service().get_option(impl_.get_implementation(), option, ec);
|
||||
@@ -578,7 +586,7 @@ public:
|
||||
*/
|
||||
template <typename GettableSerialPortOption>
|
||||
ASIO_SYNC_OP_VOID get_option(GettableSerialPortOption& option,
|
||||
asio::error_code& ec)
|
||||
asio::error_code& ec) const
|
||||
{
|
||||
impl_.get_service().get_option(impl_.get_implementation(), option, ec);
|
||||
ASIO_SYNC_OP_VOID_RETURN(ec);
|
||||
@@ -681,15 +689,19 @@ public:
|
||||
* buffers in one go, and how to use it with arrays, boost::array or
|
||||
* std::vector.
|
||||
*/
|
||||
template <typename ConstBufferSequence, typename WriteHandler>
|
||||
ASIO_INITFN_RESULT_TYPE(WriteHandler,
|
||||
template <typename ConstBufferSequence,
|
||||
ASIO_COMPLETION_TOKEN_FOR(void (asio::error_code,
|
||||
std::size_t)) WriteHandler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(executor_type)>
|
||||
ASIO_INITFN_AUTO_RESULT_TYPE(WriteHandler,
|
||||
void (asio::error_code, std::size_t))
|
||||
async_write_some(const ConstBufferSequence& buffers,
|
||||
ASIO_MOVE_ARG(WriteHandler) handler)
|
||||
ASIO_MOVE_ARG(WriteHandler) handler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN(executor_type))
|
||||
{
|
||||
return async_initiate<WriteHandler,
|
||||
void (asio::error_code, std::size_t)>(
|
||||
initiate_async_write_some(), handler, this, buffers);
|
||||
initiate_async_write_some(this), handler, buffers);
|
||||
}
|
||||
|
||||
/// Read some data from the serial port.
|
||||
@@ -792,15 +804,19 @@ public:
|
||||
* buffers in one go, and how to use it with arrays, boost::array or
|
||||
* std::vector.
|
||||
*/
|
||||
template <typename MutableBufferSequence, typename ReadHandler>
|
||||
ASIO_INITFN_RESULT_TYPE(ReadHandler,
|
||||
template <typename MutableBufferSequence,
|
||||
ASIO_COMPLETION_TOKEN_FOR(void (asio::error_code,
|
||||
std::size_t)) ReadHandler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(executor_type)>
|
||||
ASIO_INITFN_AUTO_RESULT_TYPE(ReadHandler,
|
||||
void (asio::error_code, std::size_t))
|
||||
async_read_some(const MutableBufferSequence& buffers,
|
||||
ASIO_MOVE_ARG(ReadHandler) handler)
|
||||
ASIO_MOVE_ARG(ReadHandler) handler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN(executor_type))
|
||||
{
|
||||
return async_initiate<ReadHandler,
|
||||
void (asio::error_code, std::size_t)>(
|
||||
initiate_async_read_some(), handler, this, buffers);
|
||||
initiate_async_read_some(this), handler, buffers);
|
||||
}
|
||||
|
||||
private:
|
||||
@@ -808,38 +824,70 @@ private:
|
||||
basic_serial_port(const basic_serial_port&) ASIO_DELETED;
|
||||
basic_serial_port& operator=(const basic_serial_port&) ASIO_DELETED;
|
||||
|
||||
struct initiate_async_write_some
|
||||
class initiate_async_write_some
|
||||
{
|
||||
public:
|
||||
typedef Executor executor_type;
|
||||
|
||||
explicit initiate_async_write_some(basic_serial_port* self)
|
||||
: self_(self)
|
||||
{
|
||||
}
|
||||
|
||||
executor_type get_executor() const ASIO_NOEXCEPT
|
||||
{
|
||||
return self_->get_executor();
|
||||
}
|
||||
|
||||
template <typename WriteHandler, typename ConstBufferSequence>
|
||||
void operator()(ASIO_MOVE_ARG(WriteHandler) handler,
|
||||
basic_serial_port* self, const ConstBufferSequence& buffers) const
|
||||
const ConstBufferSequence& buffers) const
|
||||
{
|
||||
// If you get an error on the following line it means that your handler
|
||||
// does not meet the documented type requirements for a WriteHandler.
|
||||
ASIO_WRITE_HANDLER_CHECK(WriteHandler, handler) type_check;
|
||||
|
||||
detail::non_const_lvalue<WriteHandler> handler2(handler);
|
||||
self->impl_.get_service().async_write_some(
|
||||
self->impl_.get_implementation(), buffers, handler2.value,
|
||||
self->impl_.get_implementation_executor());
|
||||
self_->impl_.get_service().async_write_some(
|
||||
self_->impl_.get_implementation(), buffers, handler2.value,
|
||||
self_->impl_.get_implementation_executor());
|
||||
}
|
||||
|
||||
private:
|
||||
basic_serial_port* self_;
|
||||
};
|
||||
|
||||
struct initiate_async_read_some
|
||||
class initiate_async_read_some
|
||||
{
|
||||
public:
|
||||
typedef Executor executor_type;
|
||||
|
||||
explicit initiate_async_read_some(basic_serial_port* self)
|
||||
: self_(self)
|
||||
{
|
||||
}
|
||||
|
||||
executor_type get_executor() const ASIO_NOEXCEPT
|
||||
{
|
||||
return self_->get_executor();
|
||||
}
|
||||
|
||||
template <typename ReadHandler, typename MutableBufferSequence>
|
||||
void operator()(ASIO_MOVE_ARG(ReadHandler) handler,
|
||||
basic_serial_port* self, const MutableBufferSequence& buffers) const
|
||||
const MutableBufferSequence& buffers) const
|
||||
{
|
||||
// If you get an error on the following line it means that your handler
|
||||
// does not meet the documented type requirements for a ReadHandler.
|
||||
ASIO_READ_HANDLER_CHECK(ReadHandler, handler) type_check;
|
||||
|
||||
detail::non_const_lvalue<ReadHandler> handler2(handler);
|
||||
self->impl_.get_service().async_read_some(
|
||||
self->impl_.get_implementation(), buffers, handler2.value,
|
||||
self->impl_.get_implementation_executor());
|
||||
self_->impl_.get_service().async_read_some(
|
||||
self_->impl_.get_implementation(), buffers, handler2.value,
|
||||
self_->impl_.get_implementation_executor());
|
||||
}
|
||||
|
||||
private:
|
||||
basic_serial_port* self_;
|
||||
};
|
||||
|
||||
#if defined(ASIO_HAS_IOCP)
|
||||
|
||||
@@ -97,6 +97,14 @@ public:
|
||||
/// The type of the executor associated with the object.
|
||||
typedef Executor executor_type;
|
||||
|
||||
/// Rebinds the signal set type to another executor.
|
||||
template <typename Executor1>
|
||||
struct rebind_executor
|
||||
{
|
||||
/// The signal set type when rebound to the specified executor.
|
||||
typedef basic_signal_set<Executor1> other;
|
||||
};
|
||||
|
||||
/// Construct a signal set without adding any signals.
|
||||
/**
|
||||
* This constructor creates a signal set without registering for any signals.
|
||||
@@ -502,13 +510,17 @@ public:
|
||||
* immediate completion, invocation of the handler will be performed in a
|
||||
* manner equivalent to using asio::post().
|
||||
*/
|
||||
template <typename SignalHandler>
|
||||
ASIO_INITFN_RESULT_TYPE(SignalHandler,
|
||||
template <
|
||||
ASIO_COMPLETION_TOKEN_FOR(void (asio::error_code, int))
|
||||
SignalHandler ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(executor_type)>
|
||||
ASIO_INITFN_AUTO_RESULT_TYPE(SignalHandler,
|
||||
void (asio::error_code, int))
|
||||
async_wait(ASIO_MOVE_ARG(SignalHandler) handler)
|
||||
async_wait(
|
||||
ASIO_MOVE_ARG(SignalHandler) handler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN(executor_type))
|
||||
{
|
||||
return async_initiate<SignalHandler, void (asio::error_code, int)>(
|
||||
initiate_async_wait(), handler, this);
|
||||
initiate_async_wait(this), handler);
|
||||
}
|
||||
|
||||
private:
|
||||
@@ -516,21 +528,36 @@ private:
|
||||
basic_signal_set(const basic_signal_set&) ASIO_DELETED;
|
||||
basic_signal_set& operator=(const basic_signal_set&) ASIO_DELETED;
|
||||
|
||||
struct initiate_async_wait
|
||||
class initiate_async_wait
|
||||
{
|
||||
public:
|
||||
typedef Executor executor_type;
|
||||
|
||||
explicit initiate_async_wait(basic_signal_set* self)
|
||||
: self_(self)
|
||||
{
|
||||
}
|
||||
|
||||
executor_type get_executor() const ASIO_NOEXCEPT
|
||||
{
|
||||
return self_->get_executor();
|
||||
}
|
||||
|
||||
template <typename SignalHandler>
|
||||
void operator()(ASIO_MOVE_ARG(SignalHandler) handler,
|
||||
basic_signal_set* self) const
|
||||
void operator()(ASIO_MOVE_ARG(SignalHandler) handler) const
|
||||
{
|
||||
// If you get an error on the following line it means that your handler
|
||||
// does not meet the documented type requirements for a SignalHandler.
|
||||
ASIO_SIGNAL_HANDLER_CHECK(SignalHandler, handler) type_check;
|
||||
|
||||
detail::non_const_lvalue<SignalHandler> handler2(handler);
|
||||
self->impl_.get_service().async_wait(
|
||||
self->impl_.get_implementation(), handler2.value,
|
||||
self->impl_.get_implementation_executor());
|
||||
self_->impl_.get_service().async_wait(
|
||||
self_->impl_.get_implementation(), handler2.value,
|
||||
self_->impl_.get_implementation_executor());
|
||||
}
|
||||
|
||||
private:
|
||||
basic_signal_set* self_;
|
||||
};
|
||||
|
||||
detail::io_object_impl<detail::signal_set_service, Executor> impl_;
|
||||
|
||||
@@ -294,7 +294,7 @@ public:
|
||||
* @note Following the move, the moved-from object is in the same state as if
|
||||
* constructed using the @c basic_socket(const executor_type&) constructor.
|
||||
*/
|
||||
basic_socket(basic_socket&& other)
|
||||
basic_socket(basic_socket&& other) ASIO_NOEXCEPT
|
||||
: impl_(std::move(other.impl_))
|
||||
{
|
||||
}
|
||||
@@ -939,11 +939,14 @@ public:
|
||||
* socket.async_connect(endpoint, connect_handler);
|
||||
* @endcode
|
||||
*/
|
||||
template <typename ConnectHandler>
|
||||
ASIO_INITFN_RESULT_TYPE(ConnectHandler,
|
||||
template <
|
||||
ASIO_COMPLETION_TOKEN_FOR(void (asio::error_code))
|
||||
ConnectHandler ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(executor_type)>
|
||||
ASIO_INITFN_AUTO_RESULT_TYPE(ConnectHandler,
|
||||
void (asio::error_code))
|
||||
async_connect(const endpoint_type& peer_endpoint,
|
||||
ASIO_MOVE_ARG(ConnectHandler) handler)
|
||||
ASIO_MOVE_ARG(ConnectHandler) handler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN(executor_type))
|
||||
{
|
||||
asio::error_code open_ec;
|
||||
if (!is_open())
|
||||
@@ -955,7 +958,7 @@ public:
|
||||
}
|
||||
|
||||
return async_initiate<ConnectHandler, void (asio::error_code)>(
|
||||
initiate_async_connect(), handler, this, peer_endpoint, open_ec);
|
||||
initiate_async_connect(this), handler, peer_endpoint, open_ec);
|
||||
}
|
||||
|
||||
/// Set an option on the socket.
|
||||
@@ -1771,13 +1774,17 @@ public:
|
||||
* socket.async_wait(asio::ip::tcp::socket::wait_read, wait_handler);
|
||||
* @endcode
|
||||
*/
|
||||
template <typename WaitHandler>
|
||||
ASIO_INITFN_RESULT_TYPE(WaitHandler,
|
||||
template <
|
||||
ASIO_COMPLETION_TOKEN_FOR(void (asio::error_code))
|
||||
WaitHandler ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(executor_type)>
|
||||
ASIO_INITFN_AUTO_RESULT_TYPE(WaitHandler,
|
||||
void (asio::error_code))
|
||||
async_wait(wait_type w, ASIO_MOVE_ARG(WaitHandler) handler)
|
||||
async_wait(wait_type w,
|
||||
ASIO_MOVE_ARG(WaitHandler) handler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN(executor_type))
|
||||
{
|
||||
return async_initiate<WaitHandler, void (asio::error_code)>(
|
||||
initiate_async_wait(), handler, this, w);
|
||||
initiate_async_wait(this), handler, w);
|
||||
}
|
||||
|
||||
protected:
|
||||
@@ -1786,7 +1793,7 @@ protected:
|
||||
* This function destroys the socket, cancelling any outstanding asynchronous
|
||||
* operations associated with the socket as if by calling @c cancel.
|
||||
*/
|
||||
~basic_socket()
|
||||
virtual ~basic_socket()
|
||||
{
|
||||
}
|
||||
|
||||
@@ -1811,11 +1818,24 @@ private:
|
||||
basic_socket(const basic_socket&) ASIO_DELETED;
|
||||
basic_socket& operator=(const basic_socket&) ASIO_DELETED;
|
||||
|
||||
struct initiate_async_connect
|
||||
class initiate_async_connect
|
||||
{
|
||||
public:
|
||||
typedef Executor executor_type;
|
||||
|
||||
explicit initiate_async_connect(basic_socket* self)
|
||||
: self_(self)
|
||||
{
|
||||
}
|
||||
|
||||
executor_type get_executor() const ASIO_NOEXCEPT
|
||||
{
|
||||
return self_->get_executor();
|
||||
}
|
||||
|
||||
template <typename ConnectHandler>
|
||||
void operator()(ASIO_MOVE_ARG(ConnectHandler) handler,
|
||||
basic_socket* self, const endpoint_type& peer_endpoint,
|
||||
const endpoint_type& peer_endpoint,
|
||||
const asio::error_code& open_ec) const
|
||||
{
|
||||
// If you get an error on the following line it means that your handler
|
||||
@@ -1824,35 +1844,53 @@ private:
|
||||
|
||||
if (open_ec)
|
||||
{
|
||||
asio::post(self->impl_.get_executor(),
|
||||
asio::post(self_->impl_.get_executor(),
|
||||
asio::detail::bind_handler(
|
||||
ASIO_MOVE_CAST(ConnectHandler)(handler), open_ec));
|
||||
}
|
||||
else
|
||||
{
|
||||
detail::non_const_lvalue<ConnectHandler> handler2(handler);
|
||||
self->impl_.get_service().async_connect(
|
||||
self->impl_.get_implementation(), peer_endpoint,
|
||||
handler2.value, self->impl_.get_implementation_executor());
|
||||
self_->impl_.get_service().async_connect(
|
||||
self_->impl_.get_implementation(), peer_endpoint,
|
||||
handler2.value, self_->impl_.get_implementation_executor());
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
basic_socket* self_;
|
||||
};
|
||||
|
||||
struct initiate_async_wait
|
||||
class initiate_async_wait
|
||||
{
|
||||
public:
|
||||
typedef Executor executor_type;
|
||||
|
||||
explicit initiate_async_wait(basic_socket* self)
|
||||
: self_(self)
|
||||
{
|
||||
}
|
||||
|
||||
executor_type get_executor() const ASIO_NOEXCEPT
|
||||
{
|
||||
return self_->get_executor();
|
||||
}
|
||||
|
||||
template <typename WaitHandler>
|
||||
void operator()(ASIO_MOVE_ARG(WaitHandler) handler,
|
||||
basic_socket* self, wait_type w) const
|
||||
void operator()(ASIO_MOVE_ARG(WaitHandler) handler, wait_type w) const
|
||||
{
|
||||
// If you get an error on the following line it means that your handler
|
||||
// does not meet the documented type requirements for a WaitHandler.
|
||||
ASIO_WAIT_HANDLER_CHECK(WaitHandler, handler) type_check;
|
||||
|
||||
detail::non_const_lvalue<WaitHandler> handler2(handler);
|
||||
self->impl_.get_service().async_wait(
|
||||
self->impl_.get_implementation(), w, handler2.value,
|
||||
self->impl_.get_implementation_executor());
|
||||
self_->impl_.get_service().async_wait(
|
||||
self_->impl_.get_implementation(), w, handler2.value,
|
||||
self_->impl_.get_implementation_executor());
|
||||
}
|
||||
|
||||
private:
|
||||
basic_socket* self_;
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
@@ -80,6 +80,14 @@ public:
|
||||
/// The type of the executor associated with the object.
|
||||
typedef Executor executor_type;
|
||||
|
||||
/// Rebinds the acceptor type to another executor.
|
||||
template <typename Executor1>
|
||||
struct rebind_executor
|
||||
{
|
||||
/// The socket type when rebound to the specified executor.
|
||||
typedef basic_socket_acceptor<Protocol, Executor1> other;
|
||||
};
|
||||
|
||||
/// The native representation of an acceptor.
|
||||
#if defined(GENERATING_DOCUMENTATION)
|
||||
typedef implementation_defined native_handle_type;
|
||||
@@ -1210,13 +1218,17 @@ public:
|
||||
* wait_handler);
|
||||
* @endcode
|
||||
*/
|
||||
template <typename WaitHandler>
|
||||
ASIO_INITFN_RESULT_TYPE(WaitHandler,
|
||||
template <
|
||||
ASIO_COMPLETION_TOKEN_FOR(void (asio::error_code))
|
||||
WaitHandler ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(executor_type)>
|
||||
ASIO_INITFN_AUTO_RESULT_TYPE(WaitHandler,
|
||||
void (asio::error_code))
|
||||
async_wait(wait_type w, ASIO_MOVE_ARG(WaitHandler) handler)
|
||||
async_wait(wait_type w,
|
||||
ASIO_MOVE_ARG(WaitHandler) handler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN(executor_type))
|
||||
{
|
||||
return async_initiate<WaitHandler, void (asio::error_code)>(
|
||||
initiate_async_wait(), handler, this, w);
|
||||
initiate_async_wait(this), handler, w);
|
||||
}
|
||||
|
||||
#if !defined(ASIO_NO_EXTENSIONS)
|
||||
@@ -1323,17 +1335,20 @@ public:
|
||||
* acceptor.async_accept(socket, accept_handler);
|
||||
* @endcode
|
||||
*/
|
||||
template <typename Protocol1, typename Executor1, typename AcceptHandler>
|
||||
ASIO_INITFN_RESULT_TYPE(AcceptHandler,
|
||||
template <typename Protocol1, typename Executor1,
|
||||
ASIO_COMPLETION_TOKEN_FOR(void (asio::error_code))
|
||||
AcceptHandler ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(executor_type)>
|
||||
ASIO_INITFN_AUTO_RESULT_TYPE(AcceptHandler,
|
||||
void (asio::error_code))
|
||||
async_accept(basic_socket<Protocol1, Executor1>& peer,
|
||||
ASIO_MOVE_ARG(AcceptHandler) handler,
|
||||
ASIO_MOVE_ARG(AcceptHandler) handler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN(executor_type),
|
||||
typename enable_if<
|
||||
is_convertible<Protocol, Protocol1>::value
|
||||
>::type* = 0)
|
||||
{
|
||||
return async_initiate<AcceptHandler, void (asio::error_code)>(
|
||||
initiate_async_accept(), handler, this,
|
||||
initiate_async_accept(this), handler,
|
||||
&peer, static_cast<endpoint_type*>(0));
|
||||
}
|
||||
|
||||
@@ -1433,14 +1448,18 @@ public:
|
||||
* immediate completion, invocation of the handler will be performed in a
|
||||
* manner equivalent to using asio::post().
|
||||
*/
|
||||
template <typename Executor1, typename AcceptHandler>
|
||||
ASIO_INITFN_RESULT_TYPE(AcceptHandler,
|
||||
template <typename Executor1,
|
||||
ASIO_COMPLETION_TOKEN_FOR(void (asio::error_code))
|
||||
AcceptHandler ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(executor_type)>
|
||||
ASIO_INITFN_AUTO_RESULT_TYPE(AcceptHandler,
|
||||
void (asio::error_code))
|
||||
async_accept(basic_socket<protocol_type, Executor1>& peer,
|
||||
endpoint_type& peer_endpoint, ASIO_MOVE_ARG(AcceptHandler) handler)
|
||||
endpoint_type& peer_endpoint,
|
||||
ASIO_MOVE_ARG(AcceptHandler) handler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN(executor_type))
|
||||
{
|
||||
return async_initiate<AcceptHandler, void (asio::error_code)>(
|
||||
initiate_async_accept(), handler, this, &peer, &peer_endpoint);
|
||||
initiate_async_accept(this), handler, &peer, &peer_endpoint);
|
||||
}
|
||||
#endif // !defined(ASIO_NO_EXTENSIONS)
|
||||
|
||||
@@ -1465,10 +1484,12 @@ public:
|
||||
* asio::ip::tcp::socket socket(acceptor.accept());
|
||||
* @endcode
|
||||
*/
|
||||
typename Protocol::socket accept()
|
||||
typename Protocol::socket::template rebind_executor<executor_type>::other
|
||||
accept()
|
||||
{
|
||||
asio::error_code ec;
|
||||
typename Protocol::socket peer(impl_.get_executor());
|
||||
typename Protocol::socket::template rebind_executor<
|
||||
executor_type>::other peer(impl_.get_executor());
|
||||
impl_.get_service().accept(impl_.get_implementation(), peer, 0, ec);
|
||||
asio::detail::throw_error(ec, "accept");
|
||||
return peer;
|
||||
@@ -1499,9 +1520,11 @@ public:
|
||||
* }
|
||||
* @endcode
|
||||
*/
|
||||
typename Protocol::socket accept(asio::error_code& ec)
|
||||
typename Protocol::socket::template rebind_executor<executor_type>::other
|
||||
accept(asio::error_code& ec)
|
||||
{
|
||||
typename Protocol::socket peer(impl_.get_executor());
|
||||
typename Protocol::socket::template rebind_executor<
|
||||
executor_type>::other peer(impl_.get_executor());
|
||||
impl_.get_service().accept(impl_.get_implementation(), peer, 0, ec);
|
||||
return peer;
|
||||
}
|
||||
@@ -1518,8 +1541,11 @@ public:
|
||||
* completes. Copies will be made of the handler as required. The function
|
||||
* signature of the handler must be:
|
||||
* @code void handler(
|
||||
* const asio::error_code& error, // Result of operation.
|
||||
* typename Protocol::socket peer // On success, the newly accepted socket.
|
||||
* // Result of operation.
|
||||
* const asio::error_code& error,
|
||||
* // On success, the newly accepted socket.
|
||||
* typename Protocol::socket::template
|
||||
* rebind_executor<executor_type>::other peer
|
||||
* ); @endcode
|
||||
* Regardless of whether the asynchronous operation completes immediately or
|
||||
* not, the handler will not be invoked from within this function. On
|
||||
@@ -1544,16 +1570,26 @@ public:
|
||||
* acceptor.async_accept(accept_handler);
|
||||
* @endcode
|
||||
*/
|
||||
template <typename MoveAcceptHandler>
|
||||
ASIO_INITFN_RESULT_TYPE(MoveAcceptHandler,
|
||||
void (asio::error_code, typename Protocol::socket))
|
||||
async_accept(ASIO_MOVE_ARG(MoveAcceptHandler) handler)
|
||||
template <
|
||||
ASIO_COMPLETION_TOKEN_FOR(void (asio::error_code,
|
||||
typename Protocol::socket::template rebind_executor<
|
||||
executor_type>::other)) MoveAcceptHandler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(executor_type)>
|
||||
ASIO_INITFN_AUTO_RESULT_TYPE(MoveAcceptHandler,
|
||||
void (asio::error_code,
|
||||
typename Protocol::socket::template
|
||||
rebind_executor<executor_type>::other))
|
||||
async_accept(
|
||||
ASIO_MOVE_ARG(MoveAcceptHandler) handler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN(executor_type))
|
||||
{
|
||||
return async_initiate<MoveAcceptHandler,
|
||||
void (asio::error_code, typename Protocol::socket)>(
|
||||
initiate_async_move_accept(), handler, this,
|
||||
impl_.get_executor(), static_cast<endpoint_type*>(0),
|
||||
static_cast<typename Protocol::socket*>(0));
|
||||
void (asio::error_code, typename Protocol::socket::template
|
||||
rebind_executor<executor_type>::other)>(
|
||||
initiate_async_move_accept(this), handler,
|
||||
impl_.get_executor(), static_cast<endpoint_type*>(0),
|
||||
static_cast<typename Protocol::socket::template
|
||||
rebind_executor<executor_type>::other*>(0));
|
||||
}
|
||||
|
||||
/// Accept a new connection.
|
||||
@@ -1758,13 +1794,18 @@ public:
|
||||
* acceptor.async_accept(my_context2, accept_handler);
|
||||
* @endcode
|
||||
*/
|
||||
template <typename Executor1, typename MoveAcceptHandler>
|
||||
ASIO_INITFN_RESULT_TYPE(MoveAcceptHandler,
|
||||
template <typename Executor1,
|
||||
ASIO_COMPLETION_TOKEN_FOR(void (asio::error_code,
|
||||
typename Protocol::socket::template rebind_executor<
|
||||
Executor1>::other)) MoveAcceptHandler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(executor_type)>
|
||||
ASIO_INITFN_AUTO_RESULT_TYPE(MoveAcceptHandler,
|
||||
void (asio::error_code,
|
||||
typename Protocol::socket::template rebind_executor<
|
||||
Executor1>::other))
|
||||
async_accept(const Executor1& ex,
|
||||
ASIO_MOVE_ARG(MoveAcceptHandler) handler,
|
||||
ASIO_MOVE_ARG(MoveAcceptHandler) handler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN(executor_type),
|
||||
typename enable_if<
|
||||
is_executor<Executor1>::value
|
||||
>::type* = 0)
|
||||
@@ -1774,7 +1815,7 @@ public:
|
||||
|
||||
return async_initiate<MoveAcceptHandler,
|
||||
void (asio::error_code, other_socket_type)>(
|
||||
initiate_async_move_accept(), handler, this,
|
||||
initiate_async_move_accept(this), handler,
|
||||
ex, static_cast<endpoint_type*>(0),
|
||||
static_cast<other_socket_type*>(0));
|
||||
}
|
||||
@@ -1822,13 +1863,18 @@ public:
|
||||
* acceptor.async_accept(my_context2, accept_handler);
|
||||
* @endcode
|
||||
*/
|
||||
template <typename ExecutionContext, typename MoveAcceptHandler>
|
||||
ASIO_INITFN_RESULT_TYPE(MoveAcceptHandler,
|
||||
template <typename ExecutionContext,
|
||||
ASIO_COMPLETION_TOKEN_FOR(void (asio::error_code,
|
||||
typename Protocol::socket::template rebind_executor<
|
||||
typename ExecutionContext::executor_type>::other)) MoveAcceptHandler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(executor_type)>
|
||||
ASIO_INITFN_AUTO_RESULT_TYPE(MoveAcceptHandler,
|
||||
void (asio::error_code,
|
||||
typename Protocol::socket::template rebind_executor<
|
||||
typename ExecutionContext::executor_type>::other))
|
||||
async_accept(ExecutionContext& context,
|
||||
ASIO_MOVE_ARG(MoveAcceptHandler) handler,
|
||||
ASIO_MOVE_ARG(MoveAcceptHandler) handler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN(executor_type),
|
||||
typename enable_if<
|
||||
is_convertible<ExecutionContext&, execution_context&>::value
|
||||
>::type* = 0)
|
||||
@@ -1838,7 +1884,7 @@ public:
|
||||
|
||||
return async_initiate<MoveAcceptHandler,
|
||||
void (asio::error_code, other_socket_type)>(
|
||||
initiate_async_move_accept(), handler, this,
|
||||
initiate_async_move_accept(this), handler,
|
||||
context.get_executor(), static_cast<endpoint_type*>(0),
|
||||
static_cast<other_socket_type*>(0));
|
||||
}
|
||||
@@ -1867,10 +1913,12 @@ public:
|
||||
* asio::ip::tcp::socket socket(acceptor.accept(endpoint));
|
||||
* @endcode
|
||||
*/
|
||||
typename Protocol::socket accept(endpoint_type& peer_endpoint)
|
||||
typename Protocol::socket::template rebind_executor<executor_type>::other
|
||||
accept(endpoint_type& peer_endpoint)
|
||||
{
|
||||
asio::error_code ec;
|
||||
typename Protocol::socket peer(impl_.get_executor());
|
||||
typename Protocol::socket::template rebind_executor<
|
||||
executor_type>::other peer(impl_.get_executor());
|
||||
impl_.get_service().accept(impl_.get_implementation(),
|
||||
peer, &peer_endpoint, ec);
|
||||
asio::detail::throw_error(ec, "accept");
|
||||
@@ -1906,10 +1954,11 @@ public:
|
||||
* }
|
||||
* @endcode
|
||||
*/
|
||||
typename Protocol::socket accept(
|
||||
endpoint_type& peer_endpoint, asio::error_code& ec)
|
||||
typename Protocol::socket::template rebind_executor<executor_type>::other
|
||||
accept(endpoint_type& peer_endpoint, asio::error_code& ec)
|
||||
{
|
||||
typename Protocol::socket peer(impl_.get_executor());
|
||||
typename Protocol::socket::template rebind_executor<
|
||||
executor_type>::other peer(impl_.get_executor());
|
||||
impl_.get_service().accept(impl_.get_implementation(),
|
||||
peer, &peer_endpoint, ec);
|
||||
return peer;
|
||||
@@ -1932,8 +1981,11 @@ public:
|
||||
* completes. Copies will be made of the handler as required. The function
|
||||
* signature of the handler must be:
|
||||
* @code void handler(
|
||||
* const asio::error_code& error, // Result of operation.
|
||||
* typename Protocol::socket peer // On success, the newly accepted socket.
|
||||
* // Result of operation.
|
||||
* const asio::error_code& error,
|
||||
* // On success, the newly accepted socket.
|
||||
* typename Protocol::socket::template
|
||||
* rebind_executor<executor_type>::other peer
|
||||
* ); @endcode
|
||||
* Regardless of whether the asynchronous operation completes immediately or
|
||||
* not, the handler will not be invoked from within this function. On
|
||||
@@ -1959,17 +2011,26 @@ public:
|
||||
* acceptor.async_accept(endpoint, accept_handler);
|
||||
* @endcode
|
||||
*/
|
||||
template <typename MoveAcceptHandler>
|
||||
ASIO_INITFN_RESULT_TYPE(MoveAcceptHandler,
|
||||
void (asio::error_code, typename Protocol::socket))
|
||||
template <
|
||||
ASIO_COMPLETION_TOKEN_FOR(void (asio::error_code,
|
||||
typename Protocol::socket::template rebind_executor<
|
||||
executor_type>::other)) MoveAcceptHandler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(executor_type)>
|
||||
ASIO_INITFN_AUTO_RESULT_TYPE(MoveAcceptHandler,
|
||||
void (asio::error_code,
|
||||
typename Protocol::socket::template
|
||||
rebind_executor<executor_type>::other))
|
||||
async_accept(endpoint_type& peer_endpoint,
|
||||
ASIO_MOVE_ARG(MoveAcceptHandler) handler)
|
||||
ASIO_MOVE_ARG(MoveAcceptHandler) handler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN(executor_type))
|
||||
{
|
||||
return async_initiate<MoveAcceptHandler,
|
||||
void (asio::error_code, typename Protocol::socket)>(
|
||||
initiate_async_move_accept(), handler, this,
|
||||
impl_.get_executor(), &peer_endpoint,
|
||||
static_cast<typename Protocol::socket*>(0));
|
||||
void (asio::error_code, typename Protocol::socket::template
|
||||
rebind_executor<executor_type>::other)>(
|
||||
initiate_async_move_accept(this), handler,
|
||||
impl_.get_executor(), &peer_endpoint,
|
||||
static_cast<typename Protocol::socket::template
|
||||
rebind_executor<executor_type>::other*>(0));
|
||||
}
|
||||
|
||||
/// Accept a new connection.
|
||||
@@ -2206,13 +2267,18 @@ public:
|
||||
* acceptor.async_accept(my_context2, endpoint, accept_handler);
|
||||
* @endcode
|
||||
*/
|
||||
template <typename Executor1, typename MoveAcceptHandler>
|
||||
ASIO_INITFN_RESULT_TYPE(MoveAcceptHandler,
|
||||
template <typename Executor1,
|
||||
ASIO_COMPLETION_TOKEN_FOR(void (asio::error_code,
|
||||
typename Protocol::socket::template rebind_executor<
|
||||
Executor1>::other)) MoveAcceptHandler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(executor_type)>
|
||||
ASIO_INITFN_AUTO_RESULT_TYPE(MoveAcceptHandler,
|
||||
void (asio::error_code,
|
||||
typename Protocol::socket::template rebind_executor<
|
||||
Executor1>::other))
|
||||
async_accept(const Executor1& ex, endpoint_type& peer_endpoint,
|
||||
ASIO_MOVE_ARG(MoveAcceptHandler) handler,
|
||||
ASIO_MOVE_ARG(MoveAcceptHandler) handler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN(executor_type),
|
||||
typename enable_if<
|
||||
is_executor<Executor1>::value
|
||||
>::type* = 0)
|
||||
@@ -2222,7 +2288,7 @@ public:
|
||||
|
||||
return async_initiate<MoveAcceptHandler,
|
||||
void (asio::error_code, other_socket_type)>(
|
||||
initiate_async_move_accept(), handler, this,
|
||||
initiate_async_move_accept(this), handler,
|
||||
ex, &peer_endpoint,
|
||||
static_cast<other_socket_type*>(0));
|
||||
}
|
||||
@@ -2276,14 +2342,19 @@ public:
|
||||
* acceptor.async_accept(my_context2, endpoint, accept_handler);
|
||||
* @endcode
|
||||
*/
|
||||
template <typename ExecutionContext, typename MoveAcceptHandler>
|
||||
ASIO_INITFN_RESULT_TYPE(MoveAcceptHandler,
|
||||
template <typename ExecutionContext,
|
||||
ASIO_COMPLETION_TOKEN_FOR(void (asio::error_code,
|
||||
typename Protocol::socket::template rebind_executor<
|
||||
typename ExecutionContext::executor_type>::other)) MoveAcceptHandler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(executor_type)>
|
||||
ASIO_INITFN_AUTO_RESULT_TYPE(MoveAcceptHandler,
|
||||
void (asio::error_code,
|
||||
typename Protocol::socket::template rebind_executor<
|
||||
typename ExecutionContext::executor_type>::other))
|
||||
async_accept(ExecutionContext& context,
|
||||
endpoint_type& peer_endpoint,
|
||||
ASIO_MOVE_ARG(MoveAcceptHandler) handler,
|
||||
ASIO_MOVE_ARG(MoveAcceptHandler) handler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN(executor_type),
|
||||
typename enable_if<
|
||||
is_convertible<ExecutionContext&, execution_context&>::value
|
||||
>::type* = 0)
|
||||
@@ -2293,7 +2364,7 @@ public:
|
||||
|
||||
return async_initiate<MoveAcceptHandler,
|
||||
void (asio::error_code, other_socket_type)>(
|
||||
initiate_async_move_accept(), handler, this,
|
||||
initiate_async_move_accept(this), handler,
|
||||
context.get_executor(), &peer_endpoint,
|
||||
static_cast<other_socket_type*>(0));
|
||||
}
|
||||
@@ -2305,28 +2376,56 @@ private:
|
||||
basic_socket_acceptor& operator=(
|
||||
const basic_socket_acceptor&) ASIO_DELETED;
|
||||
|
||||
struct initiate_async_wait
|
||||
class initiate_async_wait
|
||||
{
|
||||
public:
|
||||
typedef Executor executor_type;
|
||||
|
||||
explicit initiate_async_wait(basic_socket_acceptor* self)
|
||||
: self_(self)
|
||||
{
|
||||
}
|
||||
|
||||
executor_type get_executor() const ASIO_NOEXCEPT
|
||||
{
|
||||
return self_->get_executor();
|
||||
}
|
||||
|
||||
template <typename WaitHandler>
|
||||
void operator()(ASIO_MOVE_ARG(WaitHandler) handler,
|
||||
basic_socket_acceptor* self, wait_type w) const
|
||||
void operator()(ASIO_MOVE_ARG(WaitHandler) handler, wait_type w) const
|
||||
{
|
||||
// If you get an error on the following line it means that your handler
|
||||
// does not meet the documented type requirements for a WaitHandler.
|
||||
ASIO_WAIT_HANDLER_CHECK(WaitHandler, handler) type_check;
|
||||
|
||||
detail::non_const_lvalue<WaitHandler> handler2(handler);
|
||||
self->impl_.get_service().async_wait(
|
||||
self->impl_.get_implementation(), w, handler2.value,
|
||||
self->impl_.get_implementation_executor());
|
||||
self_->impl_.get_service().async_wait(
|
||||
self_->impl_.get_implementation(), w, handler2.value,
|
||||
self_->impl_.get_implementation_executor());
|
||||
}
|
||||
|
||||
private:
|
||||
basic_socket_acceptor* self_;
|
||||
};
|
||||
|
||||
struct initiate_async_accept
|
||||
class initiate_async_accept
|
||||
{
|
||||
public:
|
||||
typedef Executor executor_type;
|
||||
|
||||
explicit initiate_async_accept(basic_socket_acceptor* self)
|
||||
: self_(self)
|
||||
{
|
||||
}
|
||||
|
||||
executor_type get_executor() const ASIO_NOEXCEPT
|
||||
{
|
||||
return self_->get_executor();
|
||||
}
|
||||
|
||||
template <typename AcceptHandler, typename Protocol1, typename Executor1>
|
||||
void operator()(ASIO_MOVE_ARG(AcceptHandler) handler,
|
||||
basic_socket_acceptor* self, basic_socket<Protocol1, Executor1>* peer,
|
||||
basic_socket<Protocol1, Executor1>* peer,
|
||||
endpoint_type* peer_endpoint) const
|
||||
{
|
||||
// If you get an error on the following line it means that your handler
|
||||
@@ -2334,18 +2433,33 @@ private:
|
||||
ASIO_ACCEPT_HANDLER_CHECK(AcceptHandler, handler) type_check;
|
||||
|
||||
detail::non_const_lvalue<AcceptHandler> handler2(handler);
|
||||
self->impl_.get_service().async_accept(
|
||||
self->impl_.get_implementation(), *peer, peer_endpoint,
|
||||
handler2.value, self->impl_.get_implementation_executor());
|
||||
self_->impl_.get_service().async_accept(
|
||||
self_->impl_.get_implementation(), *peer, peer_endpoint,
|
||||
handler2.value, self_->impl_.get_implementation_executor());
|
||||
}
|
||||
|
||||
private:
|
||||
basic_socket_acceptor* self_;
|
||||
};
|
||||
|
||||
struct initiate_async_move_accept
|
||||
class initiate_async_move_accept
|
||||
{
|
||||
public:
|
||||
typedef Executor executor_type;
|
||||
|
||||
explicit initiate_async_move_accept(basic_socket_acceptor* self)
|
||||
: self_(self)
|
||||
{
|
||||
}
|
||||
|
||||
executor_type get_executor() const ASIO_NOEXCEPT
|
||||
{
|
||||
return self_->get_executor();
|
||||
}
|
||||
|
||||
template <typename MoveAcceptHandler, typename Executor1, typename Socket>
|
||||
void operator()(ASIO_MOVE_ARG(MoveAcceptHandler) handler,
|
||||
basic_socket_acceptor* self, const Executor1& peer_ex,
|
||||
endpoint_type* peer_endpoint, Socket*) const
|
||||
const Executor1& peer_ex, endpoint_type* peer_endpoint, Socket*) const
|
||||
{
|
||||
// If you get an error on the following line it means that your handler
|
||||
// does not meet the documented type requirements for a MoveAcceptHandler.
|
||||
@@ -2353,10 +2467,13 @@ private:
|
||||
MoveAcceptHandler, handler, Socket) type_check;
|
||||
|
||||
detail::non_const_lvalue<MoveAcceptHandler> handler2(handler);
|
||||
self->impl_.get_service().async_move_accept(
|
||||
self->impl_.get_implementation(), peer_ex, peer_endpoint,
|
||||
handler2.value, self->impl_.get_implementation_executor());
|
||||
self_->impl_.get_service().async_move_accept(
|
||||
self_->impl_.get_implementation(), peer_ex, peer_endpoint,
|
||||
handler2.value, self_->impl_.get_implementation_executor());
|
||||
}
|
||||
|
||||
private:
|
||||
basic_socket_acceptor* self_;
|
||||
};
|
||||
|
||||
#if defined(ASIO_WINDOWS_RUNTIME)
|
||||
|
||||
@@ -253,7 +253,7 @@ public:
|
||||
* constructed using the @c basic_stream_socket(const executor_type&)
|
||||
* constructor.
|
||||
*/
|
||||
basic_stream_socket(basic_stream_socket&& other)
|
||||
basic_stream_socket(basic_stream_socket&& other) ASIO_NOEXCEPT
|
||||
: basic_socket<Protocol, Executor>(std::move(other))
|
||||
{
|
||||
}
|
||||
@@ -463,15 +463,19 @@ public:
|
||||
* buffers in one go, and how to use it with arrays, boost::array or
|
||||
* std::vector.
|
||||
*/
|
||||
template <typename ConstBufferSequence, typename WriteHandler>
|
||||
ASIO_INITFN_RESULT_TYPE(WriteHandler,
|
||||
template <typename ConstBufferSequence,
|
||||
ASIO_COMPLETION_TOKEN_FOR(void (asio::error_code,
|
||||
std::size_t)) WriteHandler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(executor_type)>
|
||||
ASIO_INITFN_AUTO_RESULT_TYPE(WriteHandler,
|
||||
void (asio::error_code, std::size_t))
|
||||
async_send(const ConstBufferSequence& buffers,
|
||||
ASIO_MOVE_ARG(WriteHandler) handler)
|
||||
ASIO_MOVE_ARG(WriteHandler) handler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN(executor_type))
|
||||
{
|
||||
return async_initiate<WriteHandler,
|
||||
void (asio::error_code, std::size_t)>(
|
||||
initiate_async_send(), handler, this,
|
||||
initiate_async_send(this), handler,
|
||||
buffers, socket_base::message_flags(0));
|
||||
}
|
||||
|
||||
@@ -512,16 +516,20 @@ public:
|
||||
* buffers in one go, and how to use it with arrays, boost::array or
|
||||
* std::vector.
|
||||
*/
|
||||
template <typename ConstBufferSequence, typename WriteHandler>
|
||||
ASIO_INITFN_RESULT_TYPE(WriteHandler,
|
||||
template <typename ConstBufferSequence,
|
||||
ASIO_COMPLETION_TOKEN_FOR(void (asio::error_code,
|
||||
std::size_t)) WriteHandler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(executor_type)>
|
||||
ASIO_INITFN_AUTO_RESULT_TYPE(WriteHandler,
|
||||
void (asio::error_code, std::size_t))
|
||||
async_send(const ConstBufferSequence& buffers,
|
||||
socket_base::message_flags flags,
|
||||
ASIO_MOVE_ARG(WriteHandler) handler)
|
||||
ASIO_MOVE_ARG(WriteHandler) handler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN(executor_type))
|
||||
{
|
||||
return async_initiate<WriteHandler,
|
||||
void (asio::error_code, std::size_t)>(
|
||||
initiate_async_send(), handler, this, buffers, flags);
|
||||
initiate_async_send(this), handler, buffers, flags);
|
||||
}
|
||||
|
||||
/// Receive some data on the socket.
|
||||
@@ -666,15 +674,19 @@ public:
|
||||
* multiple buffers in one go, and how to use it with arrays, boost::array or
|
||||
* std::vector.
|
||||
*/
|
||||
template <typename MutableBufferSequence, typename ReadHandler>
|
||||
ASIO_INITFN_RESULT_TYPE(ReadHandler,
|
||||
template <typename MutableBufferSequence,
|
||||
ASIO_COMPLETION_TOKEN_FOR(void (asio::error_code,
|
||||
std::size_t)) ReadHandler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(executor_type)>
|
||||
ASIO_INITFN_AUTO_RESULT_TYPE(ReadHandler,
|
||||
void (asio::error_code, std::size_t))
|
||||
async_receive(const MutableBufferSequence& buffers,
|
||||
ASIO_MOVE_ARG(ReadHandler) handler)
|
||||
ASIO_MOVE_ARG(ReadHandler) handler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN(executor_type))
|
||||
{
|
||||
return async_initiate<ReadHandler,
|
||||
void (asio::error_code, std::size_t)>(
|
||||
initiate_async_receive(), handler, this,
|
||||
initiate_async_receive(this), handler,
|
||||
buffers, socket_base::message_flags(0));
|
||||
}
|
||||
|
||||
@@ -717,16 +729,20 @@ public:
|
||||
* multiple buffers in one go, and how to use it with arrays, boost::array or
|
||||
* std::vector.
|
||||
*/
|
||||
template <typename MutableBufferSequence, typename ReadHandler>
|
||||
ASIO_INITFN_RESULT_TYPE(ReadHandler,
|
||||
template <typename MutableBufferSequence,
|
||||
ASIO_COMPLETION_TOKEN_FOR(void (asio::error_code,
|
||||
std::size_t)) ReadHandler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(executor_type)>
|
||||
ASIO_INITFN_AUTO_RESULT_TYPE(ReadHandler,
|
||||
void (asio::error_code, std::size_t))
|
||||
async_receive(const MutableBufferSequence& buffers,
|
||||
socket_base::message_flags flags,
|
||||
ASIO_MOVE_ARG(ReadHandler) handler)
|
||||
ASIO_MOVE_ARG(ReadHandler) handler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN(executor_type))
|
||||
{
|
||||
return async_initiate<ReadHandler,
|
||||
void (asio::error_code, std::size_t)>(
|
||||
initiate_async_receive(), handler, this, buffers, flags);
|
||||
initiate_async_receive(this), handler, buffers, flags);
|
||||
}
|
||||
|
||||
/// Write some data to the socket.
|
||||
@@ -825,15 +841,19 @@ public:
|
||||
* buffers in one go, and how to use it with arrays, boost::array or
|
||||
* std::vector.
|
||||
*/
|
||||
template <typename ConstBufferSequence, typename WriteHandler>
|
||||
ASIO_INITFN_RESULT_TYPE(WriteHandler,
|
||||
template <typename ConstBufferSequence,
|
||||
ASIO_COMPLETION_TOKEN_FOR(void (asio::error_code,
|
||||
std::size_t)) WriteHandler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(executor_type)>
|
||||
ASIO_INITFN_AUTO_RESULT_TYPE(WriteHandler,
|
||||
void (asio::error_code, std::size_t))
|
||||
async_write_some(const ConstBufferSequence& buffers,
|
||||
ASIO_MOVE_ARG(WriteHandler) handler)
|
||||
ASIO_MOVE_ARG(WriteHandler) handler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN(executor_type))
|
||||
{
|
||||
return async_initiate<WriteHandler,
|
||||
void (asio::error_code, std::size_t)>(
|
||||
initiate_async_send(), handler, this,
|
||||
initiate_async_send(this), handler,
|
||||
buffers, socket_base::message_flags(0));
|
||||
}
|
||||
|
||||
@@ -936,24 +956,41 @@ public:
|
||||
* buffers in one go, and how to use it with arrays, boost::array or
|
||||
* std::vector.
|
||||
*/
|
||||
template <typename MutableBufferSequence, typename ReadHandler>
|
||||
ASIO_INITFN_RESULT_TYPE(ReadHandler,
|
||||
template <typename MutableBufferSequence,
|
||||
ASIO_COMPLETION_TOKEN_FOR(void (asio::error_code,
|
||||
std::size_t)) ReadHandler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(executor_type)>
|
||||
ASIO_INITFN_AUTO_RESULT_TYPE(ReadHandler,
|
||||
void (asio::error_code, std::size_t))
|
||||
async_read_some(const MutableBufferSequence& buffers,
|
||||
ASIO_MOVE_ARG(ReadHandler) handler)
|
||||
ASIO_MOVE_ARG(ReadHandler) handler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN(executor_type))
|
||||
{
|
||||
return async_initiate<ReadHandler,
|
||||
void (asio::error_code, std::size_t)>(
|
||||
initiate_async_receive(), handler, this,
|
||||
initiate_async_receive(this), handler,
|
||||
buffers, socket_base::message_flags(0));
|
||||
}
|
||||
|
||||
private:
|
||||
struct initiate_async_send
|
||||
class initiate_async_send
|
||||
{
|
||||
public:
|
||||
typedef Executor executor_type;
|
||||
|
||||
explicit initiate_async_send(basic_stream_socket* self)
|
||||
: self_(self)
|
||||
{
|
||||
}
|
||||
|
||||
executor_type get_executor() const ASIO_NOEXCEPT
|
||||
{
|
||||
return self_->get_executor();
|
||||
}
|
||||
|
||||
template <typename WriteHandler, typename ConstBufferSequence>
|
||||
void operator()(ASIO_MOVE_ARG(WriteHandler) handler,
|
||||
basic_stream_socket* self, const ConstBufferSequence& buffers,
|
||||
const ConstBufferSequence& buffers,
|
||||
socket_base::message_flags flags) const
|
||||
{
|
||||
// If you get an error on the following line it means that your handler
|
||||
@@ -961,17 +998,33 @@ private:
|
||||
ASIO_WRITE_HANDLER_CHECK(WriteHandler, handler) type_check;
|
||||
|
||||
detail::non_const_lvalue<WriteHandler> handler2(handler);
|
||||
self->impl_.get_service().async_send(
|
||||
self->impl_.get_implementation(), buffers, flags,
|
||||
handler2.value, self->impl_.get_implementation_executor());
|
||||
self_->impl_.get_service().async_send(
|
||||
self_->impl_.get_implementation(), buffers, flags,
|
||||
handler2.value, self_->impl_.get_implementation_executor());
|
||||
}
|
||||
|
||||
private:
|
||||
basic_stream_socket* self_;
|
||||
};
|
||||
|
||||
struct initiate_async_receive
|
||||
class initiate_async_receive
|
||||
{
|
||||
public:
|
||||
typedef Executor executor_type;
|
||||
|
||||
explicit initiate_async_receive(basic_stream_socket* self)
|
||||
: self_(self)
|
||||
{
|
||||
}
|
||||
|
||||
executor_type get_executor() const ASIO_NOEXCEPT
|
||||
{
|
||||
return self_->get_executor();
|
||||
}
|
||||
|
||||
template <typename ReadHandler, typename MutableBufferSequence>
|
||||
void operator()(ASIO_MOVE_ARG(ReadHandler) handler,
|
||||
basic_stream_socket* self, const MutableBufferSequence& buffers,
|
||||
const MutableBufferSequence& buffers,
|
||||
socket_base::message_flags flags) const
|
||||
{
|
||||
// If you get an error on the following line it means that your handler
|
||||
@@ -979,10 +1032,13 @@ private:
|
||||
ASIO_READ_HANDLER_CHECK(ReadHandler, handler) type_check;
|
||||
|
||||
detail::non_const_lvalue<ReadHandler> handler2(handler);
|
||||
self->impl_.get_service().async_receive(
|
||||
self->impl_.get_implementation(), buffers, flags,
|
||||
handler2.value, self->impl_.get_implementation_executor());
|
||||
self_->impl_.get_service().async_receive(
|
||||
self_->impl_.get_implementation(), buffers, flags,
|
||||
handler2.value, self_->impl_.get_implementation_executor());
|
||||
}
|
||||
|
||||
private:
|
||||
basic_stream_socket* self_;
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
@@ -145,6 +145,14 @@ public:
|
||||
/// The type of the executor associated with the object.
|
||||
typedef Executor executor_type;
|
||||
|
||||
/// Rebinds the timer type to another executor.
|
||||
template <typename Executor1>
|
||||
struct rebind_executor
|
||||
{
|
||||
/// The timer type when rebound to the specified executor.
|
||||
typedef basic_waitable_timer<Clock, WaitTraits, Executor1> other;
|
||||
};
|
||||
|
||||
/// The clock type.
|
||||
typedef Clock clock_type;
|
||||
|
||||
@@ -691,13 +699,17 @@ public:
|
||||
* immediate completion, invocation of the handler will be performed in a
|
||||
* manner equivalent to using asio::post().
|
||||
*/
|
||||
template <typename WaitHandler>
|
||||
ASIO_INITFN_RESULT_TYPE(WaitHandler,
|
||||
template <
|
||||
ASIO_COMPLETION_TOKEN_FOR(void (asio::error_code))
|
||||
WaitHandler ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(executor_type)>
|
||||
ASIO_INITFN_AUTO_RESULT_TYPE(WaitHandler,
|
||||
void (asio::error_code))
|
||||
async_wait(ASIO_MOVE_ARG(WaitHandler) handler)
|
||||
async_wait(
|
||||
ASIO_MOVE_ARG(WaitHandler) handler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN(executor_type))
|
||||
{
|
||||
return async_initiate<WaitHandler, void (asio::error_code)>(
|
||||
initiate_async_wait(), handler, this);
|
||||
initiate_async_wait(this), handler);
|
||||
}
|
||||
|
||||
private:
|
||||
@@ -706,21 +718,36 @@ private:
|
||||
basic_waitable_timer& operator=(
|
||||
const basic_waitable_timer&) ASIO_DELETED;
|
||||
|
||||
struct initiate_async_wait
|
||||
class initiate_async_wait
|
||||
{
|
||||
public:
|
||||
typedef Executor executor_type;
|
||||
|
||||
explicit initiate_async_wait(basic_waitable_timer* self)
|
||||
: self_(self)
|
||||
{
|
||||
}
|
||||
|
||||
executor_type get_executor() const ASIO_NOEXCEPT
|
||||
{
|
||||
return self_->get_executor();
|
||||
}
|
||||
|
||||
template <typename WaitHandler>
|
||||
void operator()(ASIO_MOVE_ARG(WaitHandler) handler,
|
||||
basic_waitable_timer* self) const
|
||||
void operator()(ASIO_MOVE_ARG(WaitHandler) handler) const
|
||||
{
|
||||
// If you get an error on the following line it means that your handler
|
||||
// does not meet the documented type requirements for a WaitHandler.
|
||||
ASIO_WAIT_HANDLER_CHECK(WaitHandler, handler) type_check;
|
||||
|
||||
detail::non_const_lvalue<WaitHandler> handler2(handler);
|
||||
self->impl_.get_service().async_wait(
|
||||
self->impl_.get_implementation(), handler2.value,
|
||||
self->impl_.get_implementation_executor());
|
||||
self_->impl_.get_service().async_wait(
|
||||
self_->impl_.get_implementation(), handler2.value,
|
||||
self_->impl_.get_implementation_executor());
|
||||
}
|
||||
|
||||
private:
|
||||
basic_waitable_timer* self_;
|
||||
};
|
||||
|
||||
detail::io_object_impl<
|
||||
|
||||
@@ -2473,7 +2473,7 @@ struct is_dynamic_buffer_v2
|
||||
* If @c ASIO_NO_DYNAMIC_BUFFER_V1 is not defined, determines whether the
|
||||
* type satisfies the DynamicBuffer_v1 requirements. Otherwise, if @c
|
||||
* ASIO_NO_DYNAMIC_BUFFER_V1 is defined, determines whether the type
|
||||
* satisfies the DynamicBuffer_v1 requirements.
|
||||
* satisfies the DynamicBuffer_v2 requirements.
|
||||
*/
|
||||
template <typename T>
|
||||
struct is_dynamic_buffer
|
||||
|
||||
@@ -136,11 +136,15 @@ public:
|
||||
|
||||
/// Start an asynchronous write. The data being written must be valid for the
|
||||
/// lifetime of the asynchronous operation.
|
||||
template <typename ConstBufferSequence, typename WriteHandler>
|
||||
ASIO_INITFN_RESULT_TYPE(WriteHandler,
|
||||
template <typename ConstBufferSequence,
|
||||
ASIO_COMPLETION_TOKEN_FOR(void (asio::error_code,
|
||||
std::size_t)) WriteHandler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(executor_type)>
|
||||
ASIO_INITFN_AUTO_RESULT_TYPE(WriteHandler,
|
||||
void (asio::error_code, std::size_t))
|
||||
async_write_some(const ConstBufferSequence& buffers,
|
||||
ASIO_MOVE_ARG(WriteHandler) handler)
|
||||
ASIO_MOVE_ARG(WriteHandler) handler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN(executor_type))
|
||||
{
|
||||
return next_layer_.async_write_some(buffers,
|
||||
ASIO_MOVE_CAST(WriteHandler)(handler));
|
||||
@@ -155,10 +159,15 @@ public:
|
||||
std::size_t fill(asio::error_code& ec);
|
||||
|
||||
/// Start an asynchronous fill.
|
||||
template <typename ReadHandler>
|
||||
ASIO_INITFN_RESULT_TYPE(ReadHandler,
|
||||
template <
|
||||
ASIO_COMPLETION_TOKEN_FOR(void (asio::error_code,
|
||||
std::size_t)) ReadHandler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(executor_type)>
|
||||
ASIO_INITFN_AUTO_RESULT_TYPE(ReadHandler,
|
||||
void (asio::error_code, std::size_t))
|
||||
async_fill(ASIO_MOVE_ARG(ReadHandler) handler);
|
||||
async_fill(
|
||||
ASIO_MOVE_ARG(ReadHandler) handler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN(executor_type));
|
||||
|
||||
/// Read some data from the stream. Returns the number of bytes read. Throws
|
||||
/// an exception on failure.
|
||||
@@ -173,11 +182,15 @@ public:
|
||||
|
||||
/// Start an asynchronous read. The buffer into which the data will be read
|
||||
/// must be valid for the lifetime of the asynchronous operation.
|
||||
template <typename MutableBufferSequence, typename ReadHandler>
|
||||
ASIO_INITFN_RESULT_TYPE(ReadHandler,
|
||||
template <typename MutableBufferSequence,
|
||||
ASIO_COMPLETION_TOKEN_FOR(void (asio::error_code,
|
||||
std::size_t)) ReadHandler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(executor_type)>
|
||||
ASIO_INITFN_AUTO_RESULT_TYPE(ReadHandler,
|
||||
void (asio::error_code, std::size_t))
|
||||
async_read_some(const MutableBufferSequence& buffers,
|
||||
ASIO_MOVE_ARG(ReadHandler) handler);
|
||||
ASIO_MOVE_ARG(ReadHandler) handler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN(executor_type));
|
||||
|
||||
/// Peek at the incoming data on the stream. Returns the number of bytes read.
|
||||
/// Throws an exception on failure.
|
||||
|
||||
@@ -125,10 +125,15 @@ public:
|
||||
}
|
||||
|
||||
/// Start an asynchronous flush.
|
||||
template <typename WriteHandler>
|
||||
ASIO_INITFN_RESULT_TYPE(WriteHandler,
|
||||
template <
|
||||
ASIO_COMPLETION_TOKEN_FOR(void (asio::error_code,
|
||||
std::size_t)) WriteHandler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(executor_type)>
|
||||
ASIO_INITFN_AUTO_RESULT_TYPE(WriteHandler,
|
||||
void (asio::error_code, std::size_t))
|
||||
async_flush(ASIO_MOVE_ARG(WriteHandler) handler)
|
||||
async_flush(
|
||||
ASIO_MOVE_ARG(WriteHandler) handler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN(executor_type))
|
||||
{
|
||||
return stream_impl_.next_layer().async_flush(
|
||||
ASIO_MOVE_CAST(WriteHandler)(handler));
|
||||
@@ -153,11 +158,15 @@ public:
|
||||
|
||||
/// Start an asynchronous write. The data being written must be valid for the
|
||||
/// lifetime of the asynchronous operation.
|
||||
template <typename ConstBufferSequence, typename WriteHandler>
|
||||
ASIO_INITFN_RESULT_TYPE(WriteHandler,
|
||||
template <typename ConstBufferSequence,
|
||||
ASIO_COMPLETION_TOKEN_FOR(void (asio::error_code,
|
||||
std::size_t)) WriteHandler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(executor_type)>
|
||||
ASIO_INITFN_AUTO_RESULT_TYPE(WriteHandler,
|
||||
void (asio::error_code, std::size_t))
|
||||
async_write_some(const ConstBufferSequence& buffers,
|
||||
ASIO_MOVE_ARG(WriteHandler) handler)
|
||||
ASIO_MOVE_ARG(WriteHandler) handler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN(executor_type))
|
||||
{
|
||||
return stream_impl_.async_write_some(buffers,
|
||||
ASIO_MOVE_CAST(WriteHandler)(handler));
|
||||
@@ -178,10 +187,15 @@ public:
|
||||
}
|
||||
|
||||
/// Start an asynchronous fill.
|
||||
template <typename ReadHandler>
|
||||
ASIO_INITFN_RESULT_TYPE(ReadHandler,
|
||||
template <
|
||||
ASIO_COMPLETION_TOKEN_FOR(void (asio::error_code,
|
||||
std::size_t)) ReadHandler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(executor_type)>
|
||||
ASIO_INITFN_AUTO_RESULT_TYPE(ReadHandler,
|
||||
void (asio::error_code, std::size_t))
|
||||
async_fill(ASIO_MOVE_ARG(ReadHandler) handler)
|
||||
async_fill(
|
||||
ASIO_MOVE_ARG(ReadHandler) handler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN(executor_type))
|
||||
{
|
||||
return stream_impl_.async_fill(ASIO_MOVE_CAST(ReadHandler)(handler));
|
||||
}
|
||||
@@ -205,11 +219,15 @@ public:
|
||||
|
||||
/// Start an asynchronous read. The buffer into which the data will be read
|
||||
/// must be valid for the lifetime of the asynchronous operation.
|
||||
template <typename MutableBufferSequence, typename ReadHandler>
|
||||
ASIO_INITFN_RESULT_TYPE(ReadHandler,
|
||||
template <typename MutableBufferSequence,
|
||||
ASIO_COMPLETION_TOKEN_FOR(void (asio::error_code,
|
||||
std::size_t)) ReadHandler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(executor_type)>
|
||||
ASIO_INITFN_AUTO_RESULT_TYPE(ReadHandler,
|
||||
void (asio::error_code, std::size_t))
|
||||
async_read_some(const MutableBufferSequence& buffers,
|
||||
ASIO_MOVE_ARG(ReadHandler) handler)
|
||||
ASIO_MOVE_ARG(ReadHandler) handler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN(executor_type))
|
||||
{
|
||||
return stream_impl_.async_read_some(buffers,
|
||||
ASIO_MOVE_CAST(ReadHandler)(handler));
|
||||
|
||||
@@ -128,10 +128,15 @@ public:
|
||||
std::size_t flush(asio::error_code& ec);
|
||||
|
||||
/// Start an asynchronous flush.
|
||||
template <typename WriteHandler>
|
||||
ASIO_INITFN_RESULT_TYPE(WriteHandler,
|
||||
template <
|
||||
ASIO_COMPLETION_TOKEN_FOR(void (asio::error_code,
|
||||
std::size_t)) WriteHandler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(executor_type)>
|
||||
ASIO_INITFN_AUTO_RESULT_TYPE(WriteHandler,
|
||||
void (asio::error_code, std::size_t))
|
||||
async_flush(ASIO_MOVE_ARG(WriteHandler) handler);
|
||||
async_flush(
|
||||
ASIO_MOVE_ARG(WriteHandler) handler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN(executor_type));
|
||||
|
||||
/// Write the given data to the stream. Returns the number of bytes written.
|
||||
/// Throws an exception on failure.
|
||||
@@ -146,11 +151,15 @@ public:
|
||||
|
||||
/// Start an asynchronous write. The data being written must be valid for the
|
||||
/// lifetime of the asynchronous operation.
|
||||
template <typename ConstBufferSequence, typename WriteHandler>
|
||||
ASIO_INITFN_RESULT_TYPE(WriteHandler,
|
||||
template <typename ConstBufferSequence,
|
||||
ASIO_COMPLETION_TOKEN_FOR(void (asio::error_code,
|
||||
std::size_t)) WriteHandler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(executor_type)>
|
||||
ASIO_INITFN_AUTO_RESULT_TYPE(WriteHandler,
|
||||
void (asio::error_code, std::size_t))
|
||||
async_write_some(const ConstBufferSequence& buffers,
|
||||
ASIO_MOVE_ARG(WriteHandler) handler);
|
||||
ASIO_MOVE_ARG(WriteHandler) handler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN(executor_type));
|
||||
|
||||
/// Read some data from the stream. Returns the number of bytes read. Throws
|
||||
/// an exception on failure.
|
||||
@@ -171,11 +180,15 @@ public:
|
||||
|
||||
/// Start an asynchronous read. The buffer into which the data will be read
|
||||
/// must be valid for the lifetime of the asynchronous operation.
|
||||
template <typename MutableBufferSequence, typename ReadHandler>
|
||||
ASIO_INITFN_RESULT_TYPE(ReadHandler,
|
||||
template <typename MutableBufferSequence,
|
||||
ASIO_COMPLETION_TOKEN_FOR(void (asio::error_code,
|
||||
std::size_t)) ReadHandler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(executor_type)>
|
||||
ASIO_INITFN_AUTO_RESULT_TYPE(ReadHandler,
|
||||
void (asio::error_code, std::size_t))
|
||||
async_read_some(const MutableBufferSequence& buffers,
|
||||
ASIO_MOVE_ARG(ReadHandler) handler)
|
||||
ASIO_MOVE_ARG(ReadHandler) handler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN(executor_type))
|
||||
{
|
||||
return next_layer_.async_read_some(buffers,
|
||||
ASIO_MOVE_CAST(ReadHandler)(handler));
|
||||
|
||||
@@ -53,10 +53,15 @@ struct awaitable_signature<awaitable<void, Executor>>
|
||||
*
|
||||
* where @c E is convertible from @c Executor.
|
||||
*/
|
||||
template <typename Executor, typename F, typename CompletionToken>
|
||||
ASIO_INITFN_RESULT_TYPE(CompletionToken,
|
||||
template <typename Executor, typename F,
|
||||
ASIO_COMPLETION_TOKEN_FOR(typename detail::awaitable_signature<
|
||||
typename result_of<F()>::type>::type) CompletionToken
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(Executor)>
|
||||
ASIO_INITFN_AUTO_RESULT_TYPE(CompletionToken,
|
||||
typename detail::awaitable_signature<typename result_of<F()>::type>::type)
|
||||
co_spawn(const Executor& ex, F&& f, CompletionToken&& token,
|
||||
co_spawn(const Executor& ex, F&& f,
|
||||
CompletionToken&& token
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN(Executor),
|
||||
typename enable_if<
|
||||
is_executor<Executor>::value
|
||||
>::type* = 0);
|
||||
@@ -69,10 +74,17 @@ co_spawn(const Executor& ex, F&& f, CompletionToken&& token,
|
||||
*
|
||||
* where @c E is convertible from @c ExecutionContext::executor_type.
|
||||
*/
|
||||
template <typename ExecutionContext, typename F, typename CompletionToken>
|
||||
ASIO_INITFN_RESULT_TYPE(CompletionToken,
|
||||
template <typename ExecutionContext, typename F,
|
||||
ASIO_COMPLETION_TOKEN_FOR(typename detail::awaitable_signature<
|
||||
typename result_of<F()>::type>::type) CompletionToken
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(
|
||||
typename ExecutionContext::executor_type)>
|
||||
ASIO_INITFN_AUTO_RESULT_TYPE(CompletionToken,
|
||||
typename detail::awaitable_signature<typename result_of<F()>::type>::type)
|
||||
co_spawn(ExecutionContext& ctx, F&& f, CompletionToken&& token,
|
||||
co_spawn(ExecutionContext& ctx, F&& f,
|
||||
CompletionToken&& token
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN(
|
||||
typename ExecutionContext::executor_type),
|
||||
typename enable_if<
|
||||
is_convertible<ExecutionContext&, execution_context&>::value
|
||||
>::type* = 0);
|
||||
|
||||
@@ -100,7 +100,7 @@ namespace asio {
|
||||
*/
|
||||
template <typename CompletionToken, typename Signature,
|
||||
typename Implementation, typename... IoObjectsOrExecutors>
|
||||
ASIO_INITFN_RESULT_TYPE(CompletionToken, Signature)
|
||||
ASIO_INITFN_AUTO_RESULT_TYPE(CompletionToken, Signature)
|
||||
async_compose(ASIO_MOVE_ARG(Implementation) implementation,
|
||||
ASIO_NONDEDUCED_MOVE_ARG(CompletionToken) token,
|
||||
ASIO_MOVE_ARG(IoObjectsOrExecutors)... io_objects_or_executors);
|
||||
@@ -109,14 +109,14 @@ async_compose(ASIO_MOVE_ARG(Implementation) implementation,
|
||||
// || defined(GENERATING_DOCUMENTATION)
|
||||
|
||||
template <typename CompletionToken, typename Signature, typename Implementation>
|
||||
ASIO_INITFN_RESULT_TYPE(CompletionToken, Signature)
|
||||
ASIO_INITFN_AUTO_RESULT_TYPE(CompletionToken, Signature)
|
||||
async_compose(ASIO_MOVE_ARG(Implementation) implementation,
|
||||
ASIO_NONDEDUCED_MOVE_ARG(CompletionToken) token);
|
||||
|
||||
#define ASIO_PRIVATE_ASYNC_COMPOSE_DEF(n) \
|
||||
template <typename CompletionToken, typename Signature, \
|
||||
typename Implementation, ASIO_VARIADIC_TPARAMS(n)> \
|
||||
ASIO_INITFN_RESULT_TYPE(CompletionToken, Signature) \
|
||||
ASIO_INITFN_AUTO_RESULT_TYPE(CompletionToken, Signature) \
|
||||
async_compose(ASIO_MOVE_ARG(Implementation) implementation, \
|
||||
ASIO_NONDEDUCED_MOVE_ARG(CompletionToken) token, \
|
||||
ASIO_VARIADIC_MOVE_PARAMS(n));
|
||||
|
||||
@@ -665,13 +665,16 @@ Iterator connect(basic_socket<Protocol, Executor>& s,
|
||||
* // ...
|
||||
* } @endcode
|
||||
*/
|
||||
template <typename Protocol, typename Executor,
|
||||
typename EndpointSequence, typename RangeConnectHandler>
|
||||
ASIO_INITFN_RESULT_TYPE(RangeConnectHandler,
|
||||
template <typename Protocol, typename Executor, typename EndpointSequence,
|
||||
ASIO_COMPLETION_TOKEN_FOR(void (asio::error_code,
|
||||
typename Protocol::endpoint)) RangeConnectHandler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(Executor)>
|
||||
ASIO_INITFN_AUTO_RESULT_TYPE(RangeConnectHandler,
|
||||
void (asio::error_code, typename Protocol::endpoint))
|
||||
async_connect(basic_socket<Protocol, Executor>& s,
|
||||
const EndpointSequence& endpoints,
|
||||
ASIO_MOVE_ARG(RangeConnectHandler) handler,
|
||||
ASIO_MOVE_ARG(RangeConnectHandler) handler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN(Executor),
|
||||
typename enable_if<is_endpoint_sequence<
|
||||
EndpointSequence>::value>::type* = 0);
|
||||
|
||||
@@ -711,12 +714,15 @@ async_connect(basic_socket<Protocol, Executor>& s,
|
||||
* Iterator represents the end of the sequence. This is a valid assumption for
|
||||
* iterator types such as @c asio::ip::tcp::resolver::iterator.
|
||||
*/
|
||||
template <typename Protocol, typename Executor,
|
||||
typename Iterator, typename IteratorConnectHandler>
|
||||
ASIO_INITFN_RESULT_TYPE(IteratorConnectHandler,
|
||||
template <typename Protocol, typename Executor, typename Iterator,
|
||||
ASIO_COMPLETION_TOKEN_FOR(void (asio::error_code,
|
||||
Iterator)) IteratorConnectHandler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(Executor)>
|
||||
ASIO_INITFN_AUTO_RESULT_TYPE(IteratorConnectHandler,
|
||||
void (asio::error_code, Iterator))
|
||||
async_connect(basic_socket<Protocol, Executor>& s, Iterator begin,
|
||||
ASIO_MOVE_ARG(IteratorConnectHandler) handler,
|
||||
ASIO_MOVE_ARG(IteratorConnectHandler) handler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN(Executor),
|
||||
typename enable_if<!is_endpoint_sequence<Iterator>::value>::type* = 0);
|
||||
#endif // !defined(ASIO_NO_DEPRECATED)
|
||||
|
||||
@@ -769,12 +775,15 @@ async_connect(basic_socket<Protocol, Executor>& s, Iterator begin,
|
||||
* // ...
|
||||
* } @endcode
|
||||
*/
|
||||
template <typename Protocol, typename Executor,
|
||||
typename Iterator, typename IteratorConnectHandler>
|
||||
ASIO_INITFN_RESULT_TYPE(IteratorConnectHandler,
|
||||
template <typename Protocol, typename Executor, typename Iterator,
|
||||
ASIO_COMPLETION_TOKEN_FOR(void (asio::error_code,
|
||||
Iterator)) IteratorConnectHandler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(Executor)>
|
||||
ASIO_INITFN_AUTO_RESULT_TYPE(IteratorConnectHandler,
|
||||
void (asio::error_code, Iterator))
|
||||
async_connect(basic_socket<Protocol, Executor>& s, Iterator begin, Iterator end,
|
||||
ASIO_MOVE_ARG(IteratorConnectHandler) handler);
|
||||
ASIO_MOVE_ARG(IteratorConnectHandler) handler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN(Executor));
|
||||
|
||||
/// Asynchronously establishes a socket connection by trying each endpoint in a
|
||||
/// sequence.
|
||||
@@ -871,13 +880,17 @@ async_connect(basic_socket<Protocol, Executor>& s, Iterator begin, Iterator end,
|
||||
* }
|
||||
* } @endcode
|
||||
*/
|
||||
template <typename Protocol, typename Executor, typename EndpointSequence,
|
||||
typename ConnectCondition, typename RangeConnectHandler>
|
||||
ASIO_INITFN_RESULT_TYPE(RangeConnectHandler,
|
||||
template <typename Protocol, typename Executor,
|
||||
typename EndpointSequence, typename ConnectCondition,
|
||||
ASIO_COMPLETION_TOKEN_FOR(void (asio::error_code,
|
||||
typename Protocol::endpoint)) RangeConnectHandler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(Executor)>
|
||||
ASIO_INITFN_AUTO_RESULT_TYPE(RangeConnectHandler,
|
||||
void (asio::error_code, typename Protocol::endpoint))
|
||||
async_connect(basic_socket<Protocol, Executor>& s,
|
||||
const EndpointSequence& endpoints, ConnectCondition connect_condition,
|
||||
ASIO_MOVE_ARG(RangeConnectHandler) handler,
|
||||
ASIO_MOVE_ARG(RangeConnectHandler) handler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN(Executor),
|
||||
typename enable_if<is_endpoint_sequence<
|
||||
EndpointSequence>::value>::type* = 0);
|
||||
|
||||
@@ -928,13 +941,17 @@ async_connect(basic_socket<Protocol, Executor>& s,
|
||||
* Iterator represents the end of the sequence. This is a valid assumption for
|
||||
* iterator types such as @c asio::ip::tcp::resolver::iterator.
|
||||
*/
|
||||
template <typename Protocol, typename Executor, typename Iterator,
|
||||
typename ConnectCondition, typename IteratorConnectHandler>
|
||||
ASIO_INITFN_RESULT_TYPE(IteratorConnectHandler,
|
||||
template <typename Protocol, typename Executor,
|
||||
typename Iterator, typename ConnectCondition,
|
||||
ASIO_COMPLETION_TOKEN_FOR(void (asio::error_code,
|
||||
Iterator)) IteratorConnectHandler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(Executor)>
|
||||
ASIO_INITFN_AUTO_RESULT_TYPE(IteratorConnectHandler,
|
||||
void (asio::error_code, Iterator))
|
||||
async_connect(basic_socket<Protocol, Executor>& s, Iterator begin,
|
||||
ConnectCondition connect_condition,
|
||||
ASIO_MOVE_ARG(IteratorConnectHandler) handler,
|
||||
ASIO_MOVE_ARG(IteratorConnectHandler) handler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN(Executor),
|
||||
typename enable_if<!is_endpoint_sequence<Iterator>::value>::type* = 0);
|
||||
#endif // !defined(ASIO_NO_DEPRECATED)
|
||||
|
||||
@@ -1036,13 +1053,17 @@ async_connect(basic_socket<Protocol, Executor>& s, Iterator begin,
|
||||
* }
|
||||
* } @endcode
|
||||
*/
|
||||
template <typename Protocol, typename Executor, typename Iterator,
|
||||
typename ConnectCondition, typename IteratorConnectHandler>
|
||||
ASIO_INITFN_RESULT_TYPE(IteratorConnectHandler,
|
||||
template <typename Protocol, typename Executor,
|
||||
typename Iterator, typename ConnectCondition,
|
||||
ASIO_COMPLETION_TOKEN_FOR(void (asio::error_code,
|
||||
Iterator)) IteratorConnectHandler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(Executor)>
|
||||
ASIO_INITFN_AUTO_RESULT_TYPE(IteratorConnectHandler,
|
||||
void (asio::error_code, Iterator))
|
||||
async_connect(basic_socket<Protocol, Executor>& s, Iterator begin,
|
||||
Iterator end, ConnectCondition connect_condition,
|
||||
ASIO_MOVE_ARG(IteratorConnectHandler) handler);
|
||||
ASIO_MOVE_ARG(IteratorConnectHandler) handler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN(Executor));
|
||||
|
||||
/*@}*/
|
||||
|
||||
|
||||
@@ -54,8 +54,8 @@ namespace asio {
|
||||
*
|
||||
* @li Returns <tt>result.get()</tt>.
|
||||
*/
|
||||
template <typename CompletionToken>
|
||||
ASIO_INITFN_RESULT_TYPE(CompletionToken, void()) defer(
|
||||
template <ASIO_COMPLETION_TOKEN_FOR(void()) CompletionToken>
|
||||
ASIO_INITFN_AUTO_RESULT_TYPE(CompletionToken, void()) defer(
|
||||
ASIO_MOVE_ARG(CompletionToken) token);
|
||||
|
||||
/// Submits a completion token or function object for execution.
|
||||
@@ -93,18 +93,28 @@ ASIO_INITFN_RESULT_TYPE(CompletionToken, void()) defer(
|
||||
*
|
||||
* @li Returns <tt>result.get()</tt>.
|
||||
*/
|
||||
template <typename Executor, typename CompletionToken>
|
||||
ASIO_INITFN_RESULT_TYPE(CompletionToken, void()) defer(
|
||||
const Executor& ex, ASIO_MOVE_ARG(CompletionToken) token,
|
||||
template <typename Executor,
|
||||
ASIO_COMPLETION_TOKEN_FOR(void()) CompletionToken
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(Executor)>
|
||||
ASIO_INITFN_AUTO_RESULT_TYPE(CompletionToken, void()) defer(
|
||||
const Executor& ex,
|
||||
ASIO_MOVE_ARG(CompletionToken) token
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN(Executor),
|
||||
typename enable_if<is_executor<Executor>::value>::type* = 0);
|
||||
|
||||
/// Submits a completion token or function object for execution.
|
||||
/**
|
||||
* @returns <tt>defer(ctx.get_executor(), forward<CompletionToken>(token))</tt>.
|
||||
*/
|
||||
template <typename ExecutionContext, typename CompletionToken>
|
||||
ASIO_INITFN_RESULT_TYPE(CompletionToken, void()) defer(
|
||||
ExecutionContext& ctx, ASIO_MOVE_ARG(CompletionToken) token,
|
||||
template <typename ExecutionContext,
|
||||
ASIO_COMPLETION_TOKEN_FOR(void()) CompletionToken
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(
|
||||
typename ExecutionContext::executor_type)>
|
||||
ASIO_INITFN_AUTO_RESULT_TYPE(CompletionToken, void()) defer(
|
||||
ExecutionContext& ctx,
|
||||
ASIO_MOVE_ARG(CompletionToken) token
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN(
|
||||
typename ExecutionContext::executor_type),
|
||||
typename enable_if<is_convertible<
|
||||
ExecutionContext&, execution_context&>::value>::type* = 0);
|
||||
|
||||
|
||||
@@ -328,6 +328,42 @@
|
||||
# endif // !defined(ASIO_DISABLE_ALIAS_TEMPLATES)
|
||||
#endif // !defined(ASIO_HAS_ALIAS_TEMPLATES)
|
||||
|
||||
// Support return type deduction on compilers known to allow it.
|
||||
#if !defined(ASIO_HAS_RETURN_TYPE_DEDUCTION)
|
||||
# if !defined(ASIO_DISABLE_RETURN_TYPE_DEDUCTION)
|
||||
# if defined(__clang__)
|
||||
# if __has_feature(__cxx_return_type_deduction__)
|
||||
# define ASIO_HAS_RETURN_TYPE_DEDUCTION 1
|
||||
# endif // __has_feature(__cxx_alias_templates__)
|
||||
# elif (__cplusplus >= 201402)
|
||||
# define ASIO_HAS_RETURN_TYPE_DEDUCTION 1
|
||||
# elif defined(__cpp_return_type_deduction)
|
||||
# if (__cpp_return_type_deduction >= 201304)
|
||||
# define ASIO_HAS_RETURN_TYPE_DEDUCTION 1
|
||||
# endif // (__cpp_return_type_deduction >= 201304)
|
||||
# endif // defined(__cpp_return_type_deduction)
|
||||
# endif // !defined(ASIO_DISABLE_RETURN_TYPE_DEDUCTION)
|
||||
#endif // !defined(ASIO_HAS_RETURN_TYPE_DEDUCTION)
|
||||
|
||||
// Support default function template arguments on compilers known to allow it.
|
||||
#if !defined(ASIO_HAS_DEFAULT_FUNCTION_TEMPLATE_ARGUMENTS)
|
||||
# if !defined(ASIO_DISABLE_DEFAULT_FUNCTION_TEMPLATE_ARGUMENTS)
|
||||
# if (__cplusplus >= 201103)
|
||||
# define ASIO_HAS_DEFAULT_FUNCTION_TEMPLATE_ARGUMENTS 1
|
||||
# endif // (__cplusplus >= 201103)
|
||||
# endif // !defined(ASIO_DISABLE_DEFAULT_FUNCTION_TEMPLATE_ARGUMENTS)
|
||||
#endif // !defined(ASIO_HAS_DEFAULT_FUNCTION_TEMPLATE_ARGUMENTS)
|
||||
|
||||
// Support concepts on compilers known to allow them.
|
||||
#if !defined(ASIO_HAS_CONCEPTS)
|
||||
# if !defined(ASIO_DISABLE_CONCEPTS)
|
||||
# if __cpp_concepts
|
||||
# define ASIO_HAS_CONCEPTS 1
|
||||
# define ASIO_CONCEPT concept bool
|
||||
# endif // __cpp_concepts
|
||||
# endif // !defined(ASIO_DISABLE_CONCEPTS)
|
||||
#endif // !defined(ASIO_HAS_CONCEPTS)
|
||||
|
||||
// Standard library support for system errors.
|
||||
#if !defined(ASIO_HAS_STD_SYSTEM_ERROR)
|
||||
# if !defined(ASIO_DISABLE_STD_SYSTEM_ERROR)
|
||||
@@ -357,7 +393,7 @@
|
||||
|
||||
// Compliant C++11 compilers put noexcept specifiers on error_category members.
|
||||
#if !defined(ASIO_ERROR_CATEGORY_NOEXCEPT)
|
||||
# if (BOOST_VERSION >= 105300)
|
||||
# if defined(ASIO_HAS_BOOST_CONFIG) && (BOOST_VERSION >= 105300)
|
||||
# define ASIO_ERROR_CATEGORY_NOEXCEPT BOOST_NOEXCEPT
|
||||
# elif defined(__clang__)
|
||||
# if __has_feature(__cxx_noexcept__)
|
||||
@@ -524,9 +560,9 @@
|
||||
// Boost support for chrono.
|
||||
#if !defined(ASIO_HAS_BOOST_CHRONO)
|
||||
# if !defined(ASIO_DISABLE_BOOST_CHRONO)
|
||||
# if (BOOST_VERSION >= 104700)
|
||||
# if defined(ASIO_HAS_BOOST_CONFIG) && (BOOST_VERSION >= 104700)
|
||||
# define ASIO_HAS_BOOST_CHRONO 1
|
||||
# endif // (BOOST_VERSION >= 104700)
|
||||
# endif // defined(ASIO_HAS_BOOST_CONFIG) && (BOOST_VERSION >= 104700)
|
||||
# endif // !defined(ASIO_DISABLE_BOOST_CHRONO)
|
||||
#endif // !defined(ASIO_HAS_BOOST_CHRONO)
|
||||
|
||||
@@ -1248,6 +1284,8 @@
|
||||
# define ASIO_HAS_THREADS 1
|
||||
# elif defined(__APPLE__)
|
||||
# define ASIO_HAS_THREADS 1
|
||||
# elif defined(__HAIKU__)
|
||||
# define ASIO_HAS_THREADS 1
|
||||
# elif defined(_POSIX_THREADS) && (_POSIX_THREADS + 0 >= 0)
|
||||
# define ASIO_HAS_THREADS 1
|
||||
# elif defined(_PTHREADS)
|
||||
@@ -1263,6 +1301,8 @@
|
||||
# define ASIO_HAS_PTHREADS 1
|
||||
# elif defined(_POSIX_THREADS) && (_POSIX_THREADS + 0 >= 0)
|
||||
# define ASIO_HAS_PTHREADS 1
|
||||
# elif defined(__HAIKU__)
|
||||
# define ASIO_HAS_PTHREADS 1
|
||||
# endif // defined(ASIO_HAS_BOOST_CONFIG) && defined(BOOST_HAS_PTHREADS)
|
||||
# endif // defined(ASIO_HAS_THREADS)
|
||||
#endif // !defined(ASIO_HAS_PTHREADS)
|
||||
@@ -1443,11 +1483,11 @@
|
||||
# endif // defined(ASIO_MSVC)
|
||||
# endif // !defined(ASIO_DISABLE_CO_AWAIT)
|
||||
# if defined(__clang__)
|
||||
# if (__cpp_coroutines >= 201703)
|
||||
# if (__cplusplus >= 201703) && (__cpp_coroutines >= 201703)
|
||||
# if __has_include(<experimental/coroutine>)
|
||||
# define ASIO_HAS_CO_AWAIT 1
|
||||
# endif // __has_include(<experimental/coroutine>)
|
||||
# endif // (__cpp_coroutines >= 201703)
|
||||
# endif // (__cplusplus >= 201703) && (__cpp_coroutines >= 201703)
|
||||
# endif // defined(__clang__)
|
||||
#endif // !defined(ASIO_HAS_CO_AWAIT)
|
||||
|
||||
|
||||
@@ -48,6 +48,7 @@ void reactive_socket_service_base::construct(
|
||||
void reactive_socket_service_base::base_move_construct(
|
||||
reactive_socket_service_base::base_implementation_type& impl,
|
||||
reactive_socket_service_base::base_implementation_type& other_impl)
|
||||
ASIO_NOEXCEPT
|
||||
{
|
||||
impl.socket_ = other_impl.socket_;
|
||||
other_impl.socket_ = invalid_socket;
|
||||
|
||||
@@ -242,7 +242,8 @@ asio::error_code win_iocp_handle_service::cancel(
|
||||
{
|
||||
// The version of Windows supports cancellation from any thread.
|
||||
typedef BOOL (WINAPI* cancel_io_ex_t)(HANDLE, LPOVERLAPPED);
|
||||
cancel_io_ex_t cancel_io_ex = (cancel_io_ex_t)cancel_io_ex_ptr;
|
||||
cancel_io_ex_t cancel_io_ex = reinterpret_cast<cancel_io_ex_t>(
|
||||
reinterpret_cast<void*>(cancel_io_ex_ptr));
|
||||
if (!cancel_io_ex(impl.handle_, 0))
|
||||
{
|
||||
DWORD last_error = ::GetLastError();
|
||||
|
||||
@@ -79,11 +79,22 @@ asio::error_code win_iocp_serial_port_service::open(
|
||||
}
|
||||
|
||||
// Set some default serial port parameters. This implementation does not
|
||||
// support changing these, so they might as well be in a known state.
|
||||
// support changing all of these, so they might as well be in a known state.
|
||||
dcb.fBinary = TRUE; // Win32 only supports binary mode.
|
||||
dcb.fDsrSensitivity = FALSE;
|
||||
dcb.fNull = FALSE; // Do not ignore NULL characters.
|
||||
dcb.fAbortOnError = FALSE; // Ignore serial framing errors.
|
||||
dcb.BaudRate = CBR_9600; // 9600 baud by default
|
||||
dcb.ByteSize = 8; // 8 bit bytes
|
||||
dcb.fOutxCtsFlow = FALSE; // No flow control
|
||||
dcb.fOutxDsrFlow = FALSE;
|
||||
dcb.fDtrControl = DTR_CONTROL_DISABLE;
|
||||
dcb.fDsrSensitivity = FALSE;
|
||||
dcb.fOutX = FALSE;
|
||||
dcb.fInX = FALSE;
|
||||
dcb.fRtsControl = RTS_CONTROL_DISABLE;
|
||||
dcb.fParity = FALSE; // No parity
|
||||
dcb.Parity = NOPARITY;
|
||||
dcb.StopBits = ONESTOPBIT; // One stop bit
|
||||
if (!::SetCommState(handle, &dcb))
|
||||
{
|
||||
DWORD last_error = ::GetLastError();
|
||||
|
||||
@@ -72,6 +72,7 @@ void win_iocp_socket_service_base::construct(
|
||||
void win_iocp_socket_service_base::base_move_construct(
|
||||
win_iocp_socket_service_base::base_implementation_type& impl,
|
||||
win_iocp_socket_service_base::base_implementation_type& other_impl)
|
||||
ASIO_NOEXCEPT
|
||||
{
|
||||
impl.socket_ = other_impl.socket_;
|
||||
other_impl.socket_ = invalid_socket;
|
||||
@@ -249,7 +250,8 @@ asio::error_code win_iocp_socket_service_base::cancel(
|
||||
{
|
||||
// The version of Windows supports cancellation from any thread.
|
||||
typedef BOOL (WINAPI* cancel_io_ex_t)(HANDLE, LPOVERLAPPED);
|
||||
cancel_io_ex_t cancel_io_ex = (cancel_io_ex_t)cancel_io_ex_ptr;
|
||||
cancel_io_ex_t cancel_io_ex = reinterpret_cast<cancel_io_ex_t>(
|
||||
reinterpret_cast<void*>(cancel_io_ex_ptr));
|
||||
socket_type sock = impl.socket_;
|
||||
HANDLE sock_as_handle = reinterpret_cast<HANDLE>(sock);
|
||||
if (!cancel_io_ex(sock_as_handle, 0))
|
||||
|
||||
@@ -66,6 +66,7 @@ void winrt_ssocket_service_base::construct(
|
||||
void winrt_ssocket_service_base::base_move_construct(
|
||||
winrt_ssocket_service_base::base_implementation_type& impl,
|
||||
winrt_ssocket_service_base::base_implementation_type& other_impl)
|
||||
ASIO_NOEXCEPT
|
||||
{
|
||||
impl.socket_ = other_impl.socket_;
|
||||
other_impl.socket_ = nullptr;
|
||||
|
||||
@@ -112,6 +112,13 @@ public:
|
||||
// When using a native implementation, I/O completion handlers are
|
||||
// already dispatched according to the execution context's executor's
|
||||
// rules. We can call the function directly.
|
||||
#if defined(ASIO_HAS_MOVE)
|
||||
if (is_same<F, typename decay<F>::type>::value)
|
||||
{
|
||||
asio_handler_invoke_helpers::invoke(f, f);
|
||||
return;
|
||||
}
|
||||
#endif // defined(ASIO_HAS_MOVE)
|
||||
typename decay<F>::type function(ASIO_MOVE_CAST(F)(f));
|
||||
asio_handler_invoke_helpers::invoke(function, function);
|
||||
}
|
||||
|
||||
@@ -53,19 +53,22 @@ struct buffer_sequence_memfns_check
|
||||
{
|
||||
};
|
||||
|
||||
template <typename>
|
||||
char (&buffer_sequence_begin_helper(...))[2];
|
||||
|
||||
#if defined(ASIO_HAS_DECLTYPE)
|
||||
|
||||
template <typename>
|
||||
char buffer_sequence_begin_helper(...);
|
||||
|
||||
template <typename T>
|
||||
char buffer_sequence_begin_helper(T* t,
|
||||
char (&buffer_sequence_begin_helper(T* t,
|
||||
typename enable_if<!is_same<
|
||||
decltype(asio::buffer_sequence_begin(*t)),
|
||||
void>::value>::type*);
|
||||
void>::value>::type*))[2];
|
||||
|
||||
#else // defined(ASIO_HAS_DECLTYPE)
|
||||
|
||||
template <typename>
|
||||
char (&buffer_sequence_begin_helper(...))[2];
|
||||
|
||||
template <typename T>
|
||||
char buffer_sequence_begin_helper(T* t,
|
||||
buffer_sequence_memfns_check<
|
||||
@@ -74,19 +77,22 @@ char buffer_sequence_begin_helper(T* t,
|
||||
|
||||
#endif // defined(ASIO_HAS_DECLTYPE)
|
||||
|
||||
template <typename>
|
||||
char (&buffer_sequence_end_helper(...))[2];
|
||||
|
||||
#if defined(ASIO_HAS_DECLTYPE)
|
||||
|
||||
template <typename>
|
||||
char buffer_sequence_end_helper(...);
|
||||
|
||||
template <typename T>
|
||||
char buffer_sequence_end_helper(T* t,
|
||||
char (&buffer_sequence_end_helper(T* t,
|
||||
typename enable_if<!is_same<
|
||||
decltype(asio::buffer_sequence_end(*t)),
|
||||
void>::value>::type*);
|
||||
void>::value>::type*))[2];
|
||||
|
||||
#else // defined(ASIO_HAS_DECLTYPE)
|
||||
|
||||
template <typename>
|
||||
char (&buffer_sequence_end_helper(...))[2];
|
||||
|
||||
template <typename T>
|
||||
char buffer_sequence_end_helper(T* t,
|
||||
buffer_sequence_memfns_check<
|
||||
@@ -214,8 +220,8 @@ char mutable_buffers_type_typedef_helper(
|
||||
template <typename T, typename Buffer>
|
||||
struct is_buffer_sequence_class
|
||||
: integral_constant<bool,
|
||||
sizeof(buffer_sequence_begin_helper<T>(0)) != 1 &&
|
||||
sizeof(buffer_sequence_end_helper<T>(0)) != 1 &&
|
||||
sizeof(buffer_sequence_begin_helper<T>(0, 0)) != 1 &&
|
||||
sizeof(buffer_sequence_end_helper<T>(0, 0)) != 1 &&
|
||||
sizeof(buffer_sequence_element_type_helper<T, Buffer>(0, 0)) == 1>
|
||||
{
|
||||
};
|
||||
|
||||
@@ -88,7 +88,7 @@ public:
|
||||
|
||||
// Move-construct a new socket implementation.
|
||||
void move_construct(implementation_type& impl,
|
||||
implementation_type& other_impl)
|
||||
implementation_type& other_impl) ASIO_NOEXCEPT
|
||||
{
|
||||
this->base_move_construct(impl, other_impl);
|
||||
|
||||
|
||||
@@ -72,7 +72,7 @@ public:
|
||||
|
||||
// Move-construct a new socket implementation.
|
||||
ASIO_DECL void base_move_construct(base_implementation_type& impl,
|
||||
base_implementation_type& other_impl);
|
||||
base_implementation_type& other_impl) ASIO_NOEXCEPT;
|
||||
|
||||
// Move-assign from another socket implementation.
|
||||
ASIO_DECL void base_move_assign(base_implementation_type& impl,
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
# include <boost/type_traits/is_same.hpp>
|
||||
# include <boost/type_traits/remove_pointer.hpp>
|
||||
# include <boost/type_traits/remove_reference.hpp>
|
||||
# include <boost/utility/declval.hpp>
|
||||
# include <boost/utility/enable_if.hpp>
|
||||
# include <boost/utility/result_of.hpp>
|
||||
#endif // defined(ASIO_HAS_TYPE_TRAITS)
|
||||
@@ -42,6 +43,7 @@ namespace asio {
|
||||
using std::add_const;
|
||||
using std::conditional;
|
||||
using std::decay;
|
||||
using std::declval;
|
||||
using std::enable_if;
|
||||
using std::false_type;
|
||||
using std::integral_constant;
|
||||
@@ -67,6 +69,7 @@ template <bool Condition, typename Type = void>
|
||||
struct enable_if : boost::enable_if_c<Condition, Type> {};
|
||||
using boost::conditional;
|
||||
using boost::decay;
|
||||
using boost::declval;
|
||||
using boost::false_type;
|
||||
using boost::integral_constant;
|
||||
using boost::is_base_of;
|
||||
|
||||
@@ -108,6 +108,24 @@
|
||||
ASIO_MOVE_CAST(T3)(x3), ASIO_MOVE_CAST(T4)(x4), \
|
||||
ASIO_MOVE_CAST(T5)(x5)
|
||||
|
||||
# define ASIO_VARIADIC_MOVE_DECLVAL(n) \
|
||||
ASIO_VARIADIC_MOVE_DECLVAL_##n
|
||||
|
||||
# define ASIO_VARIADIC_MOVE_DECLVAL_1 \
|
||||
declval<ASIO_MOVE_ARG(T1)>()
|
||||
# define ASIO_VARIADIC_MOVE_DECLVAL_2 \
|
||||
declval<ASIO_MOVE_ARG(T1)>(), declval<ASIO_MOVE_ARG(T2)>()
|
||||
# define ASIO_VARIADIC_MOVE_DECLVAL_3 \
|
||||
declval<ASIO_MOVE_ARG(T1)>(), declval<ASIO_MOVE_ARG(T2)>(), \
|
||||
declval<ASIO_MOVE_ARG(T3)>()
|
||||
# define ASIO_VARIADIC_MOVE_DECLVAL_4 \
|
||||
declval<ASIO_MOVE_ARG(T1)>(), declval<ASIO_MOVE_ARG(T2)>(), \
|
||||
declval<ASIO_MOVE_ARG(T3)>(), declval<ASIO_MOVE_ARG(T4)>()
|
||||
# define ASIO_VARIADIC_MOVE_DECLVAL_5 \
|
||||
declval<ASIO_MOVE_ARG(T1)>(), declval<ASIO_MOVE_ARG(T2)>(), \
|
||||
declval<ASIO_MOVE_ARG(T3)>(), declval<ASIO_MOVE_ARG(T4)>(), \
|
||||
declval<ASIO_MOVE_ARG(T5)>()
|
||||
|
||||
# define ASIO_VARIADIC_DECAY(n) \
|
||||
ASIO_VARIADIC_DECAY_##n
|
||||
|
||||
|
||||
@@ -99,6 +99,7 @@ public:
|
||||
if (ec == asio::error::connection_aborted
|
||||
&& !o->enable_connection_aborted_)
|
||||
{
|
||||
handler_work<Handler, IoExecutor>::start(o->handler_, o->io_executor_);
|
||||
o->reset();
|
||||
o->socket_service_.restart_accept_op(o->socket_,
|
||||
o->new_socket_, o->protocol_.family(),
|
||||
@@ -228,6 +229,7 @@ public:
|
||||
if (ec == asio::error::connection_aborted
|
||||
&& !o->enable_connection_aborted_)
|
||||
{
|
||||
handler_work<Handler, IoExecutor>::start(o->handler_, o->io_executor_);
|
||||
o->reset();
|
||||
o->socket_service_.restart_accept_op(o->socket_,
|
||||
o->new_socket_, o->protocol_.family(),
|
||||
|
||||
@@ -144,7 +144,7 @@ public:
|
||||
|
||||
// Move-construct a new socket implementation.
|
||||
void move_construct(implementation_type& impl,
|
||||
implementation_type& other_impl)
|
||||
implementation_type& other_impl) ASIO_NOEXCEPT
|
||||
{
|
||||
this->base_move_construct(impl, other_impl);
|
||||
|
||||
|
||||
@@ -95,7 +95,7 @@ public:
|
||||
|
||||
// Move-construct a new socket implementation.
|
||||
ASIO_DECL void base_move_construct(base_implementation_type& impl,
|
||||
base_implementation_type& other_impl);
|
||||
base_implementation_type& other_impl) ASIO_NOEXCEPT;
|
||||
|
||||
// Move-assign from another socket implementation.
|
||||
ASIO_DECL void base_move_assign(base_implementation_type& impl,
|
||||
|
||||
@@ -75,7 +75,7 @@ public:
|
||||
|
||||
// Move-construct a new socket implementation.
|
||||
void move_construct(implementation_type& impl,
|
||||
implementation_type& other_impl)
|
||||
implementation_type& other_impl) ASIO_NOEXCEPT
|
||||
{
|
||||
this->base_move_construct(impl, other_impl);
|
||||
|
||||
@@ -178,6 +178,14 @@ public:
|
||||
return endpoint;
|
||||
}
|
||||
|
||||
// Disable sends or receives on the socket.
|
||||
asio::error_code shutdown(implementation_type&,
|
||||
socket_base::shutdown_type, asio::error_code& ec)
|
||||
{
|
||||
ec = asio::error::operation_not_supported;
|
||||
return ec;
|
||||
}
|
||||
|
||||
// Set a socket option.
|
||||
template <typename Option>
|
||||
asio::error_code set_option(implementation_type& impl,
|
||||
|
||||
@@ -77,7 +77,7 @@ public:
|
||||
|
||||
// Move-construct a new socket implementation.
|
||||
ASIO_DECL void base_move_construct(base_implementation_type& impl,
|
||||
base_implementation_type& other_impl);
|
||||
base_implementation_type& other_impl) ASIO_NOEXCEPT;
|
||||
|
||||
// Move-assign from another socket implementation.
|
||||
ASIO_DECL void base_move_assign(base_implementation_type& impl,
|
||||
@@ -168,14 +168,6 @@ public:
|
||||
return ec;
|
||||
}
|
||||
|
||||
// Disable sends or receives on the socket.
|
||||
asio::error_code shutdown(base_implementation_type&,
|
||||
socket_base::shutdown_type, asio::error_code& ec)
|
||||
{
|
||||
ec = asio::error::operation_not_supported;
|
||||
return ec;
|
||||
}
|
||||
|
||||
// Send the given data to the peer.
|
||||
template <typename ConstBufferSequence>
|
||||
std::size_t send(base_implementation_type& impl,
|
||||
|
||||
@@ -49,8 +49,8 @@ namespace asio {
|
||||
*
|
||||
* @li Returns <tt>result.get()</tt>.
|
||||
*/
|
||||
template <typename CompletionToken>
|
||||
ASIO_INITFN_RESULT_TYPE(CompletionToken, void()) dispatch(
|
||||
template <ASIO_COMPLETION_TOKEN_FOR(void()) CompletionToken>
|
||||
ASIO_INITFN_AUTO_RESULT_TYPE(CompletionToken, void()) dispatch(
|
||||
ASIO_MOVE_ARG(CompletionToken) token);
|
||||
|
||||
/// Submits a completion token or function object for execution.
|
||||
@@ -83,9 +83,13 @@ ASIO_INITFN_RESULT_TYPE(CompletionToken, void()) dispatch(
|
||||
*
|
||||
* @li Returns <tt>result.get()</tt>.
|
||||
*/
|
||||
template <typename Executor, typename CompletionToken>
|
||||
ASIO_INITFN_RESULT_TYPE(CompletionToken, void()) dispatch(
|
||||
const Executor& ex, ASIO_MOVE_ARG(CompletionToken) token,
|
||||
template <typename Executor,
|
||||
ASIO_COMPLETION_TOKEN_FOR(void()) CompletionToken
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(Executor)>
|
||||
ASIO_INITFN_AUTO_RESULT_TYPE(CompletionToken, void()) dispatch(
|
||||
const Executor& ex,
|
||||
ASIO_MOVE_ARG(CompletionToken) token
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN(Executor),
|
||||
typename enable_if<is_executor<Executor>::value>::type* = 0);
|
||||
|
||||
/// Submits a completion token or function object for execution.
|
||||
@@ -93,9 +97,15 @@ ASIO_INITFN_RESULT_TYPE(CompletionToken, void()) dispatch(
|
||||
* @returns <tt>dispatch(ctx.get_executor(),
|
||||
* forward<CompletionToken>(token))</tt>.
|
||||
*/
|
||||
template <typename ExecutionContext, typename CompletionToken>
|
||||
ASIO_INITFN_RESULT_TYPE(CompletionToken, void()) dispatch(
|
||||
ExecutionContext& ctx, ASIO_MOVE_ARG(CompletionToken) token,
|
||||
template <typename ExecutionContext,
|
||||
ASIO_COMPLETION_TOKEN_FOR(void()) CompletionToken
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(
|
||||
typename ExecutionContext::executor_type)>
|
||||
ASIO_INITFN_AUTO_RESULT_TYPE(CompletionToken, void()) dispatch(
|
||||
ExecutionContext& ctx,
|
||||
ASIO_MOVE_ARG(CompletionToken) token
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN(
|
||||
typename ExecutionContext::executor_type),
|
||||
typename enable_if<is_convertible<
|
||||
ExecutionContext&, execution_context&>::value>::type* = 0);
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ public:
|
||||
#endif
|
||||
|
||||
/// Default constructor.
|
||||
basic_endpoint()
|
||||
basic_endpoint() ASIO_NOEXCEPT
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -73,19 +73,19 @@ public:
|
||||
}
|
||||
|
||||
/// Obtain an identifier for the type of the protocol.
|
||||
int type() const
|
||||
int type() const ASIO_NOEXCEPT
|
||||
{
|
||||
return ASIO_OS_DEF(SOCK_DGRAM);
|
||||
}
|
||||
|
||||
/// Obtain an identifier for the protocol.
|
||||
int protocol() const
|
||||
int protocol() const ASIO_NOEXCEPT
|
||||
{
|
||||
return protocol_;
|
||||
}
|
||||
|
||||
/// Obtain an identifier for the protocol family.
|
||||
int family() const
|
||||
int family() const ASIO_NOEXCEPT
|
||||
{
|
||||
return family_;
|
||||
}
|
||||
|
||||
@@ -73,19 +73,19 @@ public:
|
||||
}
|
||||
|
||||
/// Obtain an identifier for the type of the protocol.
|
||||
int type() const
|
||||
int type() const ASIO_NOEXCEPT
|
||||
{
|
||||
return ASIO_OS_DEF(SOCK_RAW);
|
||||
}
|
||||
|
||||
/// Obtain an identifier for the protocol.
|
||||
int protocol() const
|
||||
int protocol() const ASIO_NOEXCEPT
|
||||
{
|
||||
return protocol_;
|
||||
}
|
||||
|
||||
/// Obtain an identifier for the protocol family.
|
||||
int family() const
|
||||
int family() const ASIO_NOEXCEPT
|
||||
{
|
||||
return family_;
|
||||
}
|
||||
|
||||
@@ -72,19 +72,19 @@ public:
|
||||
}
|
||||
|
||||
/// Obtain an identifier for the type of the protocol.
|
||||
int type() const
|
||||
int type() const ASIO_NOEXCEPT
|
||||
{
|
||||
return ASIO_OS_DEF(SOCK_SEQPACKET);
|
||||
}
|
||||
|
||||
/// Obtain an identifier for the protocol.
|
||||
int protocol() const
|
||||
int protocol() const ASIO_NOEXCEPT
|
||||
{
|
||||
return protocol_;
|
||||
}
|
||||
|
||||
/// Obtain an identifier for the protocol family.
|
||||
int family() const
|
||||
int family() const ASIO_NOEXCEPT
|
||||
{
|
||||
return family_;
|
||||
}
|
||||
|
||||
@@ -74,19 +74,19 @@ public:
|
||||
}
|
||||
|
||||
/// Obtain an identifier for the type of the protocol.
|
||||
int type() const
|
||||
int type() const ASIO_NOEXCEPT
|
||||
{
|
||||
return ASIO_OS_DEF(SOCK_STREAM);
|
||||
}
|
||||
|
||||
/// Obtain an identifier for the protocol.
|
||||
int protocol() const
|
||||
int protocol() const ASIO_NOEXCEPT
|
||||
{
|
||||
return protocol_;
|
||||
}
|
||||
|
||||
/// Obtain an identifier for the protocol family.
|
||||
int family() const
|
||||
int family() const ASIO_NOEXCEPT
|
||||
{
|
||||
return family_;
|
||||
}
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
#include "asio/detail/handler_invoke_helpers.hpp"
|
||||
#include "asio/detail/handler_type_requirements.hpp"
|
||||
#include "asio/detail/non_const_lvalue.hpp"
|
||||
#include "asio/detail/type_traits.hpp"
|
||||
|
||||
#include "asio/detail/push_options.hpp"
|
||||
|
||||
@@ -139,11 +140,26 @@ namespace detail
|
||||
function, this_handler->handler_);
|
||||
}
|
||||
|
||||
struct initiate_async_buffered_fill
|
||||
template <typename Stream>
|
||||
class initiate_async_buffered_fill
|
||||
{
|
||||
template <typename ReadHandler, typename Stream>
|
||||
public:
|
||||
typedef typename remove_reference<
|
||||
Stream>::type::lowest_layer_type::executor_type executor_type;
|
||||
|
||||
explicit initiate_async_buffered_fill(Stream& next_layer)
|
||||
: next_layer_(next_layer)
|
||||
{
|
||||
}
|
||||
|
||||
executor_type get_executor() const ASIO_NOEXCEPT
|
||||
{
|
||||
return next_layer_.lowest_layer().get_executor();
|
||||
}
|
||||
|
||||
template <typename ReadHandler>
|
||||
void operator()(ASIO_MOVE_ARG(ReadHandler) handler,
|
||||
buffered_stream_storage* storage, Stream* next_layer) const
|
||||
buffered_stream_storage* storage) const
|
||||
{
|
||||
// If you get an error on the following line it means that your handler
|
||||
// does not meet the documented type requirements for a ReadHandler.
|
||||
@@ -152,13 +168,16 @@ namespace detail
|
||||
non_const_lvalue<ReadHandler> handler2(handler);
|
||||
std::size_t previous_size = storage->size();
|
||||
storage->resize(storage->capacity());
|
||||
next_layer->async_read_some(
|
||||
next_layer_.async_read_some(
|
||||
buffer(
|
||||
storage->data() + previous_size,
|
||||
storage->size() - previous_size),
|
||||
buffered_fill_handler<typename decay<ReadHandler>::type>(
|
||||
*storage, previous_size, handler2.value));
|
||||
}
|
||||
|
||||
private:
|
||||
Stream& next_layer_;
|
||||
};
|
||||
} // namespace detail
|
||||
|
||||
@@ -193,15 +212,18 @@ struct associated_executor<
|
||||
#endif // !defined(GENERATING_DOCUMENTATION)
|
||||
|
||||
template <typename Stream>
|
||||
template <typename ReadHandler>
|
||||
ASIO_INITFN_RESULT_TYPE(ReadHandler,
|
||||
template <
|
||||
ASIO_COMPLETION_TOKEN_FOR(void (asio::error_code,
|
||||
std::size_t)) ReadHandler>
|
||||
ASIO_INITFN_AUTO_RESULT_TYPE(ReadHandler,
|
||||
void (asio::error_code, std::size_t))
|
||||
buffered_read_stream<Stream>::async_fill(
|
||||
ASIO_MOVE_ARG(ReadHandler) handler)
|
||||
{
|
||||
return async_initiate<ReadHandler,
|
||||
void (asio::error_code, std::size_t)>(
|
||||
detail::initiate_async_buffered_fill(), handler, &storage_, &next_layer_);
|
||||
detail::initiate_async_buffered_fill<Stream>(next_layer_),
|
||||
handler, &storage_);
|
||||
}
|
||||
|
||||
template <typename Stream>
|
||||
@@ -335,12 +357,26 @@ namespace detail
|
||||
function, this_handler->handler_);
|
||||
}
|
||||
|
||||
struct initiate_async_buffered_read_some
|
||||
template <typename Stream>
|
||||
class initiate_async_buffered_read_some
|
||||
{
|
||||
template <typename ReadHandler, typename Stream,
|
||||
typename MutableBufferSequence>
|
||||
public:
|
||||
typedef typename remove_reference<
|
||||
Stream>::type::lowest_layer_type::executor_type executor_type;
|
||||
|
||||
explicit initiate_async_buffered_read_some(Stream& next_layer)
|
||||
: next_layer_(next_layer)
|
||||
{
|
||||
}
|
||||
|
||||
executor_type get_executor() const ASIO_NOEXCEPT
|
||||
{
|
||||
return next_layer_.lowest_layer().get_executor();
|
||||
}
|
||||
|
||||
template <typename ReadHandler, typename MutableBufferSequence>
|
||||
void operator()(ASIO_MOVE_ARG(ReadHandler) handler,
|
||||
buffered_stream_storage* storage, Stream* next_layer,
|
||||
buffered_stream_storage* storage,
|
||||
const MutableBufferSequence& buffers) const
|
||||
{
|
||||
// If you get an error on the following line it means that your handler
|
||||
@@ -351,20 +387,23 @@ namespace detail
|
||||
non_const_lvalue<ReadHandler> handler2(handler);
|
||||
if (buffer_size(buffers) == 0 || !storage->empty())
|
||||
{
|
||||
next_layer->async_read_some(ASIO_MUTABLE_BUFFER(0, 0),
|
||||
next_layer_.async_read_some(ASIO_MUTABLE_BUFFER(0, 0),
|
||||
buffered_read_some_handler<MutableBufferSequence,
|
||||
typename decay<ReadHandler>::type>(
|
||||
*storage, buffers, handler2.value));
|
||||
}
|
||||
else
|
||||
{
|
||||
initiate_async_buffered_fill()(
|
||||
initiate_async_buffered_fill<Stream>(this->next_layer_)(
|
||||
buffered_read_some_handler<MutableBufferSequence,
|
||||
typename decay<ReadHandler>::type>(
|
||||
*storage, buffers, handler2.value),
|
||||
storage, next_layer);
|
||||
storage);
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
Stream& next_layer_;
|
||||
};
|
||||
} // namespace detail
|
||||
|
||||
@@ -407,8 +446,10 @@ struct associated_executor<
|
||||
#endif // !defined(GENERATING_DOCUMENTATION)
|
||||
|
||||
template <typename Stream>
|
||||
template <typename MutableBufferSequence, typename ReadHandler>
|
||||
ASIO_INITFN_RESULT_TYPE(ReadHandler,
|
||||
template <typename MutableBufferSequence,
|
||||
ASIO_COMPLETION_TOKEN_FOR(void (asio::error_code,
|
||||
std::size_t)) ReadHandler>
|
||||
ASIO_INITFN_AUTO_RESULT_TYPE(ReadHandler,
|
||||
void (asio::error_code, std::size_t))
|
||||
buffered_read_stream<Stream>::async_read_some(
|
||||
const MutableBufferSequence& buffers,
|
||||
@@ -416,8 +457,8 @@ buffered_read_stream<Stream>::async_read_some(
|
||||
{
|
||||
return async_initiate<ReadHandler,
|
||||
void (asio::error_code, std::size_t)>(
|
||||
detail::initiate_async_buffered_read_some(),
|
||||
handler, &storage_, &next_layer_, buffers);
|
||||
detail::initiate_async_buffered_read_some<Stream>(next_layer_),
|
||||
handler, &storage_, buffers);
|
||||
}
|
||||
|
||||
template <typename Stream>
|
||||
|
||||
@@ -125,21 +125,39 @@ namespace detail
|
||||
function, this_handler->handler_);
|
||||
}
|
||||
|
||||
struct initiate_async_buffered_flush
|
||||
template <typename Stream>
|
||||
class initiate_async_buffered_flush
|
||||
{
|
||||
template <typename WriteHandler, typename Stream>
|
||||
public:
|
||||
typedef typename remove_reference<
|
||||
Stream>::type::lowest_layer_type::executor_type executor_type;
|
||||
|
||||
explicit initiate_async_buffered_flush(Stream& next_layer)
|
||||
: next_layer_(next_layer)
|
||||
{
|
||||
}
|
||||
|
||||
executor_type get_executor() const ASIO_NOEXCEPT
|
||||
{
|
||||
return next_layer_.lowest_layer().get_executor();
|
||||
}
|
||||
|
||||
template <typename WriteHandler>
|
||||
void operator()(ASIO_MOVE_ARG(WriteHandler) handler,
|
||||
buffered_stream_storage* storage, Stream* next_layer) const
|
||||
buffered_stream_storage* storage) const
|
||||
{
|
||||
// If you get an error on the following line it means that your handler
|
||||
// does not meet the documented type requirements for a WriteHandler.
|
||||
ASIO_WRITE_HANDLER_CHECK(WriteHandler, handler) type_check;
|
||||
|
||||
non_const_lvalue<WriteHandler> handler2(handler);
|
||||
async_write(*next_layer, buffer(storage->data(), storage->size()),
|
||||
async_write(next_layer_, buffer(storage->data(), storage->size()),
|
||||
buffered_flush_handler<typename decay<WriteHandler>::type>(
|
||||
*storage, handler2.value));
|
||||
}
|
||||
|
||||
private:
|
||||
Stream& next_layer_;
|
||||
};
|
||||
} // namespace detail
|
||||
|
||||
@@ -174,16 +192,18 @@ struct associated_executor<
|
||||
#endif // !defined(GENERATING_DOCUMENTATION)
|
||||
|
||||
template <typename Stream>
|
||||
template <typename WriteHandler>
|
||||
ASIO_INITFN_RESULT_TYPE(WriteHandler,
|
||||
template <
|
||||
ASIO_COMPLETION_TOKEN_FOR(void (asio::error_code,
|
||||
std::size_t)) WriteHandler>
|
||||
ASIO_INITFN_AUTO_RESULT_TYPE(WriteHandler,
|
||||
void (asio::error_code, std::size_t))
|
||||
buffered_write_stream<Stream>::async_flush(
|
||||
ASIO_MOVE_ARG(WriteHandler) handler)
|
||||
{
|
||||
return async_initiate<WriteHandler,
|
||||
void (asio::error_code, std::size_t)>(
|
||||
detail::initiate_async_buffered_flush(),
|
||||
handler, &storage_, &next_layer_);
|
||||
detail::initiate_async_buffered_flush<Stream>(next_layer_),
|
||||
handler, &storage_);
|
||||
}
|
||||
|
||||
template <typename Stream>
|
||||
@@ -323,12 +343,26 @@ namespace detail
|
||||
function, this_handler->handler_);
|
||||
}
|
||||
|
||||
struct initiate_async_buffered_write_some
|
||||
template <typename Stream>
|
||||
class initiate_async_buffered_write_some
|
||||
{
|
||||
template <typename WriteHandler, typename Stream,
|
||||
typename ConstBufferSequence>
|
||||
public:
|
||||
typedef typename remove_reference<
|
||||
Stream>::type::lowest_layer_type::executor_type executor_type;
|
||||
|
||||
explicit initiate_async_buffered_write_some(Stream& next_layer)
|
||||
: next_layer_(next_layer)
|
||||
{
|
||||
}
|
||||
|
||||
executor_type get_executor() const ASIO_NOEXCEPT
|
||||
{
|
||||
return next_layer_.lowest_layer().get_executor();
|
||||
}
|
||||
|
||||
template <typename WriteHandler, typename ConstBufferSequence>
|
||||
void operator()(ASIO_MOVE_ARG(WriteHandler) handler,
|
||||
buffered_stream_storage* storage, Stream* next_layer,
|
||||
buffered_stream_storage* storage,
|
||||
const ConstBufferSequence& buffers) const
|
||||
{
|
||||
// If you get an error on the following line it means that your handler
|
||||
@@ -339,20 +373,23 @@ namespace detail
|
||||
non_const_lvalue<WriteHandler> handler2(handler);
|
||||
if (buffer_size(buffers) == 0 || storage->size() < storage->capacity())
|
||||
{
|
||||
next_layer->async_write_some(ASIO_CONST_BUFFER(0, 0),
|
||||
next_layer_.async_write_some(ASIO_CONST_BUFFER(0, 0),
|
||||
buffered_write_some_handler<ConstBufferSequence,
|
||||
typename decay<WriteHandler>::type>(
|
||||
*storage, buffers, handler2.value));
|
||||
}
|
||||
else
|
||||
{
|
||||
initiate_async_buffered_flush()(
|
||||
initiate_async_buffered_flush<Stream>(this->next_layer_)(
|
||||
buffered_write_some_handler<ConstBufferSequence,
|
||||
typename decay<WriteHandler>::type>(
|
||||
*storage, buffers, handler2.value),
|
||||
storage, next_layer);
|
||||
storage);
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
Stream& next_layer_;
|
||||
};
|
||||
} // namespace detail
|
||||
|
||||
@@ -395,8 +432,10 @@ struct associated_executor<
|
||||
#endif // !defined(GENERATING_DOCUMENTATION)
|
||||
|
||||
template <typename Stream>
|
||||
template <typename ConstBufferSequence, typename WriteHandler>
|
||||
ASIO_INITFN_RESULT_TYPE(WriteHandler,
|
||||
template <typename ConstBufferSequence,
|
||||
ASIO_COMPLETION_TOKEN_FOR(void (asio::error_code,
|
||||
std::size_t)) WriteHandler>
|
||||
ASIO_INITFN_AUTO_RESULT_TYPE(WriteHandler,
|
||||
void (asio::error_code, std::size_t))
|
||||
buffered_write_stream<Stream>::async_write_some(
|
||||
const ConstBufferSequence& buffers,
|
||||
@@ -404,8 +443,8 @@ buffered_write_stream<Stream>::async_write_some(
|
||||
{
|
||||
return async_initiate<WriteHandler,
|
||||
void (asio::error_code, std::size_t)>(
|
||||
detail::initiate_async_buffered_write_some(),
|
||||
handler, &storage_, &next_layer_, buffers);
|
||||
detail::initiate_async_buffered_write_some<Stream>(next_layer_),
|
||||
handler, &storage_, buffers);
|
||||
}
|
||||
|
||||
template <typename Stream>
|
||||
|
||||
@@ -89,25 +89,43 @@ awaitable<void, Executor> co_spawn_entry_point(
|
||||
});
|
||||
}
|
||||
|
||||
struct initiate_co_spawn
|
||||
template <typename Executor>
|
||||
class initiate_co_spawn
|
||||
{
|
||||
template <typename Handler, typename Executor, typename F>
|
||||
void operator()(Handler&& handler, const Executor& ex, F&& f) const
|
||||
public:
|
||||
typedef Executor executor_type;
|
||||
|
||||
template <typename OtherExecutor>
|
||||
explicit initiate_co_spawn(const OtherExecutor& ex)
|
||||
: ex_(ex)
|
||||
{
|
||||
}
|
||||
|
||||
executor_type get_executor() const ASIO_NOEXCEPT
|
||||
{
|
||||
return ex_;
|
||||
}
|
||||
|
||||
template <typename Handler, typename F>
|
||||
void operator()(Handler&& handler, F&& f) const
|
||||
{
|
||||
typedef typename result_of<F()>::type awaitable_type;
|
||||
typedef typename awaitable_type::executor_type executor_type;
|
||||
|
||||
executor_type ex2(ex);
|
||||
auto a = (co_spawn_entry_point)(static_cast<awaitable_type*>(nullptr),
|
||||
ex2, std::forward<F>(f), std::forward<Handler>(handler));
|
||||
awaitable_handler<executor_type, void>(std::move(a), ex2).launch();
|
||||
ex_, std::forward<F>(f), std::forward<Handler>(handler));
|
||||
awaitable_handler<executor_type, void>(std::move(a), ex_).launch();
|
||||
}
|
||||
|
||||
private:
|
||||
Executor ex_;
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
|
||||
template <typename Executor, typename F, typename CompletionToken>
|
||||
inline ASIO_INITFN_RESULT_TYPE(CompletionToken,
|
||||
template <typename Executor, typename F,
|
||||
ASIO_COMPLETION_TOKEN_FOR(typename detail::awaitable_signature<
|
||||
typename result_of<F()>::type>::type) CompletionToken>
|
||||
inline ASIO_INITFN_AUTO_RESULT_TYPE(CompletionToken,
|
||||
typename detail::awaitable_signature<typename result_of<F()>::type>::type)
|
||||
co_spawn(const Executor& ex, F&& f, CompletionToken&& token,
|
||||
typename enable_if<
|
||||
@@ -116,11 +134,15 @@ co_spawn(const Executor& ex, F&& f, CompletionToken&& token,
|
||||
{
|
||||
return async_initiate<CompletionToken,
|
||||
typename detail::awaitable_signature<typename result_of<F()>::type>>(
|
||||
detail::initiate_co_spawn(), token, ex, std::forward<F>(f));
|
||||
detail::initiate_co_spawn<
|
||||
typename result_of<F()>::type::executor_type>(ex),
|
||||
token, std::forward<F>(f));
|
||||
}
|
||||
|
||||
template <typename ExecutionContext, typename F, typename CompletionToken>
|
||||
inline ASIO_INITFN_RESULT_TYPE(CompletionToken,
|
||||
template <typename ExecutionContext, typename F,
|
||||
ASIO_COMPLETION_TOKEN_FOR(typename detail::awaitable_signature<
|
||||
typename result_of<F()>::type>::type) CompletionToken>
|
||||
inline ASIO_INITFN_AUTO_RESULT_TYPE(CompletionToken,
|
||||
typename detail::awaitable_signature<typename result_of<F()>::type>::type)
|
||||
co_spawn(ExecutionContext& ctx, F&& f, CompletionToken&& token,
|
||||
typename enable_if<
|
||||
|
||||
@@ -31,13 +31,123 @@ namespace asio {
|
||||
|
||||
namespace detail
|
||||
{
|
||||
template <typename>
|
||||
struct composed_io_executors;
|
||||
|
||||
template <>
|
||||
struct composed_io_executors<void()>
|
||||
{
|
||||
composed_io_executors() ASIO_NOEXCEPT
|
||||
: head_(system_executor())
|
||||
{
|
||||
}
|
||||
|
||||
typedef system_executor head_type;
|
||||
system_executor head_;
|
||||
};
|
||||
|
||||
inline composed_io_executors<void()> make_composed_io_executors()
|
||||
{
|
||||
return composed_io_executors<void()>();
|
||||
}
|
||||
|
||||
template <typename Head>
|
||||
struct composed_io_executors<void(Head)>
|
||||
{
|
||||
explicit composed_io_executors(const Head& ex) ASIO_NOEXCEPT
|
||||
: head_(ex)
|
||||
{
|
||||
}
|
||||
|
||||
typedef Head head_type;
|
||||
Head head_;
|
||||
};
|
||||
|
||||
template <typename Head>
|
||||
inline composed_io_executors<void(Head)>
|
||||
make_composed_io_executors(const Head& head)
|
||||
{
|
||||
return composed_io_executors<void(Head)>(head);
|
||||
}
|
||||
|
||||
#if defined(ASIO_HAS_VARIADIC_TEMPLATES)
|
||||
|
||||
template <typename Head, typename... Tail>
|
||||
struct composed_io_executors<void(Head, Tail...)>
|
||||
{
|
||||
explicit composed_io_executors(const Head& head,
|
||||
const Tail&... tail) ASIO_NOEXCEPT
|
||||
: head_(head),
|
||||
tail_(tail...)
|
||||
{
|
||||
}
|
||||
|
||||
void reset()
|
||||
{
|
||||
head_.reset();
|
||||
tail_.reset();
|
||||
}
|
||||
|
||||
typedef Head head_type;
|
||||
Head head_;
|
||||
composed_io_executors<void(Tail...)> tail_;
|
||||
};
|
||||
|
||||
template <typename Head, typename... Tail>
|
||||
inline composed_io_executors<void(Head, Tail...)>
|
||||
make_composed_io_executors(const Head& head, const Tail&... tail)
|
||||
{
|
||||
return composed_io_executors<void(Head, Tail...)>(head, tail...);
|
||||
}
|
||||
|
||||
#else // defined(ASIO_HAS_VARIADIC_TEMPLATES)
|
||||
|
||||
#define ASIO_PRIVATE_COMPOSED_IO_EXECUTORS_DEF(n) \
|
||||
template <typename Head, ASIO_VARIADIC_TPARAMS(n)> \
|
||||
struct composed_io_executors<void(Head, ASIO_VARIADIC_TARGS(n))> \
|
||||
{ \
|
||||
explicit composed_io_executors(const Head& head, \
|
||||
ASIO_VARIADIC_CONSTREF_PARAMS(n)) ASIO_NOEXCEPT \
|
||||
: head_(head), \
|
||||
tail_(ASIO_VARIADIC_BYVAL_ARGS(n)) \
|
||||
{ \
|
||||
} \
|
||||
\
|
||||
void reset() \
|
||||
{ \
|
||||
head_.reset(); \
|
||||
tail_.reset(); \
|
||||
} \
|
||||
\
|
||||
typedef Head head_type; \
|
||||
Head head_; \
|
||||
composed_io_executors<void(ASIO_VARIADIC_TARGS(n))> tail_; \
|
||||
}; \
|
||||
\
|
||||
template <typename Head, ASIO_VARIADIC_TPARAMS(n)> \
|
||||
inline composed_io_executors<void(Head, ASIO_VARIADIC_TARGS(n))> \
|
||||
make_composed_io_executors(const Head& head, \
|
||||
ASIO_VARIADIC_CONSTREF_PARAMS(n)) \
|
||||
{ \
|
||||
return composed_io_executors< \
|
||||
void(Head, ASIO_VARIADIC_TARGS(n))>( \
|
||||
head, ASIO_VARIADIC_BYVAL_ARGS(n)); \
|
||||
} \
|
||||
/**/
|
||||
ASIO_VARIADIC_GENERATE(ASIO_PRIVATE_COMPOSED_IO_EXECUTORS_DEF)
|
||||
#undef ASIO_PRIVATE_COMPOSED_IO_EXECUTORS_DEF
|
||||
|
||||
#endif // defined(ASIO_HAS_VARIADIC_TEMPLATES)
|
||||
|
||||
template <typename>
|
||||
struct composed_work;
|
||||
|
||||
template <>
|
||||
struct composed_work<void()>
|
||||
{
|
||||
composed_work() ASIO_NOEXCEPT
|
||||
typedef composed_io_executors<void()> executors_type;
|
||||
|
||||
composed_work(const executors_type&) ASIO_NOEXCEPT
|
||||
: head_(system_executor())
|
||||
{
|
||||
}
|
||||
@@ -51,16 +161,13 @@ namespace detail
|
||||
executor_work_guard<system_executor> head_;
|
||||
};
|
||||
|
||||
inline composed_work<void()> make_composed_work()
|
||||
{
|
||||
return composed_work<void()>();
|
||||
}
|
||||
|
||||
template <typename Head>
|
||||
struct composed_work<void(Head)>
|
||||
{
|
||||
explicit composed_work(const Head& ex) ASIO_NOEXCEPT
|
||||
: head_(ex)
|
||||
typedef composed_io_executors<void(Head)> executors_type;
|
||||
|
||||
explicit composed_work(const executors_type& ex) ASIO_NOEXCEPT
|
||||
: head_(ex.head_)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -73,21 +180,16 @@ namespace detail
|
||||
executor_work_guard<Head> head_;
|
||||
};
|
||||
|
||||
template <typename Head>
|
||||
inline composed_work<void(Head)> make_composed_work(const Head& head)
|
||||
{
|
||||
return composed_work<void(Head)>(head);
|
||||
}
|
||||
|
||||
#if defined(ASIO_HAS_VARIADIC_TEMPLATES)
|
||||
|
||||
template <typename Head, typename... Tail>
|
||||
struct composed_work<void(Head, Tail...)>
|
||||
{
|
||||
explicit composed_work(const Head& head,
|
||||
const Tail&... tail) ASIO_NOEXCEPT
|
||||
: head_(head),
|
||||
tail_(tail...)
|
||||
typedef composed_io_executors<void(Head, Tail...)> executors_type;
|
||||
|
||||
explicit composed_work(const executors_type& ex) ASIO_NOEXCEPT
|
||||
: head_(ex.head_),
|
||||
tail_(ex.tail_)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -102,23 +204,18 @@ namespace detail
|
||||
composed_work<void(Tail...)> tail_;
|
||||
};
|
||||
|
||||
template <typename Head, typename... Tail>
|
||||
inline composed_work<void(Head, Tail...)>
|
||||
make_composed_work(const Head& head, const Tail&... tail)
|
||||
{
|
||||
return composed_work<void(Head, Tail...)>(head, tail...);
|
||||
}
|
||||
|
||||
#else // defined(ASIO_HAS_VARIADIC_TEMPLATES)
|
||||
|
||||
#define ASIO_PRIVATE_COMPOSED_WORK_DEF(n) \
|
||||
template <typename Head, ASIO_VARIADIC_TPARAMS(n)> \
|
||||
struct composed_work<void(Head, ASIO_VARIADIC_TARGS(n))> \
|
||||
{ \
|
||||
explicit composed_work(const Head& head, \
|
||||
ASIO_VARIADIC_CONSTREF_PARAMS(n)) ASIO_NOEXCEPT \
|
||||
: head_(head), \
|
||||
tail_(ASIO_VARIADIC_BYVAL_ARGS(n)) \
|
||||
typedef composed_io_executors<void(Head, \
|
||||
ASIO_VARIADIC_TARGS(n))> executors_type; \
|
||||
\
|
||||
explicit composed_work(const executors_type& ex) ASIO_NOEXCEPT \
|
||||
: head_(ex.head_), \
|
||||
tail_(ex.tail_) \
|
||||
{ \
|
||||
} \
|
||||
\
|
||||
@@ -132,15 +229,6 @@ namespace detail
|
||||
executor_work_guard<Head> head_; \
|
||||
composed_work<void(ASIO_VARIADIC_TARGS(n))> tail_; \
|
||||
}; \
|
||||
\
|
||||
template <typename Head, ASIO_VARIADIC_TPARAMS(n)> \
|
||||
inline composed_work<void(Head, ASIO_VARIADIC_TARGS(n))> \
|
||||
make_composed_work(const Head& head, ASIO_VARIADIC_CONSTREF_PARAMS(n)) \
|
||||
{ \
|
||||
return composed_work< \
|
||||
void(Head, ASIO_VARIADIC_TARGS(n))>( \
|
||||
head, ASIO_VARIADIC_BYVAL_ARGS(n)); \
|
||||
} \
|
||||
/**/
|
||||
ASIO_VARIADIC_GENERATE(ASIO_PRIVATE_COMPOSED_WORK_DEF)
|
||||
#undef ASIO_PRIVATE_COMPOSED_WORK_DEF
|
||||
@@ -298,21 +386,46 @@ namespace detail
|
||||
function, this_handler->handler_);
|
||||
}
|
||||
|
||||
template <typename Signature>
|
||||
struct initiate_composed_op
|
||||
template <typename Signature, typename Executors>
|
||||
class initiate_composed_op
|
||||
{
|
||||
template <typename Handler, typename Impl, typename Work>
|
||||
void operator()(ASIO_MOVE_ARG(Handler) handler,
|
||||
ASIO_MOVE_ARG(Impl) impl,
|
||||
ASIO_MOVE_ARG(Work) work) const
|
||||
public:
|
||||
typedef typename composed_io_executors<Executors>::head_type executor_type;
|
||||
|
||||
template <typename T>
|
||||
explicit initiate_composed_op(ASIO_MOVE_ARG(T) executors)
|
||||
: executors_(ASIO_MOVE_CAST(T)(executors))
|
||||
{
|
||||
composed_op<typename decay<Impl>::type, typename decay<Work>::type,
|
||||
}
|
||||
|
||||
executor_type get_executor() const ASIO_NOEXCEPT
|
||||
{
|
||||
return executors_.head_;
|
||||
}
|
||||
|
||||
template <typename Handler, typename Impl>
|
||||
void operator()(ASIO_MOVE_ARG(Handler) handler,
|
||||
ASIO_MOVE_ARG(Impl) impl) const
|
||||
{
|
||||
composed_op<typename decay<Impl>::type, composed_work<Executors>,
|
||||
typename decay<Handler>::type, Signature>(
|
||||
ASIO_MOVE_CAST(Impl)(impl), ASIO_MOVE_CAST(Work)(work),
|
||||
ASIO_MOVE_CAST(Impl)(impl),
|
||||
composed_work<Executors>(executors_),
|
||||
ASIO_MOVE_CAST(Handler)(handler))();
|
||||
}
|
||||
|
||||
private:
|
||||
composed_io_executors<Executors> executors_;
|
||||
};
|
||||
|
||||
template <typename Signature, typename Executors>
|
||||
inline initiate_composed_op<Signature, Executors> make_initiate_composed_op(
|
||||
ASIO_MOVE_ARG(composed_io_executors<Executors>) executors)
|
||||
{
|
||||
return initiate_composed_op<Signature, Executors>(
|
||||
ASIO_MOVE_CAST(composed_io_executors<Executors>)(executors));
|
||||
}
|
||||
|
||||
template <typename IoObject>
|
||||
inline typename IoObject::executor_type
|
||||
get_composed_io_executor(IoObject& io_object)
|
||||
@@ -333,31 +446,31 @@ namespace detail
|
||||
|
||||
template <typename CompletionToken, typename Signature,
|
||||
typename Implementation, typename... IoObjectsOrExecutors>
|
||||
ASIO_INITFN_RESULT_TYPE(CompletionToken, Signature)
|
||||
ASIO_INITFN_AUTO_RESULT_TYPE(CompletionToken, Signature)
|
||||
async_compose(ASIO_MOVE_ARG(Implementation) implementation,
|
||||
ASIO_NONDEDUCED_MOVE_ARG(CompletionToken) token,
|
||||
ASIO_MOVE_ARG(IoObjectsOrExecutors)... io_objects_or_executors)
|
||||
{
|
||||
return async_initiate<CompletionToken, Signature>(
|
||||
detail::initiate_composed_op<Signature>(), token,
|
||||
ASIO_MOVE_CAST(Implementation)(implementation),
|
||||
detail::make_composed_work(
|
||||
detail::get_composed_io_executor(
|
||||
ASIO_MOVE_CAST(IoObjectsOrExecutors)(
|
||||
io_objects_or_executors))...));
|
||||
detail::make_initiate_composed_op<Signature>(
|
||||
detail::make_composed_io_executors(
|
||||
detail::get_composed_io_executor(
|
||||
ASIO_MOVE_CAST(IoObjectsOrExecutors)(
|
||||
io_objects_or_executors))...)),
|
||||
token, ASIO_MOVE_CAST(Implementation)(implementation));
|
||||
}
|
||||
|
||||
#else // defined(ASIO_HAS_VARIADIC_TEMPLATES)
|
||||
|
||||
template <typename CompletionToken, typename Signature, typename Implementation>
|
||||
ASIO_INITFN_RESULT_TYPE(CompletionToken, Signature)
|
||||
ASIO_INITFN_AUTO_RESULT_TYPE(CompletionToken, Signature)
|
||||
async_compose(ASIO_MOVE_ARG(Implementation) implementation,
|
||||
ASIO_NONDEDUCED_MOVE_ARG(CompletionToken) token)
|
||||
{
|
||||
return async_initiate<CompletionToken, Signature>(
|
||||
detail::initiate_composed_op<Signature>(), token,
|
||||
ASIO_MOVE_CAST(Implementation)(implementation),
|
||||
detail::make_composed_work());
|
||||
detail::make_initiate_composed_op<Signature>(
|
||||
detail::make_composed_io_executors()),
|
||||
token, ASIO_MOVE_CAST(Implementation)(implementation));
|
||||
}
|
||||
|
||||
# define ASIO_PRIVATE_GET_COMPOSED_IO_EXECUTOR(n) \
|
||||
@@ -387,16 +500,16 @@ async_compose(ASIO_MOVE_ARG(Implementation) implementation,
|
||||
#define ASIO_PRIVATE_ASYNC_COMPOSE_DEF(n) \
|
||||
template <typename CompletionToken, typename Signature, \
|
||||
typename Implementation, ASIO_VARIADIC_TPARAMS(n)> \
|
||||
ASIO_INITFN_RESULT_TYPE(CompletionToken, Signature) \
|
||||
ASIO_INITFN_AUTO_RESULT_TYPE(CompletionToken, Signature) \
|
||||
async_compose(ASIO_MOVE_ARG(Implementation) implementation, \
|
||||
ASIO_NONDEDUCED_MOVE_ARG(CompletionToken) token, \
|
||||
ASIO_VARIADIC_MOVE_PARAMS(n)) \
|
||||
{ \
|
||||
return async_initiate<CompletionToken, Signature>( \
|
||||
detail::initiate_composed_op<Signature>(), token, \
|
||||
ASIO_MOVE_CAST(Implementation)(implementation), \
|
||||
detail::make_composed_work( \
|
||||
ASIO_PRIVATE_GET_COMPOSED_IO_EXECUTOR(n))); \
|
||||
detail::make_initiate_composed_op<Signature>( \
|
||||
detail::make_composed_io_executors( \
|
||||
ASIO_PRIVATE_GET_COMPOSED_IO_EXECUTOR(n))), \
|
||||
token, ASIO_MOVE_CAST(Implementation)(implementation)); \
|
||||
} \
|
||||
/**/
|
||||
ASIO_VARIADIC_GENERATE(ASIO_PRIVATE_ASYNC_COMPOSE_DEF)
|
||||
|
||||
@@ -371,7 +371,7 @@ namespace detail
|
||||
return;
|
||||
}
|
||||
|
||||
default:
|
||||
/* fall-through */ default:
|
||||
|
||||
if (iter == end)
|
||||
break;
|
||||
@@ -454,12 +454,26 @@ namespace detail
|
||||
function, this_handler->handler_);
|
||||
}
|
||||
|
||||
struct initiate_async_range_connect
|
||||
template <typename Protocol, typename Executor>
|
||||
class initiate_async_range_connect
|
||||
{
|
||||
template <typename RangeConnectHandler, typename Protocol,
|
||||
typename Executor, typename EndpointSequence, typename ConnectCondition>
|
||||
public:
|
||||
typedef Executor executor_type;
|
||||
|
||||
explicit initiate_async_range_connect(basic_socket<Protocol, Executor>& s)
|
||||
: socket_(s)
|
||||
{
|
||||
}
|
||||
|
||||
executor_type get_executor() const ASIO_NOEXCEPT
|
||||
{
|
||||
return socket_.get_executor();
|
||||
}
|
||||
|
||||
template <typename RangeConnectHandler,
|
||||
typename EndpointSequence, typename ConnectCondition>
|
||||
void operator()(ASIO_MOVE_ARG(RangeConnectHandler) handler,
|
||||
basic_socket<Protocol, Executor>* s, const EndpointSequence& endpoints,
|
||||
const EndpointSequence& endpoints,
|
||||
const ConnectCondition& connect_condition) const
|
||||
{
|
||||
// If you get an error on the following line it means that your
|
||||
@@ -470,9 +484,12 @@ namespace detail
|
||||
|
||||
non_const_lvalue<RangeConnectHandler> handler2(handler);
|
||||
range_connect_op<Protocol, Executor, EndpointSequence, ConnectCondition,
|
||||
typename decay<RangeConnectHandler>::type>(*s, endpoints,
|
||||
typename decay<RangeConnectHandler>::type>(socket_, endpoints,
|
||||
connect_condition, handler2.value)(asio::error_code(), 1);
|
||||
}
|
||||
|
||||
private:
|
||||
basic_socket<Protocol, Executor>& socket_;
|
||||
};
|
||||
|
||||
template <typename Protocol, typename Executor, typename Iterator,
|
||||
@@ -541,7 +558,7 @@ namespace detail
|
||||
return;
|
||||
}
|
||||
|
||||
default:
|
||||
/* fall-through */ default:
|
||||
|
||||
if (iter_ == end_)
|
||||
break;
|
||||
@@ -623,13 +640,28 @@ namespace detail
|
||||
function, this_handler->handler_);
|
||||
}
|
||||
|
||||
struct initiate_async_iterator_connect
|
||||
template <typename Protocol, typename Executor>
|
||||
class initiate_async_iterator_connect
|
||||
{
|
||||
template <typename IteratorConnectHandler, typename Protocol,
|
||||
typename Executor, typename Iterator, typename ConnectCondition>
|
||||
public:
|
||||
typedef Executor executor_type;
|
||||
|
||||
explicit initiate_async_iterator_connect(
|
||||
basic_socket<Protocol, Executor>& s)
|
||||
: socket_(s)
|
||||
{
|
||||
}
|
||||
|
||||
executor_type get_executor() const ASIO_NOEXCEPT
|
||||
{
|
||||
return socket_.get_executor();
|
||||
}
|
||||
|
||||
template <typename IteratorConnectHandler,
|
||||
typename Iterator, typename ConnectCondition>
|
||||
void operator()(ASIO_MOVE_ARG(IteratorConnectHandler) handler,
|
||||
basic_socket<Protocol, Executor>* s, Iterator begin,
|
||||
Iterator end, const ConnectCondition& connect_condition) const
|
||||
Iterator begin, Iterator end,
|
||||
const ConnectCondition& connect_condition) const
|
||||
{
|
||||
// If you get an error on the following line it means that your
|
||||
// handler does not meet the documented type requirements for an
|
||||
@@ -639,9 +671,12 @@ namespace detail
|
||||
|
||||
non_const_lvalue<IteratorConnectHandler> handler2(handler);
|
||||
iterator_connect_op<Protocol, Executor, Iterator, ConnectCondition,
|
||||
typename decay<IteratorConnectHandler>::type>(*s, begin, end,
|
||||
typename decay<IteratorConnectHandler>::type>(socket_, begin, end,
|
||||
connect_condition, handler2.value)(asio::error_code(), 1);
|
||||
}
|
||||
|
||||
private:
|
||||
basic_socket<Protocol, Executor>& socket_;
|
||||
};
|
||||
} // namespace detail
|
||||
|
||||
@@ -729,9 +764,10 @@ struct associated_executor<
|
||||
|
||||
#endif // !defined(GENERATING_DOCUMENTATION)
|
||||
|
||||
template <typename Protocol, typename Executor,
|
||||
typename EndpointSequence, typename RangeConnectHandler>
|
||||
inline ASIO_INITFN_RESULT_TYPE(RangeConnectHandler,
|
||||
template <typename Protocol, typename Executor, typename EndpointSequence,
|
||||
ASIO_COMPLETION_TOKEN_FOR(void (asio::error_code,
|
||||
typename Protocol::endpoint)) RangeConnectHandler>
|
||||
inline ASIO_INITFN_AUTO_RESULT_TYPE(RangeConnectHandler,
|
||||
void (asio::error_code, typename Protocol::endpoint))
|
||||
async_connect(basic_socket<Protocol, Executor>& s,
|
||||
const EndpointSequence& endpoints,
|
||||
@@ -741,14 +777,15 @@ async_connect(basic_socket<Protocol, Executor>& s,
|
||||
{
|
||||
return async_initiate<RangeConnectHandler,
|
||||
void (asio::error_code, typename Protocol::endpoint)>(
|
||||
detail::initiate_async_range_connect(), handler,
|
||||
&s, endpoints, detail::default_connect_condition());
|
||||
detail::initiate_async_range_connect<Protocol, Executor>(s),
|
||||
handler, endpoints, detail::default_connect_condition());
|
||||
}
|
||||
|
||||
#if !defined(ASIO_NO_DEPRECATED)
|
||||
template <typename Protocol, typename Executor,
|
||||
typename Iterator, typename IteratorConnectHandler>
|
||||
inline ASIO_INITFN_RESULT_TYPE(IteratorConnectHandler,
|
||||
template <typename Protocol, typename Executor, typename Iterator,
|
||||
ASIO_COMPLETION_TOKEN_FOR(void (asio::error_code,
|
||||
Iterator)) IteratorConnectHandler>
|
||||
inline ASIO_INITFN_AUTO_RESULT_TYPE(IteratorConnectHandler,
|
||||
void (asio::error_code, Iterator))
|
||||
async_connect(basic_socket<Protocol, Executor>& s, Iterator begin,
|
||||
ASIO_MOVE_ARG(IteratorConnectHandler) handler,
|
||||
@@ -756,27 +793,30 @@ async_connect(basic_socket<Protocol, Executor>& s, Iterator begin,
|
||||
{
|
||||
return async_initiate<IteratorConnectHandler,
|
||||
void (asio::error_code, Iterator)>(
|
||||
detail::initiate_async_iterator_connect(), handler,
|
||||
&s, begin, Iterator(), detail::default_connect_condition());
|
||||
detail::initiate_async_iterator_connect<Protocol, Executor>(s),
|
||||
handler, begin, Iterator(), detail::default_connect_condition());
|
||||
}
|
||||
#endif // !defined(ASIO_NO_DEPRECATED)
|
||||
|
||||
template <typename Protocol, typename Executor,
|
||||
typename Iterator, typename IteratorConnectHandler>
|
||||
inline ASIO_INITFN_RESULT_TYPE(IteratorConnectHandler,
|
||||
template <typename Protocol, typename Executor, typename Iterator,
|
||||
ASIO_COMPLETION_TOKEN_FOR(void (asio::error_code,
|
||||
Iterator)) IteratorConnectHandler>
|
||||
inline ASIO_INITFN_AUTO_RESULT_TYPE(IteratorConnectHandler,
|
||||
void (asio::error_code, Iterator))
|
||||
async_connect(basic_socket<Protocol, Executor>& s, Iterator begin, Iterator end,
|
||||
ASIO_MOVE_ARG(IteratorConnectHandler) handler)
|
||||
{
|
||||
return async_initiate<IteratorConnectHandler,
|
||||
void (asio::error_code, Iterator)>(
|
||||
detail::initiate_async_iterator_connect(), handler,
|
||||
&s, begin, end, detail::default_connect_condition());
|
||||
detail::initiate_async_iterator_connect<Protocol, Executor>(s),
|
||||
handler, begin, end, detail::default_connect_condition());
|
||||
}
|
||||
|
||||
template <typename Protocol, typename Executor, typename EndpointSequence,
|
||||
typename ConnectCondition, typename RangeConnectHandler>
|
||||
inline ASIO_INITFN_RESULT_TYPE(RangeConnectHandler,
|
||||
template <typename Protocol, typename Executor,
|
||||
typename EndpointSequence, typename ConnectCondition,
|
||||
ASIO_COMPLETION_TOKEN_FOR(void (asio::error_code,
|
||||
typename Protocol::endpoint)) RangeConnectHandler>
|
||||
inline ASIO_INITFN_AUTO_RESULT_TYPE(RangeConnectHandler,
|
||||
void (asio::error_code, typename Protocol::endpoint))
|
||||
async_connect(basic_socket<Protocol, Executor>& s,
|
||||
const EndpointSequence& endpoints, ConnectCondition connect_condition,
|
||||
@@ -786,14 +826,16 @@ async_connect(basic_socket<Protocol, Executor>& s,
|
||||
{
|
||||
return async_initiate<RangeConnectHandler,
|
||||
void (asio::error_code, typename Protocol::endpoint)>(
|
||||
detail::initiate_async_range_connect(),
|
||||
handler, &s, endpoints, connect_condition);
|
||||
detail::initiate_async_range_connect<Protocol, Executor>(s),
|
||||
handler, endpoints, connect_condition);
|
||||
}
|
||||
|
||||
#if !defined(ASIO_NO_DEPRECATED)
|
||||
template <typename Protocol, typename Executor, typename Iterator,
|
||||
typename ConnectCondition, typename IteratorConnectHandler>
|
||||
inline ASIO_INITFN_RESULT_TYPE(IteratorConnectHandler,
|
||||
template <typename Protocol, typename Executor,
|
||||
typename Iterator, typename ConnectCondition,
|
||||
ASIO_COMPLETION_TOKEN_FOR(void (asio::error_code,
|
||||
Iterator)) IteratorConnectHandler>
|
||||
inline ASIO_INITFN_AUTO_RESULT_TYPE(IteratorConnectHandler,
|
||||
void (asio::error_code, Iterator))
|
||||
async_connect(basic_socket<Protocol, Executor>& s, Iterator begin,
|
||||
ConnectCondition connect_condition,
|
||||
@@ -802,14 +844,16 @@ async_connect(basic_socket<Protocol, Executor>& s, Iterator begin,
|
||||
{
|
||||
return async_initiate<IteratorConnectHandler,
|
||||
void (asio::error_code, Iterator)>(
|
||||
detail::initiate_async_iterator_connect(),
|
||||
handler, &s, begin, Iterator(), connect_condition);
|
||||
detail::initiate_async_iterator_connect<Protocol, Executor>(s),
|
||||
handler, begin, Iterator(), connect_condition);
|
||||
}
|
||||
#endif // !defined(ASIO_NO_DEPRECATED)
|
||||
|
||||
template <typename Protocol, typename Executor, typename Iterator,
|
||||
typename ConnectCondition, typename IteratorConnectHandler>
|
||||
inline ASIO_INITFN_RESULT_TYPE(IteratorConnectHandler,
|
||||
template <typename Protocol, typename Executor,
|
||||
typename Iterator, typename ConnectCondition,
|
||||
ASIO_COMPLETION_TOKEN_FOR(void (asio::error_code,
|
||||
Iterator)) IteratorConnectHandler>
|
||||
inline ASIO_INITFN_AUTO_RESULT_TYPE(IteratorConnectHandler,
|
||||
void (asio::error_code, Iterator))
|
||||
async_connect(basic_socket<Protocol, Executor>& s, Iterator begin,
|
||||
Iterator end, ConnectCondition connect_condition,
|
||||
@@ -817,8 +861,8 @@ async_connect(basic_socket<Protocol, Executor>& s, Iterator begin,
|
||||
{
|
||||
return async_initiate<IteratorConnectHandler,
|
||||
void (asio::error_code, Iterator)>(
|
||||
detail::initiate_async_iterator_connect(),
|
||||
handler, &s, begin, end, connect_condition);
|
||||
detail::initiate_async_iterator_connect<Protocol, Executor>(s),
|
||||
handler, begin, end, connect_condition);
|
||||
}
|
||||
|
||||
} // namespace asio
|
||||
|
||||
@@ -25,8 +25,9 @@
|
||||
namespace asio {
|
||||
namespace detail {
|
||||
|
||||
struct initiate_defer
|
||||
class initiate_defer
|
||||
{
|
||||
public:
|
||||
template <typename CompletionHandler>
|
||||
void operator()(ASIO_MOVE_ARG(CompletionHandler) handler) const
|
||||
{
|
||||
@@ -40,42 +41,63 @@ struct initiate_defer
|
||||
|
||||
ex.defer(ASIO_MOVE_CAST(CompletionHandler)(handler), alloc);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename CompletionHandler, typename Executor>
|
||||
void operator()(ASIO_MOVE_ARG(CompletionHandler) handler,
|
||||
ASIO_MOVE_ARG(Executor) ex) const
|
||||
template <typename Executor>
|
||||
class initiate_defer_with_executor
|
||||
{
|
||||
public:
|
||||
typedef Executor executor_type;
|
||||
|
||||
explicit initiate_defer_with_executor(const Executor& ex)
|
||||
: ex_(ex)
|
||||
{
|
||||
}
|
||||
|
||||
executor_type get_executor() const ASIO_NOEXCEPT
|
||||
{
|
||||
return ex_;
|
||||
}
|
||||
|
||||
template <typename CompletionHandler>
|
||||
void operator()(ASIO_MOVE_ARG(CompletionHandler) handler) const
|
||||
{
|
||||
typedef typename decay<CompletionHandler>::type DecayedHandler;
|
||||
|
||||
typename associated_allocator<DecayedHandler>::type alloc(
|
||||
(get_associated_allocator)(handler));
|
||||
|
||||
ex.defer(detail::work_dispatcher<DecayedHandler>(
|
||||
ex_.defer(detail::work_dispatcher<DecayedHandler>(
|
||||
ASIO_MOVE_CAST(CompletionHandler)(handler)), alloc);
|
||||
}
|
||||
|
||||
private:
|
||||
Executor ex_;
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
|
||||
template <typename CompletionToken>
|
||||
ASIO_INITFN_RESULT_TYPE(CompletionToken, void()) defer(
|
||||
template <ASIO_COMPLETION_TOKEN_FOR(void()) CompletionToken>
|
||||
ASIO_INITFN_AUTO_RESULT_TYPE(CompletionToken, void()) defer(
|
||||
ASIO_MOVE_ARG(CompletionToken) token)
|
||||
{
|
||||
return async_initiate<CompletionToken, void()>(
|
||||
detail::initiate_defer(), token);
|
||||
}
|
||||
|
||||
template <typename Executor, typename CompletionToken>
|
||||
ASIO_INITFN_RESULT_TYPE(CompletionToken, void()) defer(
|
||||
template <typename Executor,
|
||||
ASIO_COMPLETION_TOKEN_FOR(void()) CompletionToken>
|
||||
ASIO_INITFN_AUTO_RESULT_TYPE(CompletionToken, void()) defer(
|
||||
const Executor& ex, ASIO_MOVE_ARG(CompletionToken) token,
|
||||
typename enable_if<is_executor<Executor>::value>::type*)
|
||||
{
|
||||
return async_initiate<CompletionToken, void()>(
|
||||
detail::initiate_defer(), token, ex);
|
||||
detail::initiate_defer_with_executor<Executor>(ex), token);
|
||||
}
|
||||
|
||||
template <typename ExecutionContext, typename CompletionToken>
|
||||
inline ASIO_INITFN_RESULT_TYPE(CompletionToken, void()) defer(
|
||||
template <typename ExecutionContext,
|
||||
ASIO_COMPLETION_TOKEN_FOR(void()) CompletionToken>
|
||||
inline ASIO_INITFN_AUTO_RESULT_TYPE(CompletionToken, void()) defer(
|
||||
ExecutionContext& ctx, ASIO_MOVE_ARG(CompletionToken) token,
|
||||
typename enable_if<is_convertible<
|
||||
ExecutionContext&, execution_context&>::value>::type*)
|
||||
|
||||
@@ -25,8 +25,9 @@
|
||||
namespace asio {
|
||||
namespace detail {
|
||||
|
||||
struct initiate_dispatch
|
||||
class initiate_dispatch
|
||||
{
|
||||
public:
|
||||
template <typename CompletionHandler>
|
||||
void operator()(ASIO_MOVE_ARG(CompletionHandler) handler) const
|
||||
{
|
||||
@@ -40,42 +41,63 @@ struct initiate_dispatch
|
||||
|
||||
ex.dispatch(ASIO_MOVE_CAST(CompletionHandler)(handler), alloc);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename CompletionHandler, typename Executor>
|
||||
void operator()(ASIO_MOVE_ARG(CompletionHandler) handler,
|
||||
ASIO_MOVE_ARG(Executor) ex) const
|
||||
template <typename Executor>
|
||||
class initiate_dispatch_with_executor
|
||||
{
|
||||
public:
|
||||
typedef Executor executor_type;
|
||||
|
||||
explicit initiate_dispatch_with_executor(const Executor& ex)
|
||||
: ex_(ex)
|
||||
{
|
||||
}
|
||||
|
||||
executor_type get_executor() const ASIO_NOEXCEPT
|
||||
{
|
||||
return ex_;
|
||||
}
|
||||
|
||||
template <typename CompletionHandler>
|
||||
void operator()(ASIO_MOVE_ARG(CompletionHandler) handler) const
|
||||
{
|
||||
typedef typename decay<CompletionHandler>::type DecayedHandler;
|
||||
|
||||
typename associated_allocator<DecayedHandler>::type alloc(
|
||||
(get_associated_allocator)(handler));
|
||||
|
||||
ex.dispatch(detail::work_dispatcher<DecayedHandler>(
|
||||
ex_.dispatch(detail::work_dispatcher<DecayedHandler>(
|
||||
ASIO_MOVE_CAST(CompletionHandler)(handler)), alloc);
|
||||
}
|
||||
|
||||
private:
|
||||
Executor ex_;
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
|
||||
template <typename CompletionToken>
|
||||
ASIO_INITFN_RESULT_TYPE(CompletionToken, void()) dispatch(
|
||||
template <ASIO_COMPLETION_TOKEN_FOR(void()) CompletionToken>
|
||||
ASIO_INITFN_AUTO_RESULT_TYPE(CompletionToken, void()) dispatch(
|
||||
ASIO_MOVE_ARG(CompletionToken) token)
|
||||
{
|
||||
return async_initiate<CompletionToken, void()>(
|
||||
detail::initiate_dispatch(), token);
|
||||
}
|
||||
|
||||
template <typename Executor, typename CompletionToken>
|
||||
ASIO_INITFN_RESULT_TYPE(CompletionToken, void()) dispatch(
|
||||
template <typename Executor,
|
||||
ASIO_COMPLETION_TOKEN_FOR(void()) CompletionToken>
|
||||
ASIO_INITFN_AUTO_RESULT_TYPE(CompletionToken, void()) dispatch(
|
||||
const Executor& ex, ASIO_MOVE_ARG(CompletionToken) token,
|
||||
typename enable_if<is_executor<Executor>::value>::type*)
|
||||
{
|
||||
return async_initiate<CompletionToken, void()>(
|
||||
detail::initiate_dispatch(), token, ex);
|
||||
detail::initiate_dispatch_with_executor<Executor>(ex), token);
|
||||
}
|
||||
|
||||
template <typename ExecutionContext, typename CompletionToken>
|
||||
inline ASIO_INITFN_RESULT_TYPE(CompletionToken, void()) dispatch(
|
||||
template <typename ExecutionContext,
|
||||
ASIO_COMPLETION_TOKEN_FOR(void()) CompletionToken>
|
||||
inline ASIO_INITFN_AUTO_RESULT_TYPE(CompletionToken, void()) dispatch(
|
||||
ExecutionContext& ctx, ASIO_MOVE_ARG(CompletionToken) token,
|
||||
typename enable_if<is_convertible<
|
||||
ExecutionContext&, execution_context&>::value>::type*)
|
||||
|
||||
@@ -169,7 +169,7 @@ struct io_context::initiate_dispatch
|
||||
};
|
||||
|
||||
template <typename LegacyCompletionHandler>
|
||||
ASIO_INITFN_RESULT_TYPE(LegacyCompletionHandler, void ())
|
||||
ASIO_INITFN_AUTO_RESULT_TYPE(LegacyCompletionHandler, void ())
|
||||
io_context::dispatch(ASIO_MOVE_ARG(LegacyCompletionHandler) handler)
|
||||
{
|
||||
return async_initiate<LegacyCompletionHandler, void ()>(
|
||||
@@ -208,7 +208,7 @@ struct io_context::initiate_post
|
||||
};
|
||||
|
||||
template <typename LegacyCompletionHandler>
|
||||
ASIO_INITFN_RESULT_TYPE(LegacyCompletionHandler, void ())
|
||||
ASIO_INITFN_AUTO_RESULT_TYPE(LegacyCompletionHandler, void ())
|
||||
io_context::post(ASIO_MOVE_ARG(LegacyCompletionHandler) handler)
|
||||
{
|
||||
return async_initiate<LegacyCompletionHandler, void ()>(
|
||||
|
||||
@@ -25,8 +25,9 @@
|
||||
namespace asio {
|
||||
namespace detail {
|
||||
|
||||
struct initiate_post
|
||||
class initiate_post
|
||||
{
|
||||
public:
|
||||
template <typename CompletionHandler>
|
||||
void operator()(ASIO_MOVE_ARG(CompletionHandler) handler) const
|
||||
{
|
||||
@@ -40,42 +41,63 @@ struct initiate_post
|
||||
|
||||
ex.post(ASIO_MOVE_CAST(CompletionHandler)(handler), alloc);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename CompletionHandler, typename Executor>
|
||||
void operator()(ASIO_MOVE_ARG(CompletionHandler) handler,
|
||||
ASIO_MOVE_ARG(Executor) ex) const
|
||||
template <typename Executor>
|
||||
class initiate_post_with_executor
|
||||
{
|
||||
public:
|
||||
typedef Executor executor_type;
|
||||
|
||||
explicit initiate_post_with_executor(const Executor& ex)
|
||||
: ex_(ex)
|
||||
{
|
||||
}
|
||||
|
||||
executor_type get_executor() const ASIO_NOEXCEPT
|
||||
{
|
||||
return ex_;
|
||||
}
|
||||
|
||||
template <typename CompletionHandler>
|
||||
void operator()(ASIO_MOVE_ARG(CompletionHandler) handler) const
|
||||
{
|
||||
typedef typename decay<CompletionHandler>::type DecayedHandler;
|
||||
|
||||
typename associated_allocator<DecayedHandler>::type alloc(
|
||||
(get_associated_allocator)(handler));
|
||||
|
||||
ex.post(detail::work_dispatcher<DecayedHandler>(
|
||||
ex_.post(detail::work_dispatcher<DecayedHandler>(
|
||||
ASIO_MOVE_CAST(CompletionHandler)(handler)), alloc);
|
||||
}
|
||||
|
||||
private:
|
||||
Executor ex_;
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
|
||||
template <typename CompletionToken>
|
||||
ASIO_INITFN_RESULT_TYPE(CompletionToken, void()) post(
|
||||
template <ASIO_COMPLETION_TOKEN_FOR(void()) CompletionToken>
|
||||
ASIO_INITFN_AUTO_RESULT_TYPE(CompletionToken, void()) post(
|
||||
ASIO_MOVE_ARG(CompletionToken) token)
|
||||
{
|
||||
return async_initiate<CompletionToken, void()>(
|
||||
detail::initiate_post(), token);
|
||||
}
|
||||
|
||||
template <typename Executor, typename CompletionToken>
|
||||
ASIO_INITFN_RESULT_TYPE(CompletionToken, void()) post(
|
||||
template <typename Executor,
|
||||
ASIO_COMPLETION_TOKEN_FOR(void()) CompletionToken>
|
||||
ASIO_INITFN_AUTO_RESULT_TYPE(CompletionToken, void()) post(
|
||||
const Executor& ex, ASIO_MOVE_ARG(CompletionToken) token,
|
||||
typename enable_if<is_executor<Executor>::value>::type*)
|
||||
{
|
||||
return async_initiate<CompletionToken, void()>(
|
||||
detail::initiate_post(), token, ex);
|
||||
detail::initiate_post_with_executor<Executor>(ex), token);
|
||||
}
|
||||
|
||||
template <typename ExecutionContext, typename CompletionToken>
|
||||
inline ASIO_INITFN_RESULT_TYPE(CompletionToken, void()) post(
|
||||
template <typename ExecutionContext,
|
||||
ASIO_COMPLETION_TOKEN_FOR(void()) CompletionToken>
|
||||
inline ASIO_INITFN_AUTO_RESULT_TYPE(CompletionToken, void()) post(
|
||||
ExecutionContext& ctx, ASIO_MOVE_ARG(CompletionToken) token,
|
||||
typename enable_if<is_convertible<
|
||||
ExecutionContext&, execution_context&>::value>::type*)
|
||||
|
||||
@@ -452,12 +452,26 @@ namespace detail
|
||||
asio::error_code(), 0, 1);
|
||||
}
|
||||
|
||||
struct initiate_async_read_buffer_sequence
|
||||
template <typename AsyncReadStream>
|
||||
class initiate_async_read_buffer_sequence
|
||||
{
|
||||
template <typename ReadHandler, typename AsyncReadStream,
|
||||
typename MutableBufferSequence, typename CompletionCondition>
|
||||
public:
|
||||
typedef typename AsyncReadStream::executor_type executor_type;
|
||||
|
||||
explicit initiate_async_read_buffer_sequence(AsyncReadStream& stream)
|
||||
: stream_(stream)
|
||||
{
|
||||
}
|
||||
|
||||
executor_type get_executor() const ASIO_NOEXCEPT
|
||||
{
|
||||
return stream_.get_executor();
|
||||
}
|
||||
|
||||
template <typename ReadHandler, typename MutableBufferSequence,
|
||||
typename CompletionCondition>
|
||||
void operator()(ASIO_MOVE_ARG(ReadHandler) handler,
|
||||
AsyncReadStream* s, const MutableBufferSequence& buffers,
|
||||
const MutableBufferSequence& buffers,
|
||||
ASIO_MOVE_ARG(CompletionCondition) completion_cond) const
|
||||
{
|
||||
// If you get an error on the following line it means that your handler
|
||||
@@ -466,10 +480,13 @@ namespace detail
|
||||
|
||||
non_const_lvalue<ReadHandler> handler2(handler);
|
||||
non_const_lvalue<CompletionCondition> completion_cond2(completion_cond);
|
||||
start_read_buffer_sequence_op(*s, buffers,
|
||||
start_read_buffer_sequence_op(stream_, buffers,
|
||||
asio::buffer_sequence_begin(buffers),
|
||||
completion_cond2.value, handler2.value);
|
||||
}
|
||||
|
||||
private:
|
||||
AsyncReadStream& stream_;
|
||||
};
|
||||
} // namespace detail
|
||||
|
||||
@@ -515,9 +532,11 @@ struct associated_executor<
|
||||
|
||||
#endif // !defined(GENERATING_DOCUMENTATION)
|
||||
|
||||
template <typename AsyncReadStream, typename MutableBufferSequence,
|
||||
typename CompletionCondition, typename ReadHandler>
|
||||
inline ASIO_INITFN_RESULT_TYPE(ReadHandler,
|
||||
template <typename AsyncReadStream,
|
||||
typename MutableBufferSequence, typename CompletionCondition,
|
||||
ASIO_COMPLETION_TOKEN_FOR(void (asio::error_code,
|
||||
std::size_t)) ReadHandler>
|
||||
inline ASIO_INITFN_AUTO_RESULT_TYPE(ReadHandler,
|
||||
void (asio::error_code, std::size_t))
|
||||
async_read(AsyncReadStream& s, const MutableBufferSequence& buffers,
|
||||
CompletionCondition completion_condition,
|
||||
@@ -528,13 +547,14 @@ async_read(AsyncReadStream& s, const MutableBufferSequence& buffers,
|
||||
{
|
||||
return async_initiate<ReadHandler,
|
||||
void (asio::error_code, std::size_t)>(
|
||||
detail::initiate_async_read_buffer_sequence(), handler, &s, buffers,
|
||||
ASIO_MOVE_CAST(CompletionCondition)(completion_condition));
|
||||
detail::initiate_async_read_buffer_sequence<AsyncReadStream>(s), handler,
|
||||
buffers, ASIO_MOVE_CAST(CompletionCondition)(completion_condition));
|
||||
}
|
||||
|
||||
template <typename AsyncReadStream, typename MutableBufferSequence,
|
||||
typename ReadHandler>
|
||||
inline ASIO_INITFN_RESULT_TYPE(ReadHandler,
|
||||
ASIO_COMPLETION_TOKEN_FOR(void (asio::error_code,
|
||||
std::size_t)) ReadHandler>
|
||||
inline ASIO_INITFN_AUTO_RESULT_TYPE(ReadHandler,
|
||||
void (asio::error_code, std::size_t))
|
||||
async_read(AsyncReadStream& s, const MutableBufferSequence& buffers,
|
||||
ASIO_MOVE_ARG(ReadHandler) handler,
|
||||
@@ -544,8 +564,8 @@ async_read(AsyncReadStream& s, const MutableBufferSequence& buffers,
|
||||
{
|
||||
return async_initiate<ReadHandler,
|
||||
void (asio::error_code, std::size_t)>(
|
||||
detail::initiate_async_read_buffer_sequence(),
|
||||
handler, &s, buffers, transfer_all());
|
||||
detail::initiate_async_read_buffer_sequence<AsyncReadStream>(s),
|
||||
handler, buffers, transfer_all());
|
||||
}
|
||||
|
||||
#if !defined(ASIO_NO_DYNAMIC_BUFFER_V1)
|
||||
@@ -691,12 +711,26 @@ namespace detail
|
||||
function, this_handler->handler_);
|
||||
}
|
||||
|
||||
struct initiate_async_read_dynbuf_v1
|
||||
template <typename AsyncReadStream>
|
||||
class initiate_async_read_dynbuf_v1
|
||||
{
|
||||
template <typename ReadHandler, typename AsyncReadStream,
|
||||
typename DynamicBuffer_v1, typename CompletionCondition>
|
||||
public:
|
||||
typedef typename AsyncReadStream::executor_type executor_type;
|
||||
|
||||
explicit initiate_async_read_dynbuf_v1(AsyncReadStream& stream)
|
||||
: stream_(stream)
|
||||
{
|
||||
}
|
||||
|
||||
executor_type get_executor() const ASIO_NOEXCEPT
|
||||
{
|
||||
return stream_.get_executor();
|
||||
}
|
||||
|
||||
template <typename ReadHandler, typename DynamicBuffer_v1,
|
||||
typename CompletionCondition>
|
||||
void operator()(ASIO_MOVE_ARG(ReadHandler) handler,
|
||||
AsyncReadStream* s, ASIO_MOVE_ARG(DynamicBuffer_v1) buffers,
|
||||
ASIO_MOVE_ARG(DynamicBuffer_v1) buffers,
|
||||
ASIO_MOVE_ARG(CompletionCondition) completion_cond) const
|
||||
{
|
||||
// If you get an error on the following line it means that your handler
|
||||
@@ -707,10 +741,13 @@ namespace detail
|
||||
non_const_lvalue<CompletionCondition> completion_cond2(completion_cond);
|
||||
read_dynbuf_v1_op<AsyncReadStream, typename decay<DynamicBuffer_v1>::type,
|
||||
CompletionCondition, typename decay<ReadHandler>::type>(
|
||||
*s, ASIO_MOVE_CAST(DynamicBuffer_v1)(buffers),
|
||||
stream_, ASIO_MOVE_CAST(DynamicBuffer_v1)(buffers),
|
||||
completion_cond2.value, handler2.value)(
|
||||
asio::error_code(), 0, 1);
|
||||
}
|
||||
|
||||
private:
|
||||
AsyncReadStream& stream_;
|
||||
};
|
||||
} // namespace detail
|
||||
|
||||
@@ -754,9 +791,10 @@ struct associated_executor<
|
||||
|
||||
#endif // !defined(GENERATING_DOCUMENTATION)
|
||||
|
||||
template <typename AsyncReadStream,
|
||||
typename DynamicBuffer_v1, typename ReadHandler>
|
||||
inline ASIO_INITFN_RESULT_TYPE(ReadHandler,
|
||||
template <typename AsyncReadStream, typename DynamicBuffer_v1,
|
||||
ASIO_COMPLETION_TOKEN_FOR(void (asio::error_code,
|
||||
std::size_t)) ReadHandler>
|
||||
inline ASIO_INITFN_AUTO_RESULT_TYPE(ReadHandler,
|
||||
void (asio::error_code, std::size_t))
|
||||
async_read(AsyncReadStream& s,
|
||||
ASIO_MOVE_ARG(DynamicBuffer_v1) buffers,
|
||||
@@ -771,9 +809,11 @@ async_read(AsyncReadStream& s,
|
||||
transfer_all(), ASIO_MOVE_CAST(ReadHandler)(handler));
|
||||
}
|
||||
|
||||
template <typename AsyncReadStream, typename DynamicBuffer_v1,
|
||||
typename CompletionCondition, typename ReadHandler>
|
||||
inline ASIO_INITFN_RESULT_TYPE(ReadHandler,
|
||||
template <typename AsyncReadStream,
|
||||
typename DynamicBuffer_v1, typename CompletionCondition,
|
||||
ASIO_COMPLETION_TOKEN_FOR(void (asio::error_code,
|
||||
std::size_t)) ReadHandler>
|
||||
inline ASIO_INITFN_AUTO_RESULT_TYPE(ReadHandler,
|
||||
void (asio::error_code, std::size_t))
|
||||
async_read(AsyncReadStream& s,
|
||||
ASIO_MOVE_ARG(DynamicBuffer_v1) buffers,
|
||||
@@ -790,16 +830,18 @@ async_read(AsyncReadStream& s,
|
||||
|
||||
return async_initiate<ReadHandler,
|
||||
void (asio::error_code, std::size_t)>(
|
||||
detail::initiate_async_read_dynbuf_v1(), handler, &s,
|
||||
ASIO_MOVE_CAST(DynamicBuffer_v1)(buffers),
|
||||
detail::initiate_async_read_dynbuf_v1<AsyncReadStream>(s),
|
||||
handler, ASIO_MOVE_CAST(DynamicBuffer_v1)(buffers),
|
||||
ASIO_MOVE_CAST(CompletionCondition)(completion_condition));
|
||||
}
|
||||
|
||||
#if !defined(ASIO_NO_EXTENSIONS)
|
||||
#if !defined(ASIO_NO_IOSTREAM)
|
||||
|
||||
template <typename AsyncReadStream, typename Allocator, typename ReadHandler>
|
||||
inline ASIO_INITFN_RESULT_TYPE(ReadHandler,
|
||||
template <typename AsyncReadStream, typename Allocator,
|
||||
ASIO_COMPLETION_TOKEN_FOR(void (asio::error_code,
|
||||
std::size_t)) ReadHandler>
|
||||
inline ASIO_INITFN_AUTO_RESULT_TYPE(ReadHandler,
|
||||
void (asio::error_code, std::size_t))
|
||||
async_read(AsyncReadStream& s, basic_streambuf<Allocator>& b,
|
||||
ASIO_MOVE_ARG(ReadHandler) handler)
|
||||
@@ -808,9 +850,11 @@ async_read(AsyncReadStream& s, basic_streambuf<Allocator>& b,
|
||||
ASIO_MOVE_CAST(ReadHandler)(handler));
|
||||
}
|
||||
|
||||
template <typename AsyncReadStream, typename Allocator,
|
||||
typename CompletionCondition, typename ReadHandler>
|
||||
inline ASIO_INITFN_RESULT_TYPE(ReadHandler,
|
||||
template <typename AsyncReadStream,
|
||||
typename Allocator, typename CompletionCondition,
|
||||
ASIO_COMPLETION_TOKEN_FOR(void (asio::error_code,
|
||||
std::size_t)) ReadHandler>
|
||||
inline ASIO_INITFN_AUTO_RESULT_TYPE(ReadHandler,
|
||||
void (asio::error_code, std::size_t))
|
||||
async_read(AsyncReadStream& s, basic_streambuf<Allocator>& b,
|
||||
CompletionCondition completion_condition,
|
||||
@@ -972,12 +1016,26 @@ namespace detail
|
||||
function, this_handler->handler_);
|
||||
}
|
||||
|
||||
struct initiate_async_read_dynbuf_v2
|
||||
template <typename AsyncReadStream>
|
||||
class initiate_async_read_dynbuf_v2
|
||||
{
|
||||
template <typename ReadHandler, typename AsyncReadStream,
|
||||
typename DynamicBuffer_v2, typename CompletionCondition>
|
||||
public:
|
||||
typedef typename AsyncReadStream::executor_type executor_type;
|
||||
|
||||
explicit initiate_async_read_dynbuf_v2(AsyncReadStream& stream)
|
||||
: stream_(stream)
|
||||
{
|
||||
}
|
||||
|
||||
executor_type get_executor() const ASIO_NOEXCEPT
|
||||
{
|
||||
return stream_.get_executor();
|
||||
}
|
||||
|
||||
template <typename ReadHandler, typename DynamicBuffer_v2,
|
||||
typename CompletionCondition>
|
||||
void operator()(ASIO_MOVE_ARG(ReadHandler) handler,
|
||||
AsyncReadStream* s, ASIO_MOVE_ARG(DynamicBuffer_v2) buffers,
|
||||
ASIO_MOVE_ARG(DynamicBuffer_v2) buffers,
|
||||
ASIO_MOVE_ARG(CompletionCondition) completion_cond) const
|
||||
{
|
||||
// If you get an error on the following line it means that your handler
|
||||
@@ -988,10 +1046,13 @@ namespace detail
|
||||
non_const_lvalue<CompletionCondition> completion_cond2(completion_cond);
|
||||
read_dynbuf_v2_op<AsyncReadStream, typename decay<DynamicBuffer_v2>::type,
|
||||
CompletionCondition, typename decay<ReadHandler>::type>(
|
||||
*s, ASIO_MOVE_CAST(DynamicBuffer_v2)(buffers),
|
||||
stream_, ASIO_MOVE_CAST(DynamicBuffer_v2)(buffers),
|
||||
completion_cond2.value, handler2.value)(
|
||||
asio::error_code(), 0, 1);
|
||||
}
|
||||
|
||||
private:
|
||||
AsyncReadStream& stream_;
|
||||
};
|
||||
} // namespace detail
|
||||
|
||||
@@ -1035,9 +1096,10 @@ struct associated_executor<
|
||||
|
||||
#endif // !defined(GENERATING_DOCUMENTATION)
|
||||
|
||||
template <typename AsyncReadStream,
|
||||
typename DynamicBuffer_v2, typename ReadHandler>
|
||||
inline ASIO_INITFN_RESULT_TYPE(ReadHandler,
|
||||
template <typename AsyncReadStream, typename DynamicBuffer_v2,
|
||||
ASIO_COMPLETION_TOKEN_FOR(void (asio::error_code,
|
||||
std::size_t)) ReadHandler>
|
||||
inline ASIO_INITFN_AUTO_RESULT_TYPE(ReadHandler,
|
||||
void (asio::error_code, std::size_t))
|
||||
async_read(AsyncReadStream& s, DynamicBuffer_v2 buffers,
|
||||
ASIO_MOVE_ARG(ReadHandler) handler,
|
||||
@@ -1050,9 +1112,11 @@ async_read(AsyncReadStream& s, DynamicBuffer_v2 buffers,
|
||||
transfer_all(), ASIO_MOVE_CAST(ReadHandler)(handler));
|
||||
}
|
||||
|
||||
template <typename AsyncReadStream, typename DynamicBuffer_v2,
|
||||
typename CompletionCondition, typename ReadHandler>
|
||||
inline ASIO_INITFN_RESULT_TYPE(ReadHandler,
|
||||
template <typename AsyncReadStream,
|
||||
typename DynamicBuffer_v2, typename CompletionCondition,
|
||||
ASIO_COMPLETION_TOKEN_FOR(void (asio::error_code,
|
||||
std::size_t)) ReadHandler>
|
||||
inline ASIO_INITFN_AUTO_RESULT_TYPE(ReadHandler,
|
||||
void (asio::error_code, std::size_t))
|
||||
async_read(AsyncReadStream& s, DynamicBuffer_v2 buffers,
|
||||
CompletionCondition completion_condition,
|
||||
@@ -1067,8 +1131,8 @@ async_read(AsyncReadStream& s, DynamicBuffer_v2 buffers,
|
||||
|
||||
return async_initiate<ReadHandler,
|
||||
void (asio::error_code, std::size_t)>(
|
||||
detail::initiate_async_read_dynbuf_v2(), handler, &s,
|
||||
ASIO_MOVE_CAST(DynamicBuffer_v2)(buffers),
|
||||
detail::initiate_async_read_dynbuf_v2<AsyncReadStream>(s),
|
||||
handler, ASIO_MOVE_CAST(DynamicBuffer_v2)(buffers),
|
||||
ASIO_MOVE_CAST(CompletionCondition)(completion_condition));
|
||||
}
|
||||
|
||||
|
||||
@@ -320,13 +320,27 @@ namespace detail
|
||||
asio::error_code(), 0, 1);
|
||||
}
|
||||
|
||||
struct initiate_async_read_at_buffer_sequence
|
||||
template <typename AsyncRandomAccessReadDevice>
|
||||
class initiate_async_read_at_buffer_sequence
|
||||
{
|
||||
template <typename ReadHandler, typename AsyncRandomAccessReadDevice,
|
||||
typename MutableBufferSequence, typename CompletionCondition>
|
||||
public:
|
||||
typedef typename AsyncRandomAccessReadDevice::executor_type executor_type;
|
||||
|
||||
explicit initiate_async_read_at_buffer_sequence(
|
||||
AsyncRandomAccessReadDevice& device)
|
||||
: device_(device)
|
||||
{
|
||||
}
|
||||
|
||||
executor_type get_executor() const ASIO_NOEXCEPT
|
||||
{
|
||||
return device_.get_executor();
|
||||
}
|
||||
|
||||
template <typename ReadHandler, typename MutableBufferSequence,
|
||||
typename CompletionCondition>
|
||||
void operator()(ASIO_MOVE_ARG(ReadHandler) handler,
|
||||
AsyncRandomAccessReadDevice* d, uint64_t offset,
|
||||
const MutableBufferSequence& buffers,
|
||||
uint64_t offset, const MutableBufferSequence& buffers,
|
||||
ASIO_MOVE_ARG(CompletionCondition) completion_cond) const
|
||||
{
|
||||
// If you get an error on the following line it means that your handler
|
||||
@@ -335,10 +349,13 @@ namespace detail
|
||||
|
||||
non_const_lvalue<ReadHandler> handler2(handler);
|
||||
non_const_lvalue<CompletionCondition> completion_cond2(completion_cond);
|
||||
start_read_at_buffer_sequence_op(*d, offset, buffers,
|
||||
start_read_at_buffer_sequence_op(device_, offset, buffers,
|
||||
asio::buffer_sequence_begin(buffers),
|
||||
completion_cond2.value, handler2.value);
|
||||
}
|
||||
|
||||
private:
|
||||
AsyncRandomAccessReadDevice& device_;
|
||||
};
|
||||
} // namespace detail
|
||||
|
||||
@@ -386,9 +403,11 @@ struct associated_executor<
|
||||
|
||||
#endif // !defined(GENERATING_DOCUMENTATION)
|
||||
|
||||
template <typename AsyncRandomAccessReadDevice, typename MutableBufferSequence,
|
||||
typename CompletionCondition, typename ReadHandler>
|
||||
inline ASIO_INITFN_RESULT_TYPE(ReadHandler,
|
||||
template <typename AsyncRandomAccessReadDevice,
|
||||
typename MutableBufferSequence, typename CompletionCondition,
|
||||
ASIO_COMPLETION_TOKEN_FOR(void (asio::error_code,
|
||||
std::size_t)) ReadHandler>
|
||||
inline ASIO_INITFN_AUTO_RESULT_TYPE(ReadHandler,
|
||||
void (asio::error_code, std::size_t))
|
||||
async_read_at(AsyncRandomAccessReadDevice& d,
|
||||
uint64_t offset, const MutableBufferSequence& buffers,
|
||||
@@ -397,13 +416,16 @@ async_read_at(AsyncRandomAccessReadDevice& d,
|
||||
{
|
||||
return async_initiate<ReadHandler,
|
||||
void (asio::error_code, std::size_t)>(
|
||||
detail::initiate_async_read_at_buffer_sequence(), handler, &d, offset,
|
||||
buffers, ASIO_MOVE_CAST(CompletionCondition)(completion_condition));
|
||||
detail::initiate_async_read_at_buffer_sequence<
|
||||
AsyncRandomAccessReadDevice>(d),
|
||||
handler, offset, buffers,
|
||||
ASIO_MOVE_CAST(CompletionCondition)(completion_condition));
|
||||
}
|
||||
|
||||
template <typename AsyncRandomAccessReadDevice, typename MutableBufferSequence,
|
||||
typename ReadHandler>
|
||||
inline ASIO_INITFN_RESULT_TYPE(ReadHandler,
|
||||
ASIO_COMPLETION_TOKEN_FOR(void (asio::error_code,
|
||||
std::size_t)) ReadHandler>
|
||||
inline ASIO_INITFN_AUTO_RESULT_TYPE(ReadHandler,
|
||||
void (asio::error_code, std::size_t))
|
||||
async_read_at(AsyncRandomAccessReadDevice& d,
|
||||
uint64_t offset, const MutableBufferSequence& buffers,
|
||||
@@ -411,8 +433,9 @@ async_read_at(AsyncRandomAccessReadDevice& d,
|
||||
{
|
||||
return async_initiate<ReadHandler,
|
||||
void (asio::error_code, std::size_t)>(
|
||||
detail::initiate_async_read_at_buffer_sequence(),
|
||||
handler, &d, offset, buffers, transfer_all());
|
||||
detail::initiate_async_read_at_buffer_sequence<
|
||||
AsyncRandomAccessReadDevice>(d),
|
||||
handler, offset, buffers, transfer_all());
|
||||
}
|
||||
|
||||
#if !defined(ASIO_NO_EXTENSIONS)
|
||||
@@ -553,13 +576,27 @@ namespace detail
|
||||
function, this_handler->handler_);
|
||||
}
|
||||
|
||||
struct initiate_async_read_at_streambuf
|
||||
template <typename AsyncRandomAccessReadDevice>
|
||||
class initiate_async_read_at_streambuf
|
||||
{
|
||||
template <typename ReadHandler, typename AsyncRandomAccessReadDevice,
|
||||
public:
|
||||
typedef typename AsyncRandomAccessReadDevice::executor_type executor_type;
|
||||
|
||||
explicit initiate_async_read_at_streambuf(
|
||||
AsyncRandomAccessReadDevice& device)
|
||||
: device_(device)
|
||||
{
|
||||
}
|
||||
|
||||
executor_type get_executor() const ASIO_NOEXCEPT
|
||||
{
|
||||
return device_.get_executor();
|
||||
}
|
||||
|
||||
template <typename ReadHandler,
|
||||
typename Allocator, typename CompletionCondition>
|
||||
void operator()(ASIO_MOVE_ARG(ReadHandler) handler,
|
||||
AsyncRandomAccessReadDevice* d, uint64_t offset,
|
||||
basic_streambuf<Allocator>* b,
|
||||
uint64_t offset, basic_streambuf<Allocator>* b,
|
||||
ASIO_MOVE_ARG(CompletionCondition) completion_cond) const
|
||||
{
|
||||
// If you get an error on the following line it means that your handler
|
||||
@@ -570,9 +607,12 @@ namespace detail
|
||||
non_const_lvalue<CompletionCondition> completion_cond2(completion_cond);
|
||||
read_at_streambuf_op<AsyncRandomAccessReadDevice, Allocator,
|
||||
CompletionCondition, typename decay<ReadHandler>::type>(
|
||||
*d, offset, *b, completion_cond2.value, handler2.value)(
|
||||
device_, offset, *b, completion_cond2.value, handler2.value)(
|
||||
asio::error_code(), 0, 1);
|
||||
}
|
||||
|
||||
private:
|
||||
AsyncRandomAccessReadDevice& device_;
|
||||
};
|
||||
} // namespace detail
|
||||
|
||||
@@ -616,9 +656,11 @@ struct associated_executor<
|
||||
|
||||
#endif // !defined(GENERATING_DOCUMENTATION)
|
||||
|
||||
template <typename AsyncRandomAccessReadDevice, typename Allocator,
|
||||
typename CompletionCondition, typename ReadHandler>
|
||||
inline ASIO_INITFN_RESULT_TYPE(ReadHandler,
|
||||
template <typename AsyncRandomAccessReadDevice,
|
||||
typename Allocator, typename CompletionCondition,
|
||||
ASIO_COMPLETION_TOKEN_FOR(void (asio::error_code,
|
||||
std::size_t)) ReadHandler>
|
||||
inline ASIO_INITFN_AUTO_RESULT_TYPE(ReadHandler,
|
||||
void (asio::error_code, std::size_t))
|
||||
async_read_at(AsyncRandomAccessReadDevice& d,
|
||||
uint64_t offset, asio::basic_streambuf<Allocator>& b,
|
||||
@@ -627,13 +669,15 @@ async_read_at(AsyncRandomAccessReadDevice& d,
|
||||
{
|
||||
return async_initiate<ReadHandler,
|
||||
void (asio::error_code, std::size_t)>(
|
||||
detail::initiate_async_read_at_streambuf(), handler, &d, offset,
|
||||
&b, ASIO_MOVE_CAST(CompletionCondition)(completion_condition));
|
||||
detail::initiate_async_read_at_streambuf<AsyncRandomAccessReadDevice>(d),
|
||||
handler, offset, &b,
|
||||
ASIO_MOVE_CAST(CompletionCondition)(completion_condition));
|
||||
}
|
||||
|
||||
template <typename AsyncRandomAccessReadDevice, typename Allocator,
|
||||
typename ReadHandler>
|
||||
inline ASIO_INITFN_RESULT_TYPE(ReadHandler,
|
||||
ASIO_COMPLETION_TOKEN_FOR(void (asio::error_code,
|
||||
std::size_t)) ReadHandler>
|
||||
inline ASIO_INITFN_AUTO_RESULT_TYPE(ReadHandler,
|
||||
void (asio::error_code, std::size_t))
|
||||
async_read_at(AsyncRandomAccessReadDevice& d,
|
||||
uint64_t offset, asio::basic_streambuf<Allocator>& b,
|
||||
@@ -641,8 +685,8 @@ async_read_at(AsyncRandomAccessReadDevice& d,
|
||||
{
|
||||
return async_initiate<ReadHandler,
|
||||
void (asio::error_code, std::size_t)>(
|
||||
detail::initiate_async_read_at_streambuf(),
|
||||
handler, &d, offset, &b, transfer_all());
|
||||
detail::initiate_async_read_at_streambuf<AsyncRandomAccessReadDevice>(d),
|
||||
handler, offset, &b, transfer_all());
|
||||
}
|
||||
|
||||
#endif // !defined(ASIO_NO_IOSTREAM)
|
||||
|
||||
@@ -951,12 +951,25 @@ namespace detail
|
||||
function, this_handler->handler_);
|
||||
}
|
||||
|
||||
struct initiate_async_read_until_delim_v1
|
||||
template <typename AsyncReadStream>
|
||||
class initiate_async_read_until_delim_v1
|
||||
{
|
||||
template <typename ReadHandler, typename AsyncReadStream,
|
||||
typename DynamicBuffer_v1>
|
||||
public:
|
||||
typedef typename AsyncReadStream::executor_type executor_type;
|
||||
|
||||
explicit initiate_async_read_until_delim_v1(AsyncReadStream& stream)
|
||||
: stream_(stream)
|
||||
{
|
||||
}
|
||||
|
||||
executor_type get_executor() const ASIO_NOEXCEPT
|
||||
{
|
||||
return stream_.get_executor();
|
||||
}
|
||||
|
||||
template <typename ReadHandler, typename DynamicBuffer_v1>
|
||||
void operator()(ASIO_MOVE_ARG(ReadHandler) handler,
|
||||
AsyncReadStream* s, ASIO_MOVE_ARG(DynamicBuffer_v1) buffers,
|
||||
ASIO_MOVE_ARG(DynamicBuffer_v1) buffers,
|
||||
char delim) const
|
||||
{
|
||||
// If you get an error on the following line it means that your handler
|
||||
@@ -967,9 +980,12 @@ namespace detail
|
||||
read_until_delim_op_v1<AsyncReadStream,
|
||||
typename decay<DynamicBuffer_v1>::type,
|
||||
typename decay<ReadHandler>::type>(
|
||||
*s, ASIO_MOVE_CAST(DynamicBuffer_v1)(buffers),
|
||||
stream_, ASIO_MOVE_CAST(DynamicBuffer_v1)(buffers),
|
||||
delim, handler2.value)(asio::error_code(), 0, 1);
|
||||
}
|
||||
|
||||
private:
|
||||
AsyncReadStream& stream_;
|
||||
};
|
||||
} // namespace detail
|
||||
|
||||
@@ -1013,9 +1029,10 @@ struct associated_executor<
|
||||
|
||||
#endif // !defined(GENERATING_DOCUMENTATION)
|
||||
|
||||
template <typename AsyncReadStream,
|
||||
typename DynamicBuffer_v1, typename ReadHandler>
|
||||
ASIO_INITFN_RESULT_TYPE(ReadHandler,
|
||||
template <typename AsyncReadStream, typename DynamicBuffer_v1,
|
||||
ASIO_COMPLETION_TOKEN_FOR(void (asio::error_code,
|
||||
std::size_t)) ReadHandler>
|
||||
ASIO_INITFN_AUTO_RESULT_TYPE(ReadHandler,
|
||||
void (asio::error_code, std::size_t))
|
||||
async_read_until(AsyncReadStream& s,
|
||||
ASIO_MOVE_ARG(DynamicBuffer_v1) buffers,
|
||||
@@ -1027,8 +1044,8 @@ async_read_until(AsyncReadStream& s,
|
||||
{
|
||||
return async_initiate<ReadHandler,
|
||||
void (asio::error_code, std::size_t)>(
|
||||
detail::initiate_async_read_until_delim_v1(), handler,
|
||||
&s, ASIO_MOVE_CAST(DynamicBuffer_v1)(buffers), delim);
|
||||
detail::initiate_async_read_until_delim_v1<AsyncReadStream>(s),
|
||||
handler, ASIO_MOVE_CAST(DynamicBuffer_v1)(buffers), delim);
|
||||
}
|
||||
|
||||
namespace detail
|
||||
@@ -1218,12 +1235,25 @@ namespace detail
|
||||
function, this_handler->handler_);
|
||||
}
|
||||
|
||||
struct initiate_async_read_until_delim_string_v1
|
||||
template <typename AsyncReadStream>
|
||||
class initiate_async_read_until_delim_string_v1
|
||||
{
|
||||
template <typename ReadHandler, typename AsyncReadStream,
|
||||
typename DynamicBuffer_v1>
|
||||
public:
|
||||
typedef typename AsyncReadStream::executor_type executor_type;
|
||||
|
||||
explicit initiate_async_read_until_delim_string_v1(AsyncReadStream& stream)
|
||||
: stream_(stream)
|
||||
{
|
||||
}
|
||||
|
||||
executor_type get_executor() const ASIO_NOEXCEPT
|
||||
{
|
||||
return stream_.get_executor();
|
||||
}
|
||||
|
||||
template <typename ReadHandler, typename DynamicBuffer_v1>
|
||||
void operator()(ASIO_MOVE_ARG(ReadHandler) handler,
|
||||
AsyncReadStream* s, ASIO_MOVE_ARG(DynamicBuffer_v1) buffers,
|
||||
ASIO_MOVE_ARG(DynamicBuffer_v1) buffers,
|
||||
const std::string& delim) const
|
||||
{
|
||||
// If you get an error on the following line it means that your handler
|
||||
@@ -1234,9 +1264,12 @@ namespace detail
|
||||
read_until_delim_string_op_v1<AsyncReadStream,
|
||||
typename decay<DynamicBuffer_v1>::type,
|
||||
typename decay<ReadHandler>::type>(
|
||||
*s, ASIO_MOVE_CAST(DynamicBuffer_v1)(buffers),
|
||||
stream_, ASIO_MOVE_CAST(DynamicBuffer_v1)(buffers),
|
||||
delim, handler2.value)(asio::error_code(), 0, 1);
|
||||
}
|
||||
|
||||
private:
|
||||
AsyncReadStream& stream_;
|
||||
};
|
||||
} // namespace detail
|
||||
|
||||
@@ -1280,9 +1313,10 @@ struct associated_executor<
|
||||
|
||||
#endif // !defined(GENERATING_DOCUMENTATION)
|
||||
|
||||
template <typename AsyncReadStream,
|
||||
typename DynamicBuffer_v1, typename ReadHandler>
|
||||
ASIO_INITFN_RESULT_TYPE(ReadHandler,
|
||||
template <typename AsyncReadStream, typename DynamicBuffer_v1,
|
||||
ASIO_COMPLETION_TOKEN_FOR(void (asio::error_code,
|
||||
std::size_t)) ReadHandler>
|
||||
ASIO_INITFN_AUTO_RESULT_TYPE(ReadHandler,
|
||||
void (asio::error_code, std::size_t))
|
||||
async_read_until(AsyncReadStream& s,
|
||||
ASIO_MOVE_ARG(DynamicBuffer_v1) buffers,
|
||||
@@ -1295,8 +1329,8 @@ async_read_until(AsyncReadStream& s,
|
||||
{
|
||||
return async_initiate<ReadHandler,
|
||||
void (asio::error_code, std::size_t)>(
|
||||
detail::initiate_async_read_until_delim_string_v1(),
|
||||
handler, &s, ASIO_MOVE_CAST(DynamicBuffer_v1)(buffers),
|
||||
detail::initiate_async_read_until_delim_string_v1<AsyncReadStream>(s),
|
||||
handler, ASIO_MOVE_CAST(DynamicBuffer_v1)(buffers),
|
||||
static_cast<std::string>(delim));
|
||||
}
|
||||
|
||||
@@ -1493,13 +1527,25 @@ namespace detail
|
||||
function, this_handler->handler_);
|
||||
}
|
||||
|
||||
struct initiate_async_read_until_expr_v1
|
||||
template <typename AsyncReadStream>
|
||||
class initiate_async_read_until_expr_v1
|
||||
{
|
||||
template <typename ReadHandler, typename AsyncReadStream,
|
||||
typename DynamicBuffer_v1, typename RegEx>
|
||||
public:
|
||||
typedef typename AsyncReadStream::executor_type executor_type;
|
||||
|
||||
explicit initiate_async_read_until_expr_v1(AsyncReadStream& stream)
|
||||
: stream_(stream)
|
||||
{
|
||||
}
|
||||
|
||||
executor_type get_executor() const ASIO_NOEXCEPT
|
||||
{
|
||||
return stream_.get_executor();
|
||||
}
|
||||
|
||||
template <typename ReadHandler, typename DynamicBuffer_v1, typename RegEx>
|
||||
void operator()(ASIO_MOVE_ARG(ReadHandler) handler,
|
||||
AsyncReadStream* s, ASIO_MOVE_ARG(DynamicBuffer_v1) buffers,
|
||||
const RegEx& expr) const
|
||||
ASIO_MOVE_ARG(DynamicBuffer_v1) buffers, const RegEx& expr) const
|
||||
{
|
||||
// If you get an error on the following line it means that your handler
|
||||
// does not meet the documented type requirements for a ReadHandler.
|
||||
@@ -1509,9 +1555,12 @@ namespace detail
|
||||
read_until_expr_op_v1<AsyncReadStream,
|
||||
typename decay<DynamicBuffer_v1>::type,
|
||||
RegEx, typename decay<ReadHandler>::type>(
|
||||
*s, ASIO_MOVE_CAST(DynamicBuffer_v1)(buffers),
|
||||
stream_, ASIO_MOVE_CAST(DynamicBuffer_v1)(buffers),
|
||||
expr, handler2.value)(asio::error_code(), 0, 1);
|
||||
}
|
||||
|
||||
private:
|
||||
AsyncReadStream& stream_;
|
||||
};
|
||||
} // namespace detail
|
||||
|
||||
@@ -1555,9 +1604,10 @@ struct associated_executor<
|
||||
|
||||
#endif // !defined(GENERATING_DOCUMENTATION)
|
||||
|
||||
template <typename AsyncReadStream,
|
||||
typename DynamicBuffer_v1, typename ReadHandler>
|
||||
ASIO_INITFN_RESULT_TYPE(ReadHandler,
|
||||
template <typename AsyncReadStream, typename DynamicBuffer_v1,
|
||||
ASIO_COMPLETION_TOKEN_FOR(void (asio::error_code,
|
||||
std::size_t)) ReadHandler>
|
||||
ASIO_INITFN_AUTO_RESULT_TYPE(ReadHandler,
|
||||
void (asio::error_code, std::size_t))
|
||||
async_read_until(AsyncReadStream& s,
|
||||
ASIO_MOVE_ARG(DynamicBuffer_v1) buffers,
|
||||
@@ -1570,8 +1620,8 @@ async_read_until(AsyncReadStream& s,
|
||||
{
|
||||
return async_initiate<ReadHandler,
|
||||
void (asio::error_code, std::size_t)>(
|
||||
detail::initiate_async_read_until_expr_v1(), handler,
|
||||
&s, ASIO_MOVE_CAST(DynamicBuffer_v1)(buffers), expr);
|
||||
detail::initiate_async_read_until_expr_v1<AsyncReadStream>(s),
|
||||
handler, ASIO_MOVE_CAST(DynamicBuffer_v1)(buffers), expr);
|
||||
}
|
||||
|
||||
#endif // defined(ASIO_HAS_BOOST_REGEX)
|
||||
@@ -1764,12 +1814,26 @@ namespace detail
|
||||
function, this_handler->handler_);
|
||||
}
|
||||
|
||||
struct initiate_async_read_until_match_v1
|
||||
template <typename AsyncReadStream>
|
||||
class initiate_async_read_until_match_v1
|
||||
{
|
||||
template <typename ReadHandler, typename AsyncReadStream,
|
||||
public:
|
||||
typedef typename AsyncReadStream::executor_type executor_type;
|
||||
|
||||
explicit initiate_async_read_until_match_v1(AsyncReadStream& stream)
|
||||
: stream_(stream)
|
||||
{
|
||||
}
|
||||
|
||||
executor_type get_executor() const ASIO_NOEXCEPT
|
||||
{
|
||||
return stream_.get_executor();
|
||||
}
|
||||
|
||||
template <typename ReadHandler,
|
||||
typename DynamicBuffer_v1, typename MatchCondition>
|
||||
void operator()(ASIO_MOVE_ARG(ReadHandler) handler,
|
||||
AsyncReadStream* s, ASIO_MOVE_ARG(DynamicBuffer_v1) buffers,
|
||||
ASIO_MOVE_ARG(DynamicBuffer_v1) buffers,
|
||||
MatchCondition match_condition) const
|
||||
{
|
||||
// If you get an error on the following line it means that your handler
|
||||
@@ -1780,9 +1844,12 @@ namespace detail
|
||||
read_until_match_op_v1<AsyncReadStream,
|
||||
typename decay<DynamicBuffer_v1>::type,
|
||||
MatchCondition, typename decay<ReadHandler>::type>(
|
||||
*s, ASIO_MOVE_CAST(DynamicBuffer_v1)(buffers),
|
||||
stream_, ASIO_MOVE_CAST(DynamicBuffer_v1)(buffers),
|
||||
match_condition, handler2.value)(asio::error_code(), 0, 1);
|
||||
}
|
||||
|
||||
private:
|
||||
AsyncReadStream& stream_;
|
||||
};
|
||||
} // namespace detail
|
||||
|
||||
@@ -1826,9 +1893,11 @@ struct associated_executor<
|
||||
|
||||
#endif // !defined(GENERATING_DOCUMENTATION)
|
||||
|
||||
template <typename AsyncReadStream, typename DynamicBuffer_v1,
|
||||
typename MatchCondition, typename ReadHandler>
|
||||
ASIO_INITFN_RESULT_TYPE(ReadHandler,
|
||||
template <typename AsyncReadStream,
|
||||
typename DynamicBuffer_v1, typename MatchCondition,
|
||||
ASIO_COMPLETION_TOKEN_FOR(void (asio::error_code,
|
||||
std::size_t)) ReadHandler>
|
||||
ASIO_INITFN_AUTO_RESULT_TYPE(ReadHandler,
|
||||
void (asio::error_code, std::size_t))
|
||||
async_read_until(AsyncReadStream& s,
|
||||
ASIO_MOVE_ARG(DynamicBuffer_v1) buffers,
|
||||
@@ -1841,14 +1910,16 @@ async_read_until(AsyncReadStream& s,
|
||||
{
|
||||
return async_initiate<ReadHandler,
|
||||
void (asio::error_code, std::size_t)>(
|
||||
detail::initiate_async_read_until_match_v1(), handler,
|
||||
&s, ASIO_MOVE_CAST(DynamicBuffer_v1)(buffers), match_condition);
|
||||
detail::initiate_async_read_until_match_v1<AsyncReadStream>(s), handler,
|
||||
ASIO_MOVE_CAST(DynamicBuffer_v1)(buffers), match_condition);
|
||||
}
|
||||
|
||||
#if !defined(ASIO_NO_IOSTREAM)
|
||||
|
||||
template <typename AsyncReadStream, typename Allocator, typename ReadHandler>
|
||||
inline ASIO_INITFN_RESULT_TYPE(ReadHandler,
|
||||
template <typename AsyncReadStream, typename Allocator,
|
||||
ASIO_COMPLETION_TOKEN_FOR(void (asio::error_code,
|
||||
std::size_t)) ReadHandler>
|
||||
inline ASIO_INITFN_AUTO_RESULT_TYPE(ReadHandler,
|
||||
void (asio::error_code, std::size_t))
|
||||
async_read_until(AsyncReadStream& s,
|
||||
asio::basic_streambuf<Allocator>& b,
|
||||
@@ -1858,8 +1929,10 @@ async_read_until(AsyncReadStream& s,
|
||||
delim, ASIO_MOVE_CAST(ReadHandler)(handler));
|
||||
}
|
||||
|
||||
template <typename AsyncReadStream, typename Allocator, typename ReadHandler>
|
||||
inline ASIO_INITFN_RESULT_TYPE(ReadHandler,
|
||||
template <typename AsyncReadStream, typename Allocator,
|
||||
ASIO_COMPLETION_TOKEN_FOR(void (asio::error_code,
|
||||
std::size_t)) ReadHandler>
|
||||
inline ASIO_INITFN_AUTO_RESULT_TYPE(ReadHandler,
|
||||
void (asio::error_code, std::size_t))
|
||||
async_read_until(AsyncReadStream& s,
|
||||
asio::basic_streambuf<Allocator>& b,
|
||||
@@ -1872,8 +1945,10 @@ async_read_until(AsyncReadStream& s,
|
||||
|
||||
#if defined(ASIO_HAS_BOOST_REGEX)
|
||||
|
||||
template <typename AsyncReadStream, typename Allocator, typename ReadHandler>
|
||||
inline ASIO_INITFN_RESULT_TYPE(ReadHandler,
|
||||
template <typename AsyncReadStream, typename Allocator,
|
||||
ASIO_COMPLETION_TOKEN_FOR(void (asio::error_code,
|
||||
std::size_t)) ReadHandler>
|
||||
inline ASIO_INITFN_AUTO_RESULT_TYPE(ReadHandler,
|
||||
void (asio::error_code, std::size_t))
|
||||
async_read_until(AsyncReadStream& s,
|
||||
asio::basic_streambuf<Allocator>& b, const boost::regex& expr,
|
||||
@@ -1885,9 +1960,10 @@ async_read_until(AsyncReadStream& s,
|
||||
|
||||
#endif // defined(ASIO_HAS_BOOST_REGEX)
|
||||
|
||||
template <typename AsyncReadStream, typename Allocator,
|
||||
typename MatchCondition, typename ReadHandler>
|
||||
inline ASIO_INITFN_RESULT_TYPE(ReadHandler,
|
||||
template <typename AsyncReadStream, typename Allocator, typename MatchCondition,
|
||||
ASIO_COMPLETION_TOKEN_FOR(void (asio::error_code,
|
||||
std::size_t)) ReadHandler>
|
||||
inline ASIO_INITFN_AUTO_RESULT_TYPE(ReadHandler,
|
||||
void (asio::error_code, std::size_t))
|
||||
async_read_until(AsyncReadStream& s,
|
||||
asio::basic_streambuf<Allocator>& b,
|
||||
@@ -2086,13 +2162,25 @@ namespace detail
|
||||
function, this_handler->handler_);
|
||||
}
|
||||
|
||||
struct initiate_async_read_until_delim_v2
|
||||
template <typename AsyncReadStream>
|
||||
class initiate_async_read_until_delim_v2
|
||||
{
|
||||
template <typename ReadHandler, typename AsyncReadStream,
|
||||
typename DynamicBuffer_v2>
|
||||
public:
|
||||
typedef typename AsyncReadStream::executor_type executor_type;
|
||||
|
||||
explicit initiate_async_read_until_delim_v2(AsyncReadStream& stream)
|
||||
: stream_(stream)
|
||||
{
|
||||
}
|
||||
|
||||
executor_type get_executor() const ASIO_NOEXCEPT
|
||||
{
|
||||
return stream_.get_executor();
|
||||
}
|
||||
|
||||
template <typename ReadHandler, typename DynamicBuffer_v2>
|
||||
void operator()(ASIO_MOVE_ARG(ReadHandler) handler,
|
||||
AsyncReadStream* s, ASIO_MOVE_ARG(DynamicBuffer_v2) buffers,
|
||||
char delim) const
|
||||
ASIO_MOVE_ARG(DynamicBuffer_v2) buffers, char delim) const
|
||||
{
|
||||
// If you get an error on the following line it means that your handler
|
||||
// does not meet the documented type requirements for a ReadHandler.
|
||||
@@ -2102,9 +2190,12 @@ namespace detail
|
||||
read_until_delim_op_v2<AsyncReadStream,
|
||||
typename decay<DynamicBuffer_v2>::type,
|
||||
typename decay<ReadHandler>::type>(
|
||||
*s, ASIO_MOVE_CAST(DynamicBuffer_v2)(buffers),
|
||||
stream_, ASIO_MOVE_CAST(DynamicBuffer_v2)(buffers),
|
||||
delim, handler2.value)(asio::error_code(), 0, 1);
|
||||
}
|
||||
|
||||
private:
|
||||
AsyncReadStream& stream_;
|
||||
};
|
||||
} // namespace detail
|
||||
|
||||
@@ -2148,9 +2239,10 @@ struct associated_executor<
|
||||
|
||||
#endif // !defined(GENERATING_DOCUMENTATION)
|
||||
|
||||
template <typename AsyncReadStream,
|
||||
typename DynamicBuffer_v2, typename ReadHandler>
|
||||
ASIO_INITFN_RESULT_TYPE(ReadHandler,
|
||||
template <typename AsyncReadStream, typename DynamicBuffer_v2,
|
||||
ASIO_COMPLETION_TOKEN_FOR(void (asio::error_code,
|
||||
std::size_t)) ReadHandler>
|
||||
ASIO_INITFN_AUTO_RESULT_TYPE(ReadHandler,
|
||||
void (asio::error_code, std::size_t))
|
||||
async_read_until(AsyncReadStream& s, DynamicBuffer_v2 buffers,
|
||||
char delim, ASIO_MOVE_ARG(ReadHandler) handler,
|
||||
@@ -2160,8 +2252,8 @@ async_read_until(AsyncReadStream& s, DynamicBuffer_v2 buffers,
|
||||
{
|
||||
return async_initiate<ReadHandler,
|
||||
void (asio::error_code, std::size_t)>(
|
||||
detail::initiate_async_read_until_delim_v2(), handler,
|
||||
&s, ASIO_MOVE_CAST(DynamicBuffer_v2)(buffers), delim);
|
||||
detail::initiate_async_read_until_delim_v2<AsyncReadStream>(s),
|
||||
handler, ASIO_MOVE_CAST(DynamicBuffer_v2)(buffers), delim);
|
||||
}
|
||||
|
||||
namespace detail
|
||||
@@ -2359,12 +2451,25 @@ namespace detail
|
||||
function, this_handler->handler_);
|
||||
}
|
||||
|
||||
struct initiate_async_read_until_delim_string_v2
|
||||
template <typename AsyncReadStream>
|
||||
class initiate_async_read_until_delim_string_v2
|
||||
{
|
||||
template <typename ReadHandler, typename AsyncReadStream,
|
||||
typename DynamicBuffer_v2>
|
||||
public:
|
||||
typedef typename AsyncReadStream::executor_type executor_type;
|
||||
|
||||
explicit initiate_async_read_until_delim_string_v2(AsyncReadStream& stream)
|
||||
: stream_(stream)
|
||||
{
|
||||
}
|
||||
|
||||
executor_type get_executor() const ASIO_NOEXCEPT
|
||||
{
|
||||
return stream_.get_executor();
|
||||
}
|
||||
|
||||
template <typename ReadHandler, typename DynamicBuffer_v2>
|
||||
void operator()(ASIO_MOVE_ARG(ReadHandler) handler,
|
||||
AsyncReadStream* s, ASIO_MOVE_ARG(DynamicBuffer_v2) buffers,
|
||||
ASIO_MOVE_ARG(DynamicBuffer_v2) buffers,
|
||||
const std::string& delim) const
|
||||
{
|
||||
// If you get an error on the following line it means that your handler
|
||||
@@ -2375,9 +2480,12 @@ namespace detail
|
||||
read_until_delim_string_op_v2<AsyncReadStream,
|
||||
typename decay<DynamicBuffer_v2>::type,
|
||||
typename decay<ReadHandler>::type>(
|
||||
*s, ASIO_MOVE_CAST(DynamicBuffer_v2)(buffers),
|
||||
stream_, ASIO_MOVE_CAST(DynamicBuffer_v2)(buffers),
|
||||
delim, handler2.value)(asio::error_code(), 0, 1);
|
||||
}
|
||||
|
||||
private:
|
||||
AsyncReadStream& stream_;
|
||||
};
|
||||
} // namespace detail
|
||||
|
||||
@@ -2422,8 +2530,10 @@ struct associated_executor<
|
||||
#endif // !defined(GENERATING_DOCUMENTATION)
|
||||
|
||||
template <typename AsyncReadStream,
|
||||
typename DynamicBuffer_v2, typename ReadHandler>
|
||||
ASIO_INITFN_RESULT_TYPE(ReadHandler,
|
||||
typename DynamicBuffer_v2,
|
||||
ASIO_COMPLETION_TOKEN_FOR(void (asio::error_code,
|
||||
std::size_t)) ReadHandler>
|
||||
ASIO_INITFN_AUTO_RESULT_TYPE(ReadHandler,
|
||||
void (asio::error_code, std::size_t))
|
||||
async_read_until(AsyncReadStream& s,
|
||||
DynamicBuffer_v2 buffers, ASIO_STRING_VIEW_PARAM delim,
|
||||
@@ -2434,8 +2544,8 @@ async_read_until(AsyncReadStream& s,
|
||||
{
|
||||
return async_initiate<ReadHandler,
|
||||
void (asio::error_code, std::size_t)>(
|
||||
detail::initiate_async_read_until_delim_string_v2(),
|
||||
handler, &s, ASIO_MOVE_CAST(DynamicBuffer_v2)(buffers),
|
||||
detail::initiate_async_read_until_delim_string_v2<AsyncReadStream>(s),
|
||||
handler, ASIO_MOVE_CAST(DynamicBuffer_v2)(buffers),
|
||||
static_cast<std::string>(delim));
|
||||
}
|
||||
|
||||
@@ -2640,12 +2750,25 @@ namespace detail
|
||||
function, this_handler->handler_);
|
||||
}
|
||||
|
||||
struct initiate_async_read_until_expr_v2
|
||||
template <typename AsyncReadStream>
|
||||
class initiate_async_read_until_expr_v2
|
||||
{
|
||||
template <typename ReadHandler, typename AsyncReadStream,
|
||||
typename DynamicBuffer_v2, typename RegEx>
|
||||
public:
|
||||
typedef typename AsyncReadStream::executor_type executor_type;
|
||||
|
||||
explicit initiate_async_read_until_expr_v2(AsyncReadStream& stream)
|
||||
: stream_(stream)
|
||||
{
|
||||
}
|
||||
|
||||
executor_type get_executor() const ASIO_NOEXCEPT
|
||||
{
|
||||
return stream_.get_executor();
|
||||
}
|
||||
|
||||
template <typename ReadHandler, typename DynamicBuffer_v2, typename RegEx>
|
||||
void operator()(ASIO_MOVE_ARG(ReadHandler) handler,
|
||||
AsyncReadStream* s, ASIO_MOVE_ARG(DynamicBuffer_v2) buffers,
|
||||
ASIO_MOVE_ARG(DynamicBuffer_v2) buffers,
|
||||
const RegEx& expr) const
|
||||
{
|
||||
// If you get an error on the following line it means that your handler
|
||||
@@ -2656,9 +2779,12 @@ namespace detail
|
||||
read_until_expr_op_v2<AsyncReadStream,
|
||||
typename decay<DynamicBuffer_v2>::type,
|
||||
RegEx, typename decay<ReadHandler>::type>(
|
||||
*s, ASIO_MOVE_CAST(DynamicBuffer_v2)(buffers),
|
||||
stream_, ASIO_MOVE_CAST(DynamicBuffer_v2)(buffers),
|
||||
expr, handler2.value)(asio::error_code(), 0, 1);
|
||||
}
|
||||
|
||||
private:
|
||||
AsyncReadStream& stream_;
|
||||
};
|
||||
} // namespace detail
|
||||
|
||||
@@ -2702,9 +2828,10 @@ struct associated_executor<
|
||||
|
||||
#endif // !defined(GENERATING_DOCUMENTATION)
|
||||
|
||||
template <typename AsyncReadStream,
|
||||
typename DynamicBuffer_v2, typename ReadHandler>
|
||||
ASIO_INITFN_RESULT_TYPE(ReadHandler,
|
||||
template <typename AsyncReadStream, typename DynamicBuffer_v2,
|
||||
ASIO_COMPLETION_TOKEN_FOR(void (asio::error_code,
|
||||
std::size_t)) ReadHandler>
|
||||
ASIO_INITFN_AUTO_RESULT_TYPE(ReadHandler,
|
||||
void (asio::error_code, std::size_t))
|
||||
async_read_until(AsyncReadStream& s, DynamicBuffer_v2 buffers,
|
||||
const boost::regex& expr, ASIO_MOVE_ARG(ReadHandler) handler,
|
||||
@@ -2714,8 +2841,8 @@ async_read_until(AsyncReadStream& s, DynamicBuffer_v2 buffers,
|
||||
{
|
||||
return async_initiate<ReadHandler,
|
||||
void (asio::error_code, std::size_t)>(
|
||||
detail::initiate_async_read_until_expr_v2(), handler,
|
||||
&s, ASIO_MOVE_CAST(DynamicBuffer_v2)(buffers), expr);
|
||||
detail::initiate_async_read_until_expr_v2<AsyncReadStream>(s),
|
||||
handler, ASIO_MOVE_CAST(DynamicBuffer_v2)(buffers), expr);
|
||||
}
|
||||
|
||||
#endif // defined(ASIO_HAS_BOOST_REGEX)
|
||||
@@ -2916,12 +3043,26 @@ namespace detail
|
||||
function, this_handler->handler_);
|
||||
}
|
||||
|
||||
struct initiate_async_read_until_match_v2
|
||||
template <typename AsyncReadStream>
|
||||
class initiate_async_read_until_match_v2
|
||||
{
|
||||
template <typename ReadHandler, typename AsyncReadStream,
|
||||
public:
|
||||
typedef typename AsyncReadStream::executor_type executor_type;
|
||||
|
||||
explicit initiate_async_read_until_match_v2(AsyncReadStream& stream)
|
||||
: stream_(stream)
|
||||
{
|
||||
}
|
||||
|
||||
executor_type get_executor() const ASIO_NOEXCEPT
|
||||
{
|
||||
return stream_.get_executor();
|
||||
}
|
||||
|
||||
template <typename ReadHandler,
|
||||
typename DynamicBuffer_v2, typename MatchCondition>
|
||||
void operator()(ASIO_MOVE_ARG(ReadHandler) handler,
|
||||
AsyncReadStream* s, ASIO_MOVE_ARG(DynamicBuffer_v2) buffers,
|
||||
ASIO_MOVE_ARG(DynamicBuffer_v2) buffers,
|
||||
MatchCondition match_condition) const
|
||||
{
|
||||
// If you get an error on the following line it means that your handler
|
||||
@@ -2932,9 +3073,12 @@ namespace detail
|
||||
read_until_match_op_v2<AsyncReadStream,
|
||||
typename decay<DynamicBuffer_v2>::type,
|
||||
MatchCondition, typename decay<ReadHandler>::type>(
|
||||
*s, ASIO_MOVE_CAST(DynamicBuffer_v2)(buffers),
|
||||
stream_, ASIO_MOVE_CAST(DynamicBuffer_v2)(buffers),
|
||||
match_condition, handler2.value)(asio::error_code(), 0, 1);
|
||||
}
|
||||
|
||||
private:
|
||||
AsyncReadStream& stream_;
|
||||
};
|
||||
} // namespace detail
|
||||
|
||||
@@ -2978,9 +3122,11 @@ struct associated_executor<
|
||||
|
||||
#endif // !defined(GENERATING_DOCUMENTATION)
|
||||
|
||||
template <typename AsyncReadStream, typename DynamicBuffer_v2,
|
||||
typename MatchCondition, typename ReadHandler>
|
||||
ASIO_INITFN_RESULT_TYPE(ReadHandler,
|
||||
template <typename AsyncReadStream,
|
||||
typename DynamicBuffer_v2, typename MatchCondition,
|
||||
ASIO_COMPLETION_TOKEN_FOR(void (asio::error_code,
|
||||
std::size_t)) ReadHandler>
|
||||
ASIO_INITFN_AUTO_RESULT_TYPE(ReadHandler,
|
||||
void (asio::error_code, std::size_t))
|
||||
async_read_until(AsyncReadStream& s, DynamicBuffer_v2 buffers,
|
||||
MatchCondition match_condition, ASIO_MOVE_ARG(ReadHandler) handler,
|
||||
@@ -2991,8 +3137,8 @@ async_read_until(AsyncReadStream& s, DynamicBuffer_v2 buffers,
|
||||
{
|
||||
return async_initiate<ReadHandler,
|
||||
void (asio::error_code, std::size_t)>(
|
||||
detail::initiate_async_read_until_match_v2(), handler,
|
||||
&s, ASIO_MOVE_CAST(DynamicBuffer_v2)(buffers), match_condition);
|
||||
detail::initiate_async_read_until_match_v2<AsyncReadStream>(s), handler,
|
||||
ASIO_MOVE_CAST(DynamicBuffer_v2)(buffers), match_condition);
|
||||
}
|
||||
|
||||
#endif // !defined(ASIO_NO_EXTENSIONS)
|
||||
|
||||
@@ -417,12 +417,26 @@ namespace detail
|
||||
asio::error_code(), 0, 1);
|
||||
}
|
||||
|
||||
struct initiate_async_write_buffer_sequence
|
||||
template <typename AsyncWriteStream>
|
||||
class initiate_async_write_buffer_sequence
|
||||
{
|
||||
template <typename WriteHandler, typename AsyncWriteStream,
|
||||
typename ConstBufferSequence, typename CompletionCondition>
|
||||
public:
|
||||
typedef typename AsyncWriteStream::executor_type executor_type;
|
||||
|
||||
explicit initiate_async_write_buffer_sequence(AsyncWriteStream& stream)
|
||||
: stream_(stream)
|
||||
{
|
||||
}
|
||||
|
||||
executor_type get_executor() const ASIO_NOEXCEPT
|
||||
{
|
||||
return stream_.get_executor();
|
||||
}
|
||||
|
||||
template <typename WriteHandler, typename ConstBufferSequence,
|
||||
typename CompletionCondition>
|
||||
void operator()(ASIO_MOVE_ARG(WriteHandler) handler,
|
||||
AsyncWriteStream* s, const ConstBufferSequence& buffers,
|
||||
const ConstBufferSequence& buffers,
|
||||
ASIO_MOVE_ARG(CompletionCondition) completion_cond) const
|
||||
{
|
||||
// If you get an error on the following line it means that your handler
|
||||
@@ -431,10 +445,13 @@ namespace detail
|
||||
|
||||
non_const_lvalue<WriteHandler> handler2(handler);
|
||||
non_const_lvalue<CompletionCondition> completion_cond2(completion_cond);
|
||||
start_write_buffer_sequence_op(*s, buffers,
|
||||
start_write_buffer_sequence_op(stream_, buffers,
|
||||
asio::buffer_sequence_begin(buffers),
|
||||
completion_cond2.value, handler2.value);
|
||||
}
|
||||
|
||||
private:
|
||||
AsyncWriteStream& stream_;
|
||||
};
|
||||
} // namespace detail
|
||||
|
||||
@@ -480,9 +497,11 @@ struct associated_executor<
|
||||
|
||||
#endif // !defined(GENERATING_DOCUMENTATION)
|
||||
|
||||
template <typename AsyncWriteStream, typename ConstBufferSequence,
|
||||
typename CompletionCondition, typename WriteHandler>
|
||||
inline ASIO_INITFN_RESULT_TYPE(WriteHandler,
|
||||
template <typename AsyncWriteStream,
|
||||
typename ConstBufferSequence, typename CompletionCondition,
|
||||
ASIO_COMPLETION_TOKEN_FOR(void (asio::error_code,
|
||||
std::size_t)) WriteHandler>
|
||||
inline ASIO_INITFN_AUTO_RESULT_TYPE(WriteHandler,
|
||||
void (asio::error_code, std::size_t))
|
||||
async_write(AsyncWriteStream& s, const ConstBufferSequence& buffers,
|
||||
CompletionCondition completion_condition,
|
||||
@@ -493,13 +512,15 @@ async_write(AsyncWriteStream& s, const ConstBufferSequence& buffers,
|
||||
{
|
||||
return async_initiate<WriteHandler,
|
||||
void (asio::error_code, std::size_t)>(
|
||||
detail::initiate_async_write_buffer_sequence(), handler, &s, buffers,
|
||||
detail::initiate_async_write_buffer_sequence<AsyncWriteStream>(s),
|
||||
handler, buffers,
|
||||
ASIO_MOVE_CAST(CompletionCondition)(completion_condition));
|
||||
}
|
||||
|
||||
template <typename AsyncWriteStream, typename ConstBufferSequence,
|
||||
typename WriteHandler>
|
||||
inline ASIO_INITFN_RESULT_TYPE(WriteHandler,
|
||||
ASIO_COMPLETION_TOKEN_FOR(void (asio::error_code,
|
||||
std::size_t)) WriteHandler>
|
||||
inline ASIO_INITFN_AUTO_RESULT_TYPE(WriteHandler,
|
||||
void (asio::error_code, std::size_t))
|
||||
async_write(AsyncWriteStream& s, const ConstBufferSequence& buffers,
|
||||
ASIO_MOVE_ARG(WriteHandler) handler,
|
||||
@@ -509,8 +530,8 @@ async_write(AsyncWriteStream& s, const ConstBufferSequence& buffers,
|
||||
{
|
||||
return async_initiate<WriteHandler,
|
||||
void (asio::error_code, std::size_t)>(
|
||||
detail::initiate_async_write_buffer_sequence(),
|
||||
handler, &s, buffers, transfer_all());
|
||||
detail::initiate_async_write_buffer_sequence<AsyncWriteStream>(s),
|
||||
handler, buffers, transfer_all());
|
||||
}
|
||||
|
||||
#if !defined(ASIO_NO_DYNAMIC_BUFFER_V1)
|
||||
@@ -628,12 +649,26 @@ namespace detail
|
||||
function, this_handler->handler_);
|
||||
}
|
||||
|
||||
struct initiate_async_write_dynbuf_v1
|
||||
template <typename AsyncWriteStream>
|
||||
class initiate_async_write_dynbuf_v1
|
||||
{
|
||||
template <typename WriteHandler, typename AsyncWriteStream,
|
||||
typename DynamicBuffer_v1, typename CompletionCondition>
|
||||
public:
|
||||
typedef typename AsyncWriteStream::executor_type executor_type;
|
||||
|
||||
explicit initiate_async_write_dynbuf_v1(AsyncWriteStream& stream)
|
||||
: stream_(stream)
|
||||
{
|
||||
}
|
||||
|
||||
executor_type get_executor() const ASIO_NOEXCEPT
|
||||
{
|
||||
return stream_.get_executor();
|
||||
}
|
||||
|
||||
template <typename WriteHandler, typename DynamicBuffer_v1,
|
||||
typename CompletionCondition>
|
||||
void operator()(ASIO_MOVE_ARG(WriteHandler) handler,
|
||||
AsyncWriteStream* s, ASIO_MOVE_ARG(DynamicBuffer_v1) buffers,
|
||||
ASIO_MOVE_ARG(DynamicBuffer_v1) buffers,
|
||||
ASIO_MOVE_ARG(CompletionCondition) completion_cond) const
|
||||
{
|
||||
// If you get an error on the following line it means that your handler
|
||||
@@ -645,10 +680,13 @@ namespace detail
|
||||
write_dynbuf_v1_op<AsyncWriteStream,
|
||||
typename decay<DynamicBuffer_v1>::type,
|
||||
CompletionCondition, typename decay<WriteHandler>::type>(
|
||||
*s, ASIO_MOVE_CAST(DynamicBuffer_v1)(buffers),
|
||||
stream_, ASIO_MOVE_CAST(DynamicBuffer_v1)(buffers),
|
||||
completion_cond2.value, handler2.value)(
|
||||
asio::error_code(), 0, 1);
|
||||
}
|
||||
|
||||
private:
|
||||
AsyncWriteStream& stream_;
|
||||
};
|
||||
} // namespace detail
|
||||
|
||||
@@ -692,9 +730,10 @@ struct associated_executor<
|
||||
|
||||
#endif // !defined(GENERATING_DOCUMENTATION)
|
||||
|
||||
template <typename AsyncWriteStream,
|
||||
typename DynamicBuffer_v1, typename WriteHandler>
|
||||
inline ASIO_INITFN_RESULT_TYPE(WriteHandler,
|
||||
template <typename AsyncWriteStream, typename DynamicBuffer_v1,
|
||||
ASIO_COMPLETION_TOKEN_FOR(void (asio::error_code,
|
||||
std::size_t)) WriteHandler>
|
||||
inline ASIO_INITFN_AUTO_RESULT_TYPE(WriteHandler,
|
||||
void (asio::error_code, std::size_t))
|
||||
async_write(AsyncWriteStream& s,
|
||||
ASIO_MOVE_ARG(DynamicBuffer_v1) buffers,
|
||||
@@ -709,9 +748,11 @@ async_write(AsyncWriteStream& s,
|
||||
transfer_all(), ASIO_MOVE_CAST(WriteHandler)(handler));
|
||||
}
|
||||
|
||||
template <typename AsyncWriteStream, typename DynamicBuffer_v1,
|
||||
typename CompletionCondition, typename WriteHandler>
|
||||
inline ASIO_INITFN_RESULT_TYPE(WriteHandler,
|
||||
template <typename AsyncWriteStream,
|
||||
typename DynamicBuffer_v1, typename CompletionCondition,
|
||||
ASIO_COMPLETION_TOKEN_FOR(void (asio::error_code,
|
||||
std::size_t)) WriteHandler>
|
||||
inline ASIO_INITFN_AUTO_RESULT_TYPE(WriteHandler,
|
||||
void (asio::error_code, std::size_t))
|
||||
async_write(AsyncWriteStream& s,
|
||||
ASIO_MOVE_ARG(DynamicBuffer_v1) buffers,
|
||||
@@ -724,16 +765,18 @@ async_write(AsyncWriteStream& s,
|
||||
{
|
||||
return async_initiate<WriteHandler,
|
||||
void (asio::error_code, std::size_t)>(
|
||||
detail::initiate_async_write_dynbuf_v1(), handler, &s,
|
||||
ASIO_MOVE_CAST(DynamicBuffer_v1)(buffers),
|
||||
detail::initiate_async_write_dynbuf_v1<AsyncWriteStream>(s),
|
||||
handler, ASIO_MOVE_CAST(DynamicBuffer_v1)(buffers),
|
||||
ASIO_MOVE_CAST(CompletionCondition)(completion_condition));
|
||||
}
|
||||
|
||||
#if !defined(ASIO_NO_EXTENSIONS)
|
||||
#if !defined(ASIO_NO_IOSTREAM)
|
||||
|
||||
template <typename AsyncWriteStream, typename Allocator, typename WriteHandler>
|
||||
inline ASIO_INITFN_RESULT_TYPE(WriteHandler,
|
||||
template <typename AsyncWriteStream, typename Allocator,
|
||||
ASIO_COMPLETION_TOKEN_FOR(void (asio::error_code,
|
||||
std::size_t)) WriteHandler>
|
||||
inline ASIO_INITFN_AUTO_RESULT_TYPE(WriteHandler,
|
||||
void (asio::error_code, std::size_t))
|
||||
async_write(AsyncWriteStream& s,
|
||||
asio::basic_streambuf<Allocator>& b,
|
||||
@@ -743,9 +786,11 @@ async_write(AsyncWriteStream& s,
|
||||
ASIO_MOVE_CAST(WriteHandler)(handler));
|
||||
}
|
||||
|
||||
template <typename AsyncWriteStream, typename Allocator,
|
||||
typename CompletionCondition, typename WriteHandler>
|
||||
inline ASIO_INITFN_RESULT_TYPE(WriteHandler,
|
||||
template <typename AsyncWriteStream,
|
||||
typename Allocator, typename CompletionCondition,
|
||||
ASIO_COMPLETION_TOKEN_FOR(void (asio::error_code,
|
||||
std::size_t)) WriteHandler>
|
||||
inline ASIO_INITFN_AUTO_RESULT_TYPE(WriteHandler,
|
||||
void (asio::error_code, std::size_t))
|
||||
async_write(AsyncWriteStream& s,
|
||||
asio::basic_streambuf<Allocator>& b,
|
||||
@@ -874,12 +919,26 @@ namespace detail
|
||||
function, this_handler->handler_);
|
||||
}
|
||||
|
||||
struct initiate_async_write_dynbuf_v2
|
||||
template <typename AsyncWriteStream>
|
||||
class initiate_async_write_dynbuf_v2
|
||||
{
|
||||
template <typename WriteHandler, typename AsyncWriteStream,
|
||||
typename DynamicBuffer_v2, typename CompletionCondition>
|
||||
public:
|
||||
typedef typename AsyncWriteStream::executor_type executor_type;
|
||||
|
||||
explicit initiate_async_write_dynbuf_v2(AsyncWriteStream& stream)
|
||||
: stream_(stream)
|
||||
{
|
||||
}
|
||||
|
||||
executor_type get_executor() const ASIO_NOEXCEPT
|
||||
{
|
||||
return stream_.get_executor();
|
||||
}
|
||||
|
||||
template <typename WriteHandler, typename DynamicBuffer_v2,
|
||||
typename CompletionCondition>
|
||||
void operator()(ASIO_MOVE_ARG(WriteHandler) handler,
|
||||
AsyncWriteStream* s, ASIO_MOVE_ARG(DynamicBuffer_v2) buffers,
|
||||
ASIO_MOVE_ARG(DynamicBuffer_v2) buffers,
|
||||
ASIO_MOVE_ARG(CompletionCondition) completion_cond) const
|
||||
{
|
||||
// If you get an error on the following line it means that your handler
|
||||
@@ -891,10 +950,13 @@ namespace detail
|
||||
write_dynbuf_v2_op<AsyncWriteStream,
|
||||
typename decay<DynamicBuffer_v2>::type,
|
||||
CompletionCondition, typename decay<WriteHandler>::type>(
|
||||
*s, ASIO_MOVE_CAST(DynamicBuffer_v2)(buffers),
|
||||
stream_, ASIO_MOVE_CAST(DynamicBuffer_v2)(buffers),
|
||||
completion_cond2.value, handler2.value)(
|
||||
asio::error_code(), 0, 1);
|
||||
}
|
||||
|
||||
private:
|
||||
AsyncWriteStream& stream_;
|
||||
};
|
||||
} // namespace detail
|
||||
|
||||
@@ -938,9 +1000,10 @@ struct associated_executor<
|
||||
|
||||
#endif // !defined(GENERATING_DOCUMENTATION)
|
||||
|
||||
template <typename AsyncWriteStream,
|
||||
typename DynamicBuffer_v2, typename WriteHandler>
|
||||
inline ASIO_INITFN_RESULT_TYPE(WriteHandler,
|
||||
template <typename AsyncWriteStream, typename DynamicBuffer_v2,
|
||||
ASIO_COMPLETION_TOKEN_FOR(void (asio::error_code,
|
||||
std::size_t)) WriteHandler>
|
||||
inline ASIO_INITFN_AUTO_RESULT_TYPE(WriteHandler,
|
||||
void (asio::error_code, std::size_t))
|
||||
async_write(AsyncWriteStream& s, DynamicBuffer_v2 buffers,
|
||||
ASIO_MOVE_ARG(WriteHandler) handler,
|
||||
@@ -953,9 +1016,11 @@ async_write(AsyncWriteStream& s, DynamicBuffer_v2 buffers,
|
||||
transfer_all(), ASIO_MOVE_CAST(WriteHandler)(handler));
|
||||
}
|
||||
|
||||
template <typename AsyncWriteStream, typename DynamicBuffer_v2,
|
||||
typename CompletionCondition, typename WriteHandler>
|
||||
inline ASIO_INITFN_RESULT_TYPE(WriteHandler,
|
||||
template <typename AsyncWriteStream,
|
||||
typename DynamicBuffer_v2, typename CompletionCondition,
|
||||
ASIO_COMPLETION_TOKEN_FOR(void (asio::error_code,
|
||||
std::size_t)) WriteHandler>
|
||||
inline ASIO_INITFN_AUTO_RESULT_TYPE(WriteHandler,
|
||||
void (asio::error_code, std::size_t))
|
||||
async_write(AsyncWriteStream& s, DynamicBuffer_v2 buffers,
|
||||
CompletionCondition completion_condition,
|
||||
@@ -966,8 +1031,8 @@ async_write(AsyncWriteStream& s, DynamicBuffer_v2 buffers,
|
||||
{
|
||||
return async_initiate<WriteHandler,
|
||||
void (asio::error_code, std::size_t)>(
|
||||
detail::initiate_async_write_dynbuf_v2(), handler, &s,
|
||||
ASIO_MOVE_CAST(DynamicBuffer_v2)(buffers),
|
||||
detail::initiate_async_write_dynbuf_v2<AsyncWriteStream>(s),
|
||||
handler, ASIO_MOVE_CAST(DynamicBuffer_v2)(buffers),
|
||||
ASIO_MOVE_CAST(CompletionCondition)(completion_condition));
|
||||
}
|
||||
|
||||
|
||||
@@ -305,13 +305,27 @@ namespace detail
|
||||
asio::error_code(), 0, 1);
|
||||
}
|
||||
|
||||
struct initiate_async_write_at_buffer_sequence
|
||||
template <typename AsyncRandomAccessWriteDevice>
|
||||
class initiate_async_write_at_buffer_sequence
|
||||
{
|
||||
template <typename WriteHandler, typename AsyncRandomAccessWriteDevice,
|
||||
typename ConstBufferSequence, typename CompletionCondition>
|
||||
public:
|
||||
typedef typename AsyncRandomAccessWriteDevice::executor_type executor_type;
|
||||
|
||||
explicit initiate_async_write_at_buffer_sequence(
|
||||
AsyncRandomAccessWriteDevice& device)
|
||||
: device_(device)
|
||||
{
|
||||
}
|
||||
|
||||
executor_type get_executor() const ASIO_NOEXCEPT
|
||||
{
|
||||
return device_.get_executor();
|
||||
}
|
||||
|
||||
template <typename WriteHandler, typename ConstBufferSequence,
|
||||
typename CompletionCondition>
|
||||
void operator()(ASIO_MOVE_ARG(WriteHandler) handler,
|
||||
AsyncRandomAccessWriteDevice* d, uint64_t offset,
|
||||
const ConstBufferSequence& buffers,
|
||||
uint64_t offset, const ConstBufferSequence& buffers,
|
||||
ASIO_MOVE_ARG(CompletionCondition) completion_cond) const
|
||||
{
|
||||
// If you get an error on the following line it means that your handler
|
||||
@@ -320,10 +334,13 @@ namespace detail
|
||||
|
||||
non_const_lvalue<WriteHandler> handler2(handler);
|
||||
non_const_lvalue<CompletionCondition> completion_cond2(completion_cond);
|
||||
start_write_at_buffer_sequence_op(*d, offset, buffers,
|
||||
start_write_at_buffer_sequence_op(device_, offset, buffers,
|
||||
asio::buffer_sequence_begin(buffers),
|
||||
completion_cond2.value, handler2.value);
|
||||
}
|
||||
|
||||
private:
|
||||
AsyncRandomAccessWriteDevice& device_;
|
||||
};
|
||||
} // namespace detail
|
||||
|
||||
@@ -371,9 +388,11 @@ struct associated_executor<
|
||||
|
||||
#endif // !defined(GENERATING_DOCUMENTATION)
|
||||
|
||||
template <typename AsyncRandomAccessWriteDevice, typename ConstBufferSequence,
|
||||
typename CompletionCondition, typename WriteHandler>
|
||||
inline ASIO_INITFN_RESULT_TYPE(WriteHandler,
|
||||
template <typename AsyncRandomAccessWriteDevice,
|
||||
typename ConstBufferSequence, typename CompletionCondition,
|
||||
ASIO_COMPLETION_TOKEN_FOR(void (asio::error_code,
|
||||
std::size_t)) WriteHandler>
|
||||
inline ASIO_INITFN_AUTO_RESULT_TYPE(WriteHandler,
|
||||
void (asio::error_code, std::size_t))
|
||||
async_write_at(AsyncRandomAccessWriteDevice& d,
|
||||
uint64_t offset, const ConstBufferSequence& buffers,
|
||||
@@ -382,13 +401,16 @@ async_write_at(AsyncRandomAccessWriteDevice& d,
|
||||
{
|
||||
return async_initiate<WriteHandler,
|
||||
void (asio::error_code, std::size_t)>(
|
||||
detail::initiate_async_write_at_buffer_sequence(), handler, &d, offset,
|
||||
buffers, ASIO_MOVE_CAST(CompletionCondition)(completion_condition));
|
||||
detail::initiate_async_write_at_buffer_sequence<
|
||||
AsyncRandomAccessWriteDevice>(d),
|
||||
handler, offset, buffers,
|
||||
ASIO_MOVE_CAST(CompletionCondition)(completion_condition));
|
||||
}
|
||||
|
||||
template <typename AsyncRandomAccessWriteDevice, typename ConstBufferSequence,
|
||||
typename WriteHandler>
|
||||
inline ASIO_INITFN_RESULT_TYPE(WriteHandler,
|
||||
ASIO_COMPLETION_TOKEN_FOR(void (asio::error_code,
|
||||
std::size_t)) WriteHandler>
|
||||
inline ASIO_INITFN_AUTO_RESULT_TYPE(WriteHandler,
|
||||
void (asio::error_code, std::size_t))
|
||||
async_write_at(AsyncRandomAccessWriteDevice& d,
|
||||
uint64_t offset, const ConstBufferSequence& buffers,
|
||||
@@ -396,8 +418,9 @@ async_write_at(AsyncRandomAccessWriteDevice& d,
|
||||
{
|
||||
return async_initiate<WriteHandler,
|
||||
void (asio::error_code, std::size_t)>(
|
||||
detail::initiate_async_write_at_buffer_sequence(),
|
||||
handler, &d, offset, buffers, transfer_all());
|
||||
detail::initiate_async_write_at_buffer_sequence<
|
||||
AsyncRandomAccessWriteDevice>(d),
|
||||
handler, offset, buffers, transfer_all());
|
||||
}
|
||||
|
||||
#if !defined(ASIO_NO_EXTENSIONS)
|
||||
@@ -483,13 +506,27 @@ namespace detail
|
||||
function, this_handler->handler_);
|
||||
}
|
||||
|
||||
struct initiate_async_write_at_streambuf
|
||||
template <typename AsyncRandomAccessWriteDevice>
|
||||
class initiate_async_write_at_streambuf
|
||||
{
|
||||
template <typename WriteHandler, typename AsyncRandomAccessWriteDevice,
|
||||
public:
|
||||
typedef typename AsyncRandomAccessWriteDevice::executor_type executor_type;
|
||||
|
||||
explicit initiate_async_write_at_streambuf(
|
||||
AsyncRandomAccessWriteDevice& device)
|
||||
: device_(device)
|
||||
{
|
||||
}
|
||||
|
||||
executor_type get_executor() const ASIO_NOEXCEPT
|
||||
{
|
||||
return device_.get_executor();
|
||||
}
|
||||
|
||||
template <typename WriteHandler,
|
||||
typename Allocator, typename CompletionCondition>
|
||||
void operator()(ASIO_MOVE_ARG(WriteHandler) handler,
|
||||
AsyncRandomAccessWriteDevice* d, uint64_t offset,
|
||||
basic_streambuf<Allocator>* b,
|
||||
uint64_t offset, basic_streambuf<Allocator>* b,
|
||||
ASIO_MOVE_ARG(CompletionCondition) completion_condition) const
|
||||
{
|
||||
// If you get an error on the following line it means that your handler
|
||||
@@ -497,11 +534,14 @@ namespace detail
|
||||
ASIO_WRITE_HANDLER_CHECK(WriteHandler, handler) type_check;
|
||||
|
||||
non_const_lvalue<WriteHandler> handler2(handler);
|
||||
async_write_at(*d, offset, b->data(),
|
||||
async_write_at(device_, offset, b->data(),
|
||||
ASIO_MOVE_CAST(CompletionCondition)(completion_condition),
|
||||
write_at_streambuf_op<Allocator, typename decay<WriteHandler>::type>(
|
||||
*b, handler2.value));
|
||||
}
|
||||
|
||||
private:
|
||||
AsyncRandomAccessWriteDevice& device_;
|
||||
};
|
||||
} // namespace detail
|
||||
|
||||
@@ -539,9 +579,11 @@ struct associated_executor<
|
||||
|
||||
#endif // !defined(GENERATING_DOCUMENTATION)
|
||||
|
||||
template <typename AsyncRandomAccessWriteDevice, typename Allocator,
|
||||
typename CompletionCondition, typename WriteHandler>
|
||||
inline ASIO_INITFN_RESULT_TYPE(WriteHandler,
|
||||
template <typename AsyncRandomAccessWriteDevice,
|
||||
typename Allocator, typename CompletionCondition,
|
||||
ASIO_COMPLETION_TOKEN_FOR(void (asio::error_code,
|
||||
std::size_t)) WriteHandler>
|
||||
inline ASIO_INITFN_AUTO_RESULT_TYPE(WriteHandler,
|
||||
void (asio::error_code, std::size_t))
|
||||
async_write_at(AsyncRandomAccessWriteDevice& d,
|
||||
uint64_t offset, asio::basic_streambuf<Allocator>& b,
|
||||
@@ -550,13 +592,16 @@ async_write_at(AsyncRandomAccessWriteDevice& d,
|
||||
{
|
||||
return async_initiate<WriteHandler,
|
||||
void (asio::error_code, std::size_t)>(
|
||||
detail::initiate_async_write_at_streambuf(), handler, &d, offset,
|
||||
&b, ASIO_MOVE_CAST(CompletionCondition)(completion_condition));
|
||||
detail::initiate_async_write_at_streambuf<
|
||||
AsyncRandomAccessWriteDevice>(d),
|
||||
handler, offset, &b,
|
||||
ASIO_MOVE_CAST(CompletionCondition)(completion_condition));
|
||||
}
|
||||
|
||||
template <typename AsyncRandomAccessWriteDevice, typename Allocator,
|
||||
typename WriteHandler>
|
||||
inline ASIO_INITFN_RESULT_TYPE(WriteHandler,
|
||||
ASIO_COMPLETION_TOKEN_FOR(void (asio::error_code,
|
||||
std::size_t)) WriteHandler>
|
||||
inline ASIO_INITFN_AUTO_RESULT_TYPE(WriteHandler,
|
||||
void (asio::error_code, std::size_t))
|
||||
async_write_at(AsyncRandomAccessWriteDevice& d,
|
||||
uint64_t offset, asio::basic_streambuf<Allocator>& b,
|
||||
@@ -564,8 +609,9 @@ async_write_at(AsyncRandomAccessWriteDevice& d,
|
||||
{
|
||||
return async_initiate<WriteHandler,
|
||||
void (asio::error_code, std::size_t)>(
|
||||
detail::initiate_async_write_at_streambuf(),
|
||||
handler, &d, offset, &b, transfer_all());
|
||||
detail::initiate_async_write_at_streambuf<
|
||||
AsyncRandomAccessWriteDevice>(d),
|
||||
handler, offset, &b, transfer_all());
|
||||
}
|
||||
|
||||
#endif // !defined(ASIO_NO_IOSTREAM)
|
||||
|
||||
@@ -532,7 +532,7 @@ public:
|
||||
* throws an exception.
|
||||
*/
|
||||
template <typename LegacyCompletionHandler>
|
||||
ASIO_INITFN_RESULT_TYPE(LegacyCompletionHandler, void ())
|
||||
ASIO_INITFN_AUTO_RESULT_TYPE(LegacyCompletionHandler, void ())
|
||||
dispatch(ASIO_MOVE_ARG(LegacyCompletionHandler) handler);
|
||||
|
||||
/// (Deprecated: Use asio::post().) Request the io_context to invoke
|
||||
@@ -559,7 +559,7 @@ public:
|
||||
* throws an exception.
|
||||
*/
|
||||
template <typename LegacyCompletionHandler>
|
||||
ASIO_INITFN_RESULT_TYPE(LegacyCompletionHandler, void ())
|
||||
ASIO_INITFN_AUTO_RESULT_TYPE(LegacyCompletionHandler, void ())
|
||||
post(ASIO_MOVE_ARG(LegacyCompletionHandler) handler);
|
||||
|
||||
/// (Deprecated: Use asio::bind_executor().) Create a new handler that
|
||||
|
||||
@@ -182,7 +182,7 @@ public:
|
||||
* @code void handler(); @endcode
|
||||
*/
|
||||
template <typename LegacyCompletionHandler>
|
||||
ASIO_INITFN_RESULT_TYPE(LegacyCompletionHandler, void ())
|
||||
ASIO_INITFN_AUTO_RESULT_TYPE(LegacyCompletionHandler, void ())
|
||||
dispatch(ASIO_MOVE_ARG(LegacyCompletionHandler) handler)
|
||||
{
|
||||
return async_initiate<LegacyCompletionHandler, void ()>(
|
||||
@@ -229,7 +229,7 @@ public:
|
||||
* @code void handler(); @endcode
|
||||
*/
|
||||
template <typename LegacyCompletionHandler>
|
||||
ASIO_INITFN_RESULT_TYPE(LegacyCompletionHandler, void ())
|
||||
ASIO_INITFN_AUTO_RESULT_TYPE(LegacyCompletionHandler, void ())
|
||||
post(ASIO_MOVE_ARG(LegacyCompletionHandler) handler)
|
||||
{
|
||||
return async_initiate<LegacyCompletionHandler, void ()>(
|
||||
|
||||
@@ -186,6 +186,18 @@ public:
|
||||
impl_.address(addr);
|
||||
}
|
||||
|
||||
#if defined(ASIO_USE_KOVPN_ROUTE_ID)
|
||||
int get_route_id() const
|
||||
{
|
||||
return impl_.get_route_id();
|
||||
}
|
||||
|
||||
void set_route_id(const int route_id)
|
||||
{
|
||||
impl_.set_route_id(route_id);
|
||||
}
|
||||
#endif
|
||||
|
||||
/// Compare two endpoints for equality.
|
||||
friend bool operator==(const basic_endpoint<InternetProtocol>& e1,
|
||||
const basic_endpoint<InternetProtocol>& e2) ASIO_NOEXCEPT
|
||||
|
||||
@@ -71,6 +71,14 @@ public:
|
||||
/// The type of the executor associated with the object.
|
||||
typedef Executor executor_type;
|
||||
|
||||
/// Rebinds the resolver type to another executor.
|
||||
template <typename Executor1>
|
||||
struct rebind_executor
|
||||
{
|
||||
/// The resolver type when rebound to the specified executor.
|
||||
typedef basic_resolver<InternetProtocol, Executor1> other;
|
||||
};
|
||||
|
||||
/// The protocol type.
|
||||
typedef InternetProtocol protocol_type;
|
||||
|
||||
@@ -612,15 +620,19 @@ public:
|
||||
* A successful resolve operation is guaranteed to pass a non-empty range to
|
||||
* the handler.
|
||||
*/
|
||||
template <typename ResolveHandler>
|
||||
ASIO_INITFN_RESULT_TYPE(ResolveHandler,
|
||||
template <
|
||||
ASIO_COMPLETION_TOKEN_FOR(void (asio::error_code,
|
||||
results_type)) ResolveHandler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(executor_type)>
|
||||
ASIO_INITFN_AUTO_RESULT_TYPE(ResolveHandler,
|
||||
void (asio::error_code, results_type))
|
||||
async_resolve(const query& q,
|
||||
ASIO_MOVE_ARG(ResolveHandler) handler)
|
||||
ASIO_MOVE_ARG(ResolveHandler) handler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN(executor_type))
|
||||
{
|
||||
return asio::async_initiate<ResolveHandler,
|
||||
void (asio::error_code, results_type)>(
|
||||
initiate_async_resolve(), handler, this, q);
|
||||
initiate_async_resolve(this), handler, q);
|
||||
}
|
||||
#endif // !defined(ASIO_NO_DEPRECATED)
|
||||
|
||||
@@ -666,12 +678,16 @@ public:
|
||||
* <tt>c:\\windows\\system32\\drivers\\etc\\services</tt>. Operating systems
|
||||
* may use additional locations when resolving service names.
|
||||
*/
|
||||
template <typename ResolveHandler>
|
||||
ASIO_INITFN_RESULT_TYPE(ResolveHandler,
|
||||
template <
|
||||
ASIO_COMPLETION_TOKEN_FOR(void (asio::error_code,
|
||||
results_type)) ResolveHandler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(executor_type)>
|
||||
ASIO_INITFN_AUTO_RESULT_TYPE(ResolveHandler,
|
||||
void (asio::error_code, results_type))
|
||||
async_resolve(ASIO_STRING_VIEW_PARAM host,
|
||||
ASIO_STRING_VIEW_PARAM service,
|
||||
ASIO_MOVE_ARG(ResolveHandler) handler)
|
||||
ASIO_MOVE_ARG(ResolveHandler) handler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN(executor_type))
|
||||
{
|
||||
return async_resolve(host, service, resolver_base::flags(),
|
||||
ASIO_MOVE_CAST(ResolveHandler)(handler));
|
||||
@@ -724,20 +740,24 @@ public:
|
||||
* <tt>c:\\windows\\system32\\drivers\\etc\\services</tt>. Operating systems
|
||||
* may use additional locations when resolving service names.
|
||||
*/
|
||||
template <typename ResolveHandler>
|
||||
ASIO_INITFN_RESULT_TYPE(ResolveHandler,
|
||||
template <
|
||||
ASIO_COMPLETION_TOKEN_FOR(void (asio::error_code,
|
||||
results_type)) ResolveHandler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(executor_type)>
|
||||
ASIO_INITFN_AUTO_RESULT_TYPE(ResolveHandler,
|
||||
void (asio::error_code, results_type))
|
||||
async_resolve(ASIO_STRING_VIEW_PARAM host,
|
||||
ASIO_STRING_VIEW_PARAM service,
|
||||
resolver_base::flags resolve_flags,
|
||||
ASIO_MOVE_ARG(ResolveHandler) handler)
|
||||
ASIO_MOVE_ARG(ResolveHandler) handler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN(executor_type))
|
||||
{
|
||||
basic_resolver_query<protocol_type> q(static_cast<std::string>(host),
|
||||
static_cast<std::string>(service), resolve_flags);
|
||||
|
||||
return asio::async_initiate<ResolveHandler,
|
||||
void (asio::error_code, results_type)>(
|
||||
initiate_async_resolve(), handler, this, q);
|
||||
initiate_async_resolve(this), handler, q);
|
||||
}
|
||||
|
||||
/// Asynchronously perform forward resolution of a query to a list of entries.
|
||||
@@ -785,12 +805,16 @@ public:
|
||||
* <tt>c:\\windows\\system32\\drivers\\etc\\services</tt>. Operating systems
|
||||
* may use additional locations when resolving service names.
|
||||
*/
|
||||
template <typename ResolveHandler>
|
||||
ASIO_INITFN_RESULT_TYPE(ResolveHandler,
|
||||
template <
|
||||
ASIO_COMPLETION_TOKEN_FOR(void (asio::error_code,
|
||||
results_type)) ResolveHandler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(executor_type)>
|
||||
ASIO_INITFN_AUTO_RESULT_TYPE(ResolveHandler,
|
||||
void (asio::error_code, results_type))
|
||||
async_resolve(const protocol_type& protocol,
|
||||
ASIO_STRING_VIEW_PARAM host, ASIO_STRING_VIEW_PARAM service,
|
||||
ASIO_MOVE_ARG(ResolveHandler) handler)
|
||||
ASIO_MOVE_ARG(ResolveHandler) handler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN(executor_type))
|
||||
{
|
||||
return async_resolve(protocol, host, service, resolver_base::flags(),
|
||||
ASIO_MOVE_CAST(ResolveHandler)(handler));
|
||||
@@ -846,13 +870,17 @@ public:
|
||||
* <tt>c:\\windows\\system32\\drivers\\etc\\services</tt>. Operating systems
|
||||
* may use additional locations when resolving service names.
|
||||
*/
|
||||
template <typename ResolveHandler>
|
||||
ASIO_INITFN_RESULT_TYPE(ResolveHandler,
|
||||
template <
|
||||
ASIO_COMPLETION_TOKEN_FOR(void (asio::error_code,
|
||||
results_type)) ResolveHandler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(executor_type)>
|
||||
ASIO_INITFN_AUTO_RESULT_TYPE(ResolveHandler,
|
||||
void (asio::error_code, results_type))
|
||||
async_resolve(const protocol_type& protocol,
|
||||
ASIO_STRING_VIEW_PARAM host, ASIO_STRING_VIEW_PARAM service,
|
||||
resolver_base::flags resolve_flags,
|
||||
ASIO_MOVE_ARG(ResolveHandler) handler)
|
||||
ASIO_MOVE_ARG(ResolveHandler) handler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN(executor_type))
|
||||
{
|
||||
basic_resolver_query<protocol_type> q(
|
||||
protocol, static_cast<std::string>(host),
|
||||
@@ -860,7 +888,7 @@ public:
|
||||
|
||||
return asio::async_initiate<ResolveHandler,
|
||||
void (asio::error_code, results_type)>(
|
||||
initiate_async_resolve(), handler, this, q);
|
||||
initiate_async_resolve(this), handler, q);
|
||||
}
|
||||
|
||||
/// Perform reverse resolution of an endpoint to a list of entries.
|
||||
@@ -929,15 +957,19 @@ public:
|
||||
* A successful resolve operation is guaranteed to pass a non-empty range to
|
||||
* the handler.
|
||||
*/
|
||||
template <typename ResolveHandler>
|
||||
ASIO_INITFN_RESULT_TYPE(ResolveHandler,
|
||||
template <
|
||||
ASIO_COMPLETION_TOKEN_FOR(void (asio::error_code,
|
||||
results_type)) ResolveHandler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(executor_type)>
|
||||
ASIO_INITFN_AUTO_RESULT_TYPE(ResolveHandler,
|
||||
void (asio::error_code, results_type))
|
||||
async_resolve(const endpoint_type& e,
|
||||
ASIO_MOVE_ARG(ResolveHandler) handler)
|
||||
ASIO_MOVE_ARG(ResolveHandler) handler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN(executor_type))
|
||||
{
|
||||
return asio::async_initiate<ResolveHandler,
|
||||
void (asio::error_code, results_type)>(
|
||||
initiate_async_resolve(), handler, this, e);
|
||||
initiate_async_resolve(this), handler, e);
|
||||
}
|
||||
|
||||
private:
|
||||
@@ -945,11 +977,24 @@ private:
|
||||
basic_resolver(const basic_resolver&) ASIO_DELETED;
|
||||
basic_resolver& operator=(const basic_resolver&) ASIO_DELETED;
|
||||
|
||||
struct initiate_async_resolve
|
||||
class initiate_async_resolve
|
||||
{
|
||||
public:
|
||||
typedef Executor executor_type;
|
||||
|
||||
explicit initiate_async_resolve(basic_resolver* self)
|
||||
: self_(self)
|
||||
{
|
||||
}
|
||||
|
||||
executor_type get_executor() const ASIO_NOEXCEPT
|
||||
{
|
||||
return self_->get_executor();
|
||||
}
|
||||
|
||||
template <typename ResolveHandler, typename Query>
|
||||
void operator()(ASIO_MOVE_ARG(ResolveHandler) handler,
|
||||
basic_resolver* self, const Query& q) const
|
||||
const Query& q) const
|
||||
{
|
||||
// If you get an error on the following line it means that your handler
|
||||
// does not meet the documented type requirements for a ResolveHandler.
|
||||
@@ -957,10 +1002,13 @@ private:
|
||||
ResolveHandler, handler, results_type) type_check;
|
||||
|
||||
asio::detail::non_const_lvalue<ResolveHandler> handler2(handler);
|
||||
self->impl_.get_service().async_resolve(
|
||||
self->impl_.get_implementation(), q, handler2.value,
|
||||
self->impl_.get_implementation_executor());
|
||||
self_->impl_.get_service().async_resolve(
|
||||
self_->impl_.get_implementation(), q, handler2.value,
|
||||
self_->impl_.get_implementation_executor());
|
||||
}
|
||||
|
||||
private:
|
||||
basic_resolver* self_;
|
||||
};
|
||||
|
||||
# if defined(ASIO_WINDOWS_RUNTIME)
|
||||
|
||||
@@ -300,10 +300,18 @@ public:
|
||||
return !a.equal(b);
|
||||
}
|
||||
|
||||
template <typename Random>
|
||||
void randomize(Random& r)
|
||||
#define HAVE_ASIO_RESOLVER_RESULTS_DATA
|
||||
|
||||
/// Return a pointer to the underlying results vector.
|
||||
auto* data()
|
||||
{
|
||||
std::shuffle(this->values_->begin(), this->values_->end(), r);
|
||||
return this->values_.get();
|
||||
}
|
||||
|
||||
/// Return a const pointer to the underlying results vector.
|
||||
const auto* cdata() const
|
||||
{
|
||||
return this->values_.get();
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
@@ -24,6 +24,11 @@
|
||||
|
||||
#include "asio/detail/push_options.hpp"
|
||||
|
||||
#if defined(ASIO_USE_KOVPN_ROUTE_ID)
|
||||
#include <cstdint>
|
||||
#include <uapi/ovpn/mark.h>
|
||||
#endif
|
||||
|
||||
namespace asio {
|
||||
namespace ip {
|
||||
namespace detail {
|
||||
@@ -118,6 +123,47 @@ public:
|
||||
ASIO_DECL std::string to_string() const;
|
||||
#endif // !defined(ASIO_NO_IOSTREAM)
|
||||
|
||||
#if defined(ASIO_USE_KOVPN_ROUTE_ID)
|
||||
int get_route_id() const
|
||||
{
|
||||
if (is_v4())
|
||||
{
|
||||
if (data_.v4_sin_ovpn_magic == SIN_OVPN_MAGIC)
|
||||
return OVPN_MARK_ROUTE_ID(data_.v4_sin_ovpn_route_id);
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((data_.v6.sin6_flowinfo & htonl(SIN6_FLOWINFO_OVPN_MASK)) == htonl(SIN6_FLOWINFO_OVPN_MAGIC))
|
||||
return OVPN_MARK_ROUTE_ID(ntohl(data_.v6.sin6_flowinfo));
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
void set_route_id(const int route_id)
|
||||
{
|
||||
if (is_v4())
|
||||
{
|
||||
if (route_id >= 0)
|
||||
{
|
||||
data_.v4_sin_ovpn_magic = SIN_OVPN_MAGIC;
|
||||
data_.v4_sin_ovpn_route_id = OVPN_MARK_ROUTE_ID(route_id);
|
||||
}
|
||||
else
|
||||
{
|
||||
data_.v4_sin_ovpn_magic = 0;
|
||||
data_.v4_sin_ovpn_route_id = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (route_id >= 0)
|
||||
data_.v6.sin6_flowinfo = htonl(OVPN_MARK_ROUTE_ID(route_id) | SIN6_FLOWINFO_OVPN_MAGIC);
|
||||
else
|
||||
data_.v6.sin6_flowinfo = 0;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
private:
|
||||
// The underlying IP socket address.
|
||||
union data_union
|
||||
@@ -125,6 +171,15 @@ private:
|
||||
asio::detail::socket_addr_type base;
|
||||
asio::detail::sockaddr_in4_type v4;
|
||||
asio::detail::sockaddr_in6_type v6;
|
||||
#if defined(ASIO_USE_KOVPN_ROUTE_ID)
|
||||
struct {
|
||||
std::uint8_t head_[8];
|
||||
|
||||
// mirrors definition in <linux-kernel>/include/uapi/linux/in.h
|
||||
std::uint32_t v4_sin_ovpn_magic;
|
||||
std::uint32_t v4_sin_ovpn_route_id;
|
||||
};
|
||||
#endif
|
||||
} data_;
|
||||
};
|
||||
|
||||
|
||||
@@ -37,6 +37,10 @@ endpoint::endpoint() ASIO_NOEXCEPT
|
||||
data_.v4.sin_family = ASIO_OS_DEF(AF_INET);
|
||||
data_.v4.sin_port = 0;
|
||||
data_.v4.sin_addr.s_addr = ASIO_OS_DEF(INADDR_ANY);
|
||||
#if defined(ASIO_USE_KOVPN_ROUTE_ID)
|
||||
data_.v4_sin_ovpn_magic = 0;
|
||||
data_.v4_sin_ovpn_route_id = 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
endpoint::endpoint(int family, unsigned short port_num) ASIO_NOEXCEPT
|
||||
@@ -49,6 +53,10 @@ endpoint::endpoint(int family, unsigned short port_num) ASIO_NOEXCEPT
|
||||
data_.v4.sin_port =
|
||||
asio::detail::socket_ops::host_to_network_short(port_num);
|
||||
data_.v4.sin_addr.s_addr = ASIO_OS_DEF(INADDR_ANY);
|
||||
#if defined(ASIO_USE_KOVPN_ROUTE_ID)
|
||||
data_.v4_sin_ovpn_magic = 0;
|
||||
data_.v4_sin_ovpn_route_id = 0;
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -81,6 +89,10 @@ endpoint::endpoint(const asio::ip::address& addr,
|
||||
data_.v4.sin_addr.s_addr =
|
||||
asio::detail::socket_ops::host_to_network_long(
|
||||
addr.to_v4().to_uint());
|
||||
#if defined(ASIO_USE_KOVPN_ROUTE_ID)
|
||||
data_.v4_sin_ovpn_magic = 0;
|
||||
data_.v4_sin_ovpn_route_id = 0;
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -46,33 +46,33 @@ public:
|
||||
typedef basic_endpoint<icmp> endpoint;
|
||||
|
||||
/// Construct to represent the IPv4 ICMP protocol.
|
||||
static icmp v4()
|
||||
static icmp v4() ASIO_NOEXCEPT
|
||||
{
|
||||
return icmp(ASIO_OS_DEF(IPPROTO_ICMP),
|
||||
ASIO_OS_DEF(AF_INET));
|
||||
}
|
||||
|
||||
/// Construct to represent the IPv6 ICMP protocol.
|
||||
static icmp v6()
|
||||
static icmp v6() ASIO_NOEXCEPT
|
||||
{
|
||||
return icmp(ASIO_OS_DEF(IPPROTO_ICMPV6),
|
||||
ASIO_OS_DEF(AF_INET6));
|
||||
}
|
||||
|
||||
/// Obtain an identifier for the type of the protocol.
|
||||
int type() const
|
||||
int type() const ASIO_NOEXCEPT
|
||||
{
|
||||
return ASIO_OS_DEF(SOCK_RAW);
|
||||
}
|
||||
|
||||
/// Obtain an identifier for the protocol.
|
||||
int protocol() const
|
||||
int protocol() const ASIO_NOEXCEPT
|
||||
{
|
||||
return protocol_;
|
||||
}
|
||||
|
||||
/// Obtain an identifier for the protocol family.
|
||||
int family() const
|
||||
int family() const ASIO_NOEXCEPT
|
||||
{
|
||||
return family_;
|
||||
}
|
||||
@@ -97,7 +97,7 @@ public:
|
||||
|
||||
private:
|
||||
// Construct with a specific family.
|
||||
explicit icmp(int protocol_id, int protocol_family)
|
||||
explicit icmp(int protocol_id, int protocol_family) ASIO_NOEXCEPT
|
||||
: protocol_(protocol_id),
|
||||
family_(protocol_family)
|
||||
{
|
||||
|
||||
@@ -49,31 +49,31 @@ public:
|
||||
typedef basic_endpoint<tcp> endpoint;
|
||||
|
||||
/// Construct to represent the IPv4 TCP protocol.
|
||||
static tcp v4()
|
||||
static tcp v4() ASIO_NOEXCEPT
|
||||
{
|
||||
return tcp(ASIO_OS_DEF(AF_INET));
|
||||
}
|
||||
|
||||
/// Construct to represent the IPv6 TCP protocol.
|
||||
static tcp v6()
|
||||
static tcp v6() ASIO_NOEXCEPT
|
||||
{
|
||||
return tcp(ASIO_OS_DEF(AF_INET6));
|
||||
}
|
||||
|
||||
/// Obtain an identifier for the type of the protocol.
|
||||
int type() const
|
||||
int type() const ASIO_NOEXCEPT
|
||||
{
|
||||
return ASIO_OS_DEF(SOCK_STREAM);
|
||||
}
|
||||
|
||||
/// Obtain an identifier for the protocol.
|
||||
int protocol() const
|
||||
int protocol() const ASIO_NOEXCEPT
|
||||
{
|
||||
return ASIO_OS_DEF(IPPROTO_TCP);
|
||||
}
|
||||
|
||||
/// Obtain an identifier for the protocol family.
|
||||
int family() const
|
||||
int family() const ASIO_NOEXCEPT
|
||||
{
|
||||
return family_;
|
||||
}
|
||||
@@ -139,7 +139,7 @@ public:
|
||||
|
||||
private:
|
||||
// Construct with a specific family.
|
||||
explicit tcp(int protocol_family)
|
||||
explicit tcp(int protocol_family) ASIO_NOEXCEPT
|
||||
: family_(protocol_family)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -46,31 +46,31 @@ public:
|
||||
typedef basic_endpoint<udp> endpoint;
|
||||
|
||||
/// Construct to represent the IPv4 UDP protocol.
|
||||
static udp v4()
|
||||
static udp v4() ASIO_NOEXCEPT
|
||||
{
|
||||
return udp(ASIO_OS_DEF(AF_INET));
|
||||
}
|
||||
|
||||
/// Construct to represent the IPv6 UDP protocol.
|
||||
static udp v6()
|
||||
static udp v6() ASIO_NOEXCEPT
|
||||
{
|
||||
return udp(ASIO_OS_DEF(AF_INET6));
|
||||
}
|
||||
|
||||
/// Obtain an identifier for the type of the protocol.
|
||||
int type() const
|
||||
int type() const ASIO_NOEXCEPT
|
||||
{
|
||||
return ASIO_OS_DEF(SOCK_DGRAM);
|
||||
}
|
||||
|
||||
/// Obtain an identifier for the protocol.
|
||||
int protocol() const
|
||||
int protocol() const ASIO_NOEXCEPT
|
||||
{
|
||||
return ASIO_OS_DEF(IPPROTO_UDP);
|
||||
}
|
||||
|
||||
/// Obtain an identifier for the protocol family.
|
||||
int family() const
|
||||
int family() const ASIO_NOEXCEPT
|
||||
{
|
||||
return family_;
|
||||
}
|
||||
@@ -95,7 +95,7 @@ public:
|
||||
|
||||
private:
|
||||
// Construct with a specific family.
|
||||
explicit udp(int protocol_family)
|
||||
explicit udp(int protocol_family) ASIO_NOEXCEPT
|
||||
: family_(protocol_family)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -60,7 +60,7 @@ public:
|
||||
#endif
|
||||
|
||||
/// Default constructor.
|
||||
basic_endpoint()
|
||||
basic_endpoint() ASIO_NOEXCEPT
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -45,19 +45,19 @@ class datagram_protocol
|
||||
{
|
||||
public:
|
||||
/// Obtain an identifier for the type of the protocol.
|
||||
int type() const
|
||||
int type() const ASIO_NOEXCEPT
|
||||
{
|
||||
return SOCK_DGRAM;
|
||||
}
|
||||
|
||||
/// Obtain an identifier for the protocol.
|
||||
int protocol() const
|
||||
int protocol() const ASIO_NOEXCEPT
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/// Obtain an identifier for the protocol family.
|
||||
int family() const
|
||||
int family() const ASIO_NOEXCEPT
|
||||
{
|
||||
return AF_UNIX;
|
||||
}
|
||||
|
||||
@@ -47,19 +47,19 @@ class stream_protocol
|
||||
{
|
||||
public:
|
||||
/// Obtain an identifier for the type of the protocol.
|
||||
int type() const
|
||||
int type() const ASIO_NOEXCEPT
|
||||
{
|
||||
return SOCK_STREAM;
|
||||
}
|
||||
|
||||
/// Obtain an identifier for the protocol.
|
||||
int protocol() const
|
||||
int protocol() const ASIO_NOEXCEPT
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/// Obtain an identifier for the protocol family.
|
||||
int family() const
|
||||
int family() const ASIO_NOEXCEPT
|
||||
{
|
||||
return AF_UNIX;
|
||||
}
|
||||
|
||||
@@ -57,6 +57,14 @@ public:
|
||||
/// The type of the executor associated with the object.
|
||||
typedef Executor executor_type;
|
||||
|
||||
/// Rebinds the descriptor type to another executor.
|
||||
template <typename Executor1>
|
||||
struct rebind_executor
|
||||
{
|
||||
/// The descriptor type when rebound to the specified executor.
|
||||
typedef basic_descriptor<Executor1> other;
|
||||
};
|
||||
|
||||
/// The native representation of a descriptor.
|
||||
#if defined(GENERATING_DOCUMENTATION)
|
||||
typedef implementation_defined native_handle_type;
|
||||
@@ -614,13 +622,17 @@ public:
|
||||
* wait_handler);
|
||||
* @endcode
|
||||
*/
|
||||
template <typename WaitHandler>
|
||||
ASIO_INITFN_RESULT_TYPE(WaitHandler,
|
||||
template <
|
||||
ASIO_COMPLETION_TOKEN_FOR(void (asio::error_code))
|
||||
WaitHandler ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(executor_type)>
|
||||
ASIO_INITFN_AUTO_RESULT_TYPE(WaitHandler,
|
||||
void (asio::error_code))
|
||||
async_wait(wait_type w, ASIO_MOVE_ARG(WaitHandler) handler)
|
||||
async_wait(wait_type w,
|
||||
ASIO_MOVE_ARG(WaitHandler) handler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN(executor_type))
|
||||
{
|
||||
return async_initiate<WaitHandler, void (asio::error_code)>(
|
||||
initiate_async_wait(), handler, this, w);
|
||||
initiate_async_wait(this), handler, w);
|
||||
}
|
||||
|
||||
protected:
|
||||
@@ -641,21 +653,36 @@ private:
|
||||
basic_descriptor(const basic_descriptor&) ASIO_DELETED;
|
||||
basic_descriptor& operator=(const basic_descriptor&) ASIO_DELETED;
|
||||
|
||||
struct initiate_async_wait
|
||||
class initiate_async_wait
|
||||
{
|
||||
public:
|
||||
typedef Executor executor_type;
|
||||
|
||||
explicit initiate_async_wait(basic_descriptor* self)
|
||||
: self_(self)
|
||||
{
|
||||
}
|
||||
|
||||
executor_type get_executor() const ASIO_NOEXCEPT
|
||||
{
|
||||
return self_->get_executor();
|
||||
}
|
||||
|
||||
template <typename WaitHandler>
|
||||
void operator()(ASIO_MOVE_ARG(WaitHandler) handler,
|
||||
basic_descriptor* self, wait_type w) const
|
||||
void operator()(ASIO_MOVE_ARG(WaitHandler) handler, wait_type w) const
|
||||
{
|
||||
// If you get an error on the following line it means that your handler
|
||||
// does not meet the documented type requirements for a WaitHandler.
|
||||
ASIO_WAIT_HANDLER_CHECK(WaitHandler, handler) type_check;
|
||||
|
||||
detail::non_const_lvalue<WaitHandler> handler2(handler);
|
||||
self->impl_.get_service().async_wait(
|
||||
self->impl_.get_implementation(), w, handler2.value,
|
||||
self->impl_.get_implementation_executor());
|
||||
self_->impl_.get_service().async_wait(
|
||||
self_->impl_.get_implementation(), w, handler2.value,
|
||||
self_->impl_.get_implementation_executor());
|
||||
}
|
||||
|
||||
private:
|
||||
basic_descriptor* self_;
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
@@ -44,6 +44,14 @@ public:
|
||||
/// The type of the executor associated with the object.
|
||||
typedef Executor executor_type;
|
||||
|
||||
/// Rebinds the descriptor type to another executor.
|
||||
template <typename Executor1>
|
||||
struct rebind_executor
|
||||
{
|
||||
/// The descriptor type when rebound to the specified executor.
|
||||
typedef basic_stream_descriptor<Executor1> other;
|
||||
};
|
||||
|
||||
/// The native representation of a descriptor.
|
||||
typedef typename basic_descriptor<Executor>::native_handle_type
|
||||
native_handle_type;
|
||||
@@ -256,15 +264,19 @@ public:
|
||||
* buffers in one go, and how to use it with arrays, boost::array or
|
||||
* std::vector.
|
||||
*/
|
||||
template <typename ConstBufferSequence, typename WriteHandler>
|
||||
ASIO_INITFN_RESULT_TYPE(WriteHandler,
|
||||
template <typename ConstBufferSequence,
|
||||
ASIO_COMPLETION_TOKEN_FOR(void (asio::error_code,
|
||||
std::size_t)) WriteHandler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(executor_type)>
|
||||
ASIO_INITFN_AUTO_RESULT_TYPE(WriteHandler,
|
||||
void (asio::error_code, std::size_t))
|
||||
async_write_some(const ConstBufferSequence& buffers,
|
||||
ASIO_MOVE_ARG(WriteHandler) handler)
|
||||
ASIO_MOVE_ARG(WriteHandler) handler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN(executor_type))
|
||||
{
|
||||
return async_initiate<WriteHandler,
|
||||
void (asio::error_code, std::size_t)>(
|
||||
initiate_async_write_some(), handler, this, buffers);
|
||||
initiate_async_write_some(this), handler, buffers);
|
||||
}
|
||||
|
||||
/// Read some data from the descriptor.
|
||||
@@ -366,23 +378,39 @@ public:
|
||||
* buffers in one go, and how to use it with arrays, boost::array or
|
||||
* std::vector.
|
||||
*/
|
||||
template <typename MutableBufferSequence, typename ReadHandler>
|
||||
ASIO_INITFN_RESULT_TYPE(ReadHandler,
|
||||
template <typename MutableBufferSequence,
|
||||
ASIO_COMPLETION_TOKEN_FOR(void (asio::error_code,
|
||||
std::size_t)) ReadHandler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(executor_type)>
|
||||
ASIO_INITFN_AUTO_RESULT_TYPE(ReadHandler,
|
||||
void (asio::error_code, std::size_t))
|
||||
async_read_some(const MutableBufferSequence& buffers,
|
||||
ASIO_MOVE_ARG(ReadHandler) handler)
|
||||
ASIO_MOVE_ARG(ReadHandler) handler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN(executor_type))
|
||||
{
|
||||
return async_initiate<ReadHandler,
|
||||
void (asio::error_code, std::size_t)>(
|
||||
initiate_async_read_some(), handler, this, buffers);
|
||||
initiate_async_read_some(this), handler, buffers);
|
||||
}
|
||||
|
||||
private:
|
||||
struct initiate_async_write_some
|
||||
class initiate_async_write_some
|
||||
{
|
||||
public:
|
||||
typedef Executor executor_type;
|
||||
|
||||
explicit initiate_async_write_some(basic_stream_descriptor* self)
|
||||
: self_(self)
|
||||
{
|
||||
}
|
||||
|
||||
executor_type get_executor() const ASIO_NOEXCEPT
|
||||
{
|
||||
return self_->get_executor();
|
||||
}
|
||||
|
||||
template <typename WriteHandler, typename ConstBufferSequence>
|
||||
void operator()(ASIO_MOVE_ARG(WriteHandler) handler,
|
||||
basic_stream_descriptor* self,
|
||||
const ConstBufferSequence& buffers) const
|
||||
{
|
||||
// If you get an error on the following line it means that your handler
|
||||
@@ -390,17 +418,32 @@ private:
|
||||
ASIO_WRITE_HANDLER_CHECK(WriteHandler, handler) type_check;
|
||||
|
||||
detail::non_const_lvalue<WriteHandler> handler2(handler);
|
||||
self->impl_.get_service().async_write_some(
|
||||
self->impl_.get_implementation(), buffers, handler2.value,
|
||||
self->impl_.get_implementation_executor());
|
||||
self_->impl_.get_service().async_write_some(
|
||||
self_->impl_.get_implementation(), buffers, handler2.value,
|
||||
self_->impl_.get_implementation_executor());
|
||||
}
|
||||
|
||||
private:
|
||||
basic_stream_descriptor* self_;
|
||||
};
|
||||
|
||||
struct initiate_async_read_some
|
||||
class initiate_async_read_some
|
||||
{
|
||||
public:
|
||||
typedef Executor executor_type;
|
||||
|
||||
explicit initiate_async_read_some(basic_stream_descriptor* self)
|
||||
: self_(self)
|
||||
{
|
||||
}
|
||||
|
||||
executor_type get_executor() const ASIO_NOEXCEPT
|
||||
{
|
||||
return self_->get_executor();
|
||||
}
|
||||
|
||||
template <typename ReadHandler, typename MutableBufferSequence>
|
||||
void operator()(ASIO_MOVE_ARG(ReadHandler) handler,
|
||||
basic_stream_descriptor* self,
|
||||
const MutableBufferSequence& buffers) const
|
||||
{
|
||||
// If you get an error on the following line it means that your handler
|
||||
@@ -408,10 +451,13 @@ private:
|
||||
ASIO_READ_HANDLER_CHECK(ReadHandler, handler) type_check;
|
||||
|
||||
detail::non_const_lvalue<ReadHandler> handler2(handler);
|
||||
self->impl_.get_service().async_read_some(
|
||||
self->impl_.get_implementation(), buffers, handler2.value,
|
||||
self->impl_.get_implementation_executor());
|
||||
self_->impl_.get_service().async_read_some(
|
||||
self_->impl_.get_implementation(), buffers, handler2.value,
|
||||
self_->impl_.get_implementation_executor());
|
||||
}
|
||||
|
||||
private:
|
||||
basic_stream_descriptor* self_;
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
@@ -52,8 +52,8 @@ namespace asio {
|
||||
*
|
||||
* @li Returns <tt>result.get()</tt>.
|
||||
*/
|
||||
template <typename CompletionToken>
|
||||
ASIO_INITFN_RESULT_TYPE(CompletionToken, void()) post(
|
||||
template <ASIO_COMPLETION_TOKEN_FOR(void()) CompletionToken>
|
||||
ASIO_INITFN_AUTO_RESULT_TYPE(CompletionToken, void()) post(
|
||||
ASIO_MOVE_ARG(CompletionToken) token);
|
||||
|
||||
/// Submits a completion token or function object for execution.
|
||||
@@ -89,18 +89,28 @@ ASIO_INITFN_RESULT_TYPE(CompletionToken, void()) post(
|
||||
*
|
||||
* @li Returns <tt>result.get()</tt>.
|
||||
*/
|
||||
template <typename Executor, typename CompletionToken>
|
||||
ASIO_INITFN_RESULT_TYPE(CompletionToken, void()) post(
|
||||
const Executor& ex, ASIO_MOVE_ARG(CompletionToken) token,
|
||||
template <typename Executor,
|
||||
ASIO_COMPLETION_TOKEN_FOR(void()) CompletionToken
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(Executor)>
|
||||
ASIO_INITFN_AUTO_RESULT_TYPE(CompletionToken, void()) post(
|
||||
const Executor& ex,
|
||||
ASIO_MOVE_ARG(CompletionToken) token
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN(Executor),
|
||||
typename enable_if<is_executor<Executor>::value>::type* = 0);
|
||||
|
||||
/// Submits a completion token or function object for execution.
|
||||
/**
|
||||
* @returns <tt>post(ctx.get_executor(), forward<CompletionToken>(token))</tt>.
|
||||
*/
|
||||
template <typename ExecutionContext, typename CompletionToken>
|
||||
ASIO_INITFN_RESULT_TYPE(CompletionToken, void()) post(
|
||||
ExecutionContext& ctx, ASIO_MOVE_ARG(CompletionToken) token,
|
||||
template <typename ExecutionContext,
|
||||
ASIO_COMPLETION_TOKEN_FOR(void()) CompletionToken
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(
|
||||
typename ExecutionContext::executor_type)>
|
||||
ASIO_INITFN_AUTO_RESULT_TYPE(CompletionToken, void()) post(
|
||||
ExecutionContext& ctx,
|
||||
ASIO_MOVE_ARG(CompletionToken) token
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN(
|
||||
typename ExecutionContext::executor_type),
|
||||
typename enable_if<is_convertible<
|
||||
ExecutionContext&, execution_context&>::value>::type* = 0);
|
||||
|
||||
|
||||
@@ -760,11 +760,16 @@ std::size_t read(SyncReadStream& s, DynamicBuffer_v2 buffers,
|
||||
* handler); @endcode
|
||||
*/
|
||||
template <typename AsyncReadStream, typename MutableBufferSequence,
|
||||
typename ReadHandler>
|
||||
ASIO_INITFN_RESULT_TYPE(ReadHandler,
|
||||
ASIO_COMPLETION_TOKEN_FOR(void (asio::error_code,
|
||||
std::size_t)) ReadHandler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(
|
||||
typename AsyncReadStream::executor_type)>
|
||||
ASIO_INITFN_AUTO_RESULT_TYPE(ReadHandler,
|
||||
void (asio::error_code, std::size_t))
|
||||
async_read(AsyncReadStream& s, const MutableBufferSequence& buffers,
|
||||
ASIO_MOVE_ARG(ReadHandler) handler,
|
||||
ASIO_MOVE_ARG(ReadHandler) handler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN(
|
||||
typename AsyncReadStream::executor_type),
|
||||
typename enable_if<
|
||||
is_mutable_buffer_sequence<MutableBufferSequence>::value
|
||||
>::type* = 0);
|
||||
@@ -832,13 +837,19 @@ async_read(AsyncReadStream& s, const MutableBufferSequence& buffers,
|
||||
* buffers in one go, and how to use it with arrays, boost::array or
|
||||
* std::vector.
|
||||
*/
|
||||
template <typename AsyncReadStream, typename MutableBufferSequence,
|
||||
typename CompletionCondition, typename ReadHandler>
|
||||
ASIO_INITFN_RESULT_TYPE(ReadHandler,
|
||||
template <typename AsyncReadStream,
|
||||
typename MutableBufferSequence, typename CompletionCondition,
|
||||
ASIO_COMPLETION_TOKEN_FOR(void (asio::error_code,
|
||||
std::size_t)) ReadHandler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(
|
||||
typename AsyncReadStream::executor_type)>
|
||||
ASIO_INITFN_AUTO_RESULT_TYPE(ReadHandler,
|
||||
void (asio::error_code, std::size_t))
|
||||
async_read(AsyncReadStream& s, const MutableBufferSequence& buffers,
|
||||
CompletionCondition completion_condition,
|
||||
ASIO_MOVE_ARG(ReadHandler) handler,
|
||||
ASIO_MOVE_ARG(ReadHandler) handler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN(
|
||||
typename AsyncReadStream::executor_type),
|
||||
typename enable_if<
|
||||
is_mutable_buffer_sequence<MutableBufferSequence>::value
|
||||
>::type* = 0);
|
||||
@@ -895,13 +906,18 @@ async_read(AsyncReadStream& s, const MutableBufferSequence& buffers,
|
||||
* asio::transfer_all(),
|
||||
* handler); @endcode
|
||||
*/
|
||||
template <typename AsyncReadStream,
|
||||
typename DynamicBuffer_v1, typename ReadHandler>
|
||||
ASIO_INITFN_RESULT_TYPE(ReadHandler,
|
||||
template <typename AsyncReadStream, typename DynamicBuffer_v1,
|
||||
ASIO_COMPLETION_TOKEN_FOR(void (asio::error_code,
|
||||
std::size_t)) ReadHandler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(
|
||||
typename AsyncReadStream::executor_type)>
|
||||
ASIO_INITFN_AUTO_RESULT_TYPE(ReadHandler,
|
||||
void (asio::error_code, std::size_t))
|
||||
async_read(AsyncReadStream& s,
|
||||
ASIO_MOVE_ARG(DynamicBuffer_v1) buffers,
|
||||
ASIO_MOVE_ARG(ReadHandler) handler,
|
||||
ASIO_MOVE_ARG(ReadHandler) handler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN(
|
||||
typename AsyncReadStream::executor_type),
|
||||
typename enable_if<
|
||||
is_dynamic_buffer_v1<typename decay<DynamicBuffer_v1>::type>::value
|
||||
&& !is_dynamic_buffer_v2<typename decay<DynamicBuffer_v1>::type>::value
|
||||
@@ -965,14 +981,20 @@ async_read(AsyncReadStream& s,
|
||||
* immediate completion, invocation of the handler will be performed in a
|
||||
* manner equivalent to using asio::post().
|
||||
*/
|
||||
template <typename AsyncReadStream, typename DynamicBuffer_v1,
|
||||
typename CompletionCondition, typename ReadHandler>
|
||||
ASIO_INITFN_RESULT_TYPE(ReadHandler,
|
||||
template <typename AsyncReadStream,
|
||||
typename DynamicBuffer_v1, typename CompletionCondition,
|
||||
ASIO_COMPLETION_TOKEN_FOR(void (asio::error_code,
|
||||
std::size_t)) ReadHandler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(
|
||||
typename AsyncReadStream::executor_type)>
|
||||
ASIO_INITFN_AUTO_RESULT_TYPE(ReadHandler,
|
||||
void (asio::error_code, std::size_t))
|
||||
async_read(AsyncReadStream& s,
|
||||
ASIO_MOVE_ARG(DynamicBuffer_v1) buffers,
|
||||
CompletionCondition completion_condition,
|
||||
ASIO_MOVE_ARG(ReadHandler) handler,
|
||||
ASIO_MOVE_ARG(ReadHandler) handler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN(
|
||||
typename AsyncReadStream::executor_type),
|
||||
typename enable_if<
|
||||
is_dynamic_buffer_v1<typename decay<DynamicBuffer_v1>::type>::value
|
||||
&& !is_dynamic_buffer_v2<typename decay<DynamicBuffer_v1>::type>::value
|
||||
@@ -1029,11 +1051,17 @@ async_read(AsyncReadStream& s,
|
||||
* asio::transfer_all(),
|
||||
* handler); @endcode
|
||||
*/
|
||||
template <typename AsyncReadStream, typename Allocator, typename ReadHandler>
|
||||
ASIO_INITFN_RESULT_TYPE(ReadHandler,
|
||||
template <typename AsyncReadStream, typename Allocator,
|
||||
ASIO_COMPLETION_TOKEN_FOR(void (asio::error_code,
|
||||
std::size_t)) ReadHandler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(
|
||||
typename AsyncReadStream::executor_type)>
|
||||
ASIO_INITFN_AUTO_RESULT_TYPE(ReadHandler,
|
||||
void (asio::error_code, std::size_t))
|
||||
async_read(AsyncReadStream& s, basic_streambuf<Allocator>& b,
|
||||
ASIO_MOVE_ARG(ReadHandler) handler);
|
||||
ASIO_MOVE_ARG(ReadHandler) handler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN(
|
||||
typename AsyncReadStream::executor_type));
|
||||
|
||||
/// Start an asynchronous operation to read a certain amount of data from a
|
||||
/// stream.
|
||||
@@ -1091,13 +1119,19 @@ async_read(AsyncReadStream& s, basic_streambuf<Allocator>& b,
|
||||
* immediate completion, invocation of the handler will be performed in a
|
||||
* manner equivalent to using asio::post().
|
||||
*/
|
||||
template <typename AsyncReadStream, typename Allocator,
|
||||
typename CompletionCondition, typename ReadHandler>
|
||||
ASIO_INITFN_RESULT_TYPE(ReadHandler,
|
||||
template <typename AsyncReadStream,
|
||||
typename Allocator, typename CompletionCondition,
|
||||
ASIO_COMPLETION_TOKEN_FOR(void (asio::error_code,
|
||||
std::size_t)) ReadHandler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(
|
||||
typename AsyncReadStream::executor_type)>
|
||||
ASIO_INITFN_AUTO_RESULT_TYPE(ReadHandler,
|
||||
void (asio::error_code, std::size_t))
|
||||
async_read(AsyncReadStream& s, basic_streambuf<Allocator>& b,
|
||||
CompletionCondition completion_condition,
|
||||
ASIO_MOVE_ARG(ReadHandler) handler);
|
||||
ASIO_MOVE_ARG(ReadHandler) handler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN(
|
||||
typename AsyncReadStream::executor_type));
|
||||
|
||||
#endif // !defined(ASIO_NO_IOSTREAM)
|
||||
#endif // !defined(ASIO_NO_EXTENSIONS)
|
||||
@@ -1153,12 +1187,17 @@ async_read(AsyncReadStream& s, basic_streambuf<Allocator>& b,
|
||||
* asio::transfer_all(),
|
||||
* handler); @endcode
|
||||
*/
|
||||
template <typename AsyncReadStream,
|
||||
typename DynamicBuffer_v2, typename ReadHandler>
|
||||
ASIO_INITFN_RESULT_TYPE(ReadHandler,
|
||||
template <typename AsyncReadStream, typename DynamicBuffer_v2,
|
||||
ASIO_COMPLETION_TOKEN_FOR(void (asio::error_code,
|
||||
std::size_t)) ReadHandler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(
|
||||
typename AsyncReadStream::executor_type)>
|
||||
ASIO_INITFN_AUTO_RESULT_TYPE(ReadHandler,
|
||||
void (asio::error_code, std::size_t))
|
||||
async_read(AsyncReadStream& s, DynamicBuffer_v2 buffers,
|
||||
ASIO_MOVE_ARG(ReadHandler) handler,
|
||||
ASIO_MOVE_ARG(ReadHandler) handler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN(
|
||||
typename AsyncReadStream::executor_type),
|
||||
typename enable_if<
|
||||
is_dynamic_buffer_v2<DynamicBuffer_v2>::value
|
||||
>::type* = 0);
|
||||
@@ -1221,13 +1260,19 @@ async_read(AsyncReadStream& s, DynamicBuffer_v2 buffers,
|
||||
* immediate completion, invocation of the handler will be performed in a
|
||||
* manner equivalent to using asio::post().
|
||||
*/
|
||||
template <typename AsyncReadStream, typename DynamicBuffer_v2,
|
||||
typename CompletionCondition, typename ReadHandler>
|
||||
ASIO_INITFN_RESULT_TYPE(ReadHandler,
|
||||
template <typename AsyncReadStream,
|
||||
typename DynamicBuffer_v2, typename CompletionCondition,
|
||||
ASIO_COMPLETION_TOKEN_FOR(void (asio::error_code,
|
||||
std::size_t)) ReadHandler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(
|
||||
typename AsyncReadStream::executor_type)>
|
||||
ASIO_INITFN_AUTO_RESULT_TYPE(ReadHandler,
|
||||
void (asio::error_code, std::size_t))
|
||||
async_read(AsyncReadStream& s, DynamicBuffer_v2 buffers,
|
||||
CompletionCondition completion_condition,
|
||||
ASIO_MOVE_ARG(ReadHandler) handler,
|
||||
ASIO_MOVE_ARG(ReadHandler) handler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN(
|
||||
typename AsyncReadStream::executor_type),
|
||||
typename enable_if<
|
||||
is_dynamic_buffer_v2<DynamicBuffer_v2>::value
|
||||
>::type* = 0);
|
||||
|
||||
@@ -459,12 +459,17 @@ std::size_t read_at(SyncRandomAccessReadDevice& d,
|
||||
* handler); @endcode
|
||||
*/
|
||||
template <typename AsyncRandomAccessReadDevice, typename MutableBufferSequence,
|
||||
typename ReadHandler>
|
||||
ASIO_INITFN_RESULT_TYPE(ReadHandler,
|
||||
ASIO_COMPLETION_TOKEN_FOR(void (asio::error_code,
|
||||
std::size_t)) ReadHandler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(
|
||||
typename AsyncRandomAccessReadDevice::executor_type)>
|
||||
ASIO_INITFN_AUTO_RESULT_TYPE(ReadHandler,
|
||||
void (asio::error_code, std::size_t))
|
||||
async_read_at(AsyncRandomAccessReadDevice& d, uint64_t offset,
|
||||
const MutableBufferSequence& buffers,
|
||||
ASIO_MOVE_ARG(ReadHandler) handler);
|
||||
ASIO_MOVE_ARG(ReadHandler) handler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN(
|
||||
typename AsyncRandomAccessReadDevice::executor_type));
|
||||
|
||||
/// Start an asynchronous operation to read a certain amount of data at the
|
||||
/// specified offset.
|
||||
@@ -531,14 +536,20 @@ async_read_at(AsyncRandomAccessReadDevice& d, uint64_t offset,
|
||||
* buffers in one go, and how to use it with arrays, boost::array or
|
||||
* std::vector.
|
||||
*/
|
||||
template <typename AsyncRandomAccessReadDevice, typename MutableBufferSequence,
|
||||
typename CompletionCondition, typename ReadHandler>
|
||||
ASIO_INITFN_RESULT_TYPE(ReadHandler,
|
||||
template <typename AsyncRandomAccessReadDevice,
|
||||
typename MutableBufferSequence, typename CompletionCondition,
|
||||
ASIO_COMPLETION_TOKEN_FOR(void (asio::error_code,
|
||||
std::size_t)) ReadHandler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(
|
||||
typename AsyncRandomAccessReadDevice::executor_type)>
|
||||
ASIO_INITFN_AUTO_RESULT_TYPE(ReadHandler,
|
||||
void (asio::error_code, std::size_t))
|
||||
async_read_at(AsyncRandomAccessReadDevice& d,
|
||||
uint64_t offset, const MutableBufferSequence& buffers,
|
||||
CompletionCondition completion_condition,
|
||||
ASIO_MOVE_ARG(ReadHandler) handler);
|
||||
ASIO_MOVE_ARG(ReadHandler) handler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN(
|
||||
typename AsyncRandomAccessReadDevice::executor_type));
|
||||
|
||||
#if !defined(ASIO_NO_EXTENSIONS)
|
||||
#if !defined(ASIO_NO_IOSTREAM)
|
||||
@@ -589,11 +600,17 @@ async_read_at(AsyncRandomAccessReadDevice& d,
|
||||
* handler); @endcode
|
||||
*/
|
||||
template <typename AsyncRandomAccessReadDevice, typename Allocator,
|
||||
typename ReadHandler>
|
||||
ASIO_INITFN_RESULT_TYPE(ReadHandler,
|
||||
ASIO_COMPLETION_TOKEN_FOR(void (asio::error_code,
|
||||
std::size_t)) ReadHandler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(
|
||||
typename AsyncRandomAccessReadDevice::executor_type)>
|
||||
ASIO_INITFN_AUTO_RESULT_TYPE(ReadHandler,
|
||||
void (asio::error_code, std::size_t))
|
||||
async_read_at(AsyncRandomAccessReadDevice& d, uint64_t offset,
|
||||
basic_streambuf<Allocator>& b, ASIO_MOVE_ARG(ReadHandler) handler);
|
||||
async_read_at(AsyncRandomAccessReadDevice& d,
|
||||
uint64_t offset, basic_streambuf<Allocator>& b,
|
||||
ASIO_MOVE_ARG(ReadHandler) handler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN(
|
||||
typename AsyncRandomAccessReadDevice::executor_type));
|
||||
|
||||
/// Start an asynchronous operation to read a certain amount of data at the
|
||||
/// specified offset.
|
||||
@@ -648,14 +665,20 @@ async_read_at(AsyncRandomAccessReadDevice& d, uint64_t offset,
|
||||
* immediate completion, invocation of the handler will be performed in a
|
||||
* manner equivalent to using asio::post().
|
||||
*/
|
||||
template <typename AsyncRandomAccessReadDevice, typename Allocator,
|
||||
typename CompletionCondition, typename ReadHandler>
|
||||
ASIO_INITFN_RESULT_TYPE(ReadHandler,
|
||||
template <typename AsyncRandomAccessReadDevice,
|
||||
typename Allocator, typename CompletionCondition,
|
||||
ASIO_COMPLETION_TOKEN_FOR(void (asio::error_code,
|
||||
std::size_t)) ReadHandler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(
|
||||
typename AsyncRandomAccessReadDevice::executor_type)>
|
||||
ASIO_INITFN_AUTO_RESULT_TYPE(ReadHandler,
|
||||
void (asio::error_code, std::size_t))
|
||||
async_read_at(AsyncRandomAccessReadDevice& d,
|
||||
uint64_t offset, basic_streambuf<Allocator>& b,
|
||||
CompletionCondition completion_condition,
|
||||
ASIO_MOVE_ARG(ReadHandler) handler);
|
||||
ASIO_MOVE_ARG(ReadHandler) handler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN(
|
||||
typename AsyncRandomAccessReadDevice::executor_type));
|
||||
|
||||
#endif // !defined(ASIO_NO_IOSTREAM)
|
||||
#endif // !defined(ASIO_NO_EXTENSIONS)
|
||||
|
||||
@@ -1598,13 +1598,18 @@ std::size_t read_until(SyncReadStream& s, DynamicBuffer_v2 buffers,
|
||||
* This data may be the start of a new line, to be extracted by a subsequent
|
||||
* @c async_read_until operation.
|
||||
*/
|
||||
template <typename AsyncReadStream,
|
||||
typename DynamicBuffer_v1, typename ReadHandler>
|
||||
ASIO_INITFN_RESULT_TYPE(ReadHandler,
|
||||
template <typename AsyncReadStream, typename DynamicBuffer_v1,
|
||||
ASIO_COMPLETION_TOKEN_FOR(void (asio::error_code,
|
||||
std::size_t)) ReadHandler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(
|
||||
typename AsyncReadStream::executor_type)>
|
||||
ASIO_INITFN_AUTO_RESULT_TYPE(ReadHandler,
|
||||
void (asio::error_code, std::size_t))
|
||||
async_read_until(AsyncReadStream& s,
|
||||
ASIO_MOVE_ARG(DynamicBuffer_v1) buffers,
|
||||
char delim, ASIO_MOVE_ARG(ReadHandler) handler,
|
||||
ASIO_MOVE_ARG(DynamicBuffer_v1) buffers, char delim,
|
||||
ASIO_MOVE_ARG(ReadHandler) handler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN(
|
||||
typename AsyncReadStream::executor_type),
|
||||
typename enable_if<
|
||||
is_dynamic_buffer_v1<typename decay<DynamicBuffer_v1>::type>::value
|
||||
&& !is_dynamic_buffer_v2<typename decay<DynamicBuffer_v1>::type>::value
|
||||
@@ -1692,14 +1697,19 @@ async_read_until(AsyncReadStream& s,
|
||||
* This data may be the start of a new line, to be extracted by a subsequent
|
||||
* @c async_read_until operation.
|
||||
*/
|
||||
template <typename AsyncReadStream,
|
||||
typename DynamicBuffer_v1, typename ReadHandler>
|
||||
ASIO_INITFN_RESULT_TYPE(ReadHandler,
|
||||
template <typename AsyncReadStream, typename DynamicBuffer_v1,
|
||||
ASIO_COMPLETION_TOKEN_FOR(void (asio::error_code,
|
||||
std::size_t)) ReadHandler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(
|
||||
typename AsyncReadStream::executor_type)>
|
||||
ASIO_INITFN_AUTO_RESULT_TYPE(ReadHandler,
|
||||
void (asio::error_code, std::size_t))
|
||||
async_read_until(AsyncReadStream& s,
|
||||
ASIO_MOVE_ARG(DynamicBuffer_v1) buffers,
|
||||
ASIO_STRING_VIEW_PARAM delim,
|
||||
ASIO_MOVE_ARG(ReadHandler) handler,
|
||||
ASIO_MOVE_ARG(ReadHandler) handler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN(
|
||||
typename AsyncReadStream::executor_type),
|
||||
typename enable_if<
|
||||
is_dynamic_buffer_v1<typename decay<DynamicBuffer_v1>::type>::value
|
||||
&& !is_dynamic_buffer_v2<typename decay<DynamicBuffer_v1>::type>::value
|
||||
@@ -1794,14 +1804,19 @@ async_read_until(AsyncReadStream& s,
|
||||
* This data may be the start of a new line, to be extracted by a subsequent
|
||||
* @c async_read_until operation.
|
||||
*/
|
||||
template <typename AsyncReadStream,
|
||||
typename DynamicBuffer_v1, typename ReadHandler>
|
||||
ASIO_INITFN_RESULT_TYPE(ReadHandler,
|
||||
template <typename AsyncReadStream, typename DynamicBuffer_v1,
|
||||
ASIO_COMPLETION_TOKEN_FOR(void (asio::error_code,
|
||||
std::size_t)) ReadHandler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(
|
||||
typename AsyncReadStream::executor_type)>
|
||||
ASIO_INITFN_AUTO_RESULT_TYPE(ReadHandler,
|
||||
void (asio::error_code, std::size_t))
|
||||
async_read_until(AsyncReadStream& s,
|
||||
ASIO_MOVE_ARG(DynamicBuffer_v1) buffers,
|
||||
const boost::regex& expr,
|
||||
ASIO_MOVE_ARG(ReadHandler) handler,
|
||||
ASIO_MOVE_ARG(ReadHandler) handler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN(
|
||||
typename AsyncReadStream::executor_type),
|
||||
typename enable_if<
|
||||
is_dynamic_buffer_v1<typename decay<DynamicBuffer_v1>::type>::value
|
||||
&& !is_dynamic_buffer_v2<typename decay<DynamicBuffer_v1>::type>::value
|
||||
@@ -1938,13 +1953,20 @@ async_read_until(AsyncReadStream& s,
|
||||
* asio::async_read_until(s, data, match_char('a'), handler);
|
||||
* @endcode
|
||||
*/
|
||||
template <typename AsyncReadStream, typename DynamicBuffer_v1,
|
||||
typename MatchCondition, typename ReadHandler>
|
||||
ASIO_INITFN_RESULT_TYPE(ReadHandler,
|
||||
template <typename AsyncReadStream,
|
||||
typename DynamicBuffer_v1, typename MatchCondition,
|
||||
ASIO_COMPLETION_TOKEN_FOR(void (asio::error_code,
|
||||
std::size_t)) ReadHandler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(
|
||||
typename AsyncReadStream::executor_type)>
|
||||
ASIO_INITFN_AUTO_RESULT_TYPE(ReadHandler,
|
||||
void (asio::error_code, std::size_t))
|
||||
async_read_until(AsyncReadStream& s,
|
||||
ASIO_MOVE_ARG(DynamicBuffer_v1) buffers,
|
||||
MatchCondition match_condition, ASIO_MOVE_ARG(ReadHandler) handler,
|
||||
MatchCondition match_condition,
|
||||
ASIO_MOVE_ARG(ReadHandler) handler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN(
|
||||
typename AsyncReadStream::executor_type),
|
||||
typename enable_if<
|
||||
is_match_condition<MatchCondition>::value
|
||||
&& is_dynamic_buffer_v1<typename decay<DynamicBuffer_v1>::type>::value
|
||||
@@ -2031,12 +2053,18 @@ async_read_until(AsyncReadStream& s,
|
||||
* This data may be the start of a new line, to be extracted by a subsequent
|
||||
* @c async_read_until operation.
|
||||
*/
|
||||
template <typename AsyncReadStream, typename Allocator, typename ReadHandler>
|
||||
ASIO_INITFN_RESULT_TYPE(ReadHandler,
|
||||
template <typename AsyncReadStream, typename Allocator,
|
||||
ASIO_COMPLETION_TOKEN_FOR(void (asio::error_code,
|
||||
std::size_t)) ReadHandler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(
|
||||
typename AsyncReadStream::executor_type)>
|
||||
ASIO_INITFN_AUTO_RESULT_TYPE(ReadHandler,
|
||||
void (asio::error_code, std::size_t))
|
||||
async_read_until(AsyncReadStream& s,
|
||||
asio::basic_streambuf<Allocator>& b,
|
||||
char delim, ASIO_MOVE_ARG(ReadHandler) handler);
|
||||
asio::basic_streambuf<Allocator>& b, char delim,
|
||||
ASIO_MOVE_ARG(ReadHandler) handler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN(
|
||||
typename AsyncReadStream::executor_type));
|
||||
|
||||
/// Start an asynchronous operation to read data into a streambuf until it
|
||||
/// contains a specified delimiter.
|
||||
@@ -2116,13 +2144,19 @@ async_read_until(AsyncReadStream& s,
|
||||
* This data may be the start of a new line, to be extracted by a subsequent
|
||||
* @c async_read_until operation.
|
||||
*/
|
||||
template <typename AsyncReadStream, typename Allocator, typename ReadHandler>
|
||||
ASIO_INITFN_RESULT_TYPE(ReadHandler,
|
||||
template <typename AsyncReadStream, typename Allocator,
|
||||
ASIO_COMPLETION_TOKEN_FOR(void (asio::error_code,
|
||||
std::size_t)) ReadHandler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(
|
||||
typename AsyncReadStream::executor_type)>
|
||||
ASIO_INITFN_AUTO_RESULT_TYPE(ReadHandler,
|
||||
void (asio::error_code, std::size_t))
|
||||
async_read_until(AsyncReadStream& s,
|
||||
asio::basic_streambuf<Allocator>& b,
|
||||
ASIO_STRING_VIEW_PARAM delim,
|
||||
ASIO_MOVE_ARG(ReadHandler) handler);
|
||||
ASIO_MOVE_ARG(ReadHandler) handler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN(
|
||||
typename AsyncReadStream::executor_type));
|
||||
|
||||
#if defined(ASIO_HAS_BOOST_REGEX) \
|
||||
|| defined(GENERATING_DOCUMENTATION)
|
||||
@@ -2209,12 +2243,18 @@ async_read_until(AsyncReadStream& s,
|
||||
* This data may be the start of a new line, to be extracted by a subsequent
|
||||
* @c async_read_until operation.
|
||||
*/
|
||||
template <typename AsyncReadStream, typename Allocator, typename ReadHandler>
|
||||
ASIO_INITFN_RESULT_TYPE(ReadHandler,
|
||||
template <typename AsyncReadStream, typename Allocator,
|
||||
ASIO_COMPLETION_TOKEN_FOR(void (asio::error_code,
|
||||
std::size_t)) ReadHandler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(
|
||||
typename AsyncReadStream::executor_type)>
|
||||
ASIO_INITFN_AUTO_RESULT_TYPE(ReadHandler,
|
||||
void (asio::error_code, std::size_t))
|
||||
async_read_until(AsyncReadStream& s,
|
||||
asio::basic_streambuf<Allocator>& b, const boost::regex& expr,
|
||||
ASIO_MOVE_ARG(ReadHandler) handler);
|
||||
ASIO_MOVE_ARG(ReadHandler) handler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN(
|
||||
typename AsyncReadStream::executor_type));
|
||||
|
||||
#endif // defined(ASIO_HAS_BOOST_REGEX)
|
||||
// || defined(GENERATING_DOCUMENTATION)
|
||||
@@ -2342,13 +2382,19 @@ async_read_until(AsyncReadStream& s,
|
||||
* asio::async_read_until(s, b, match_char('a'), handler);
|
||||
* @endcode
|
||||
*/
|
||||
template <typename AsyncReadStream, typename Allocator,
|
||||
typename MatchCondition, typename ReadHandler>
|
||||
ASIO_INITFN_RESULT_TYPE(ReadHandler,
|
||||
template <typename AsyncReadStream, typename Allocator, typename MatchCondition,
|
||||
ASIO_COMPLETION_TOKEN_FOR(void (asio::error_code,
|
||||
std::size_t)) ReadHandler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(
|
||||
typename AsyncReadStream::executor_type)>
|
||||
ASIO_INITFN_AUTO_RESULT_TYPE(ReadHandler,
|
||||
void (asio::error_code, std::size_t))
|
||||
async_read_until(AsyncReadStream& s,
|
||||
asio::basic_streambuf<Allocator>& b,
|
||||
MatchCondition match_condition, ASIO_MOVE_ARG(ReadHandler) handler,
|
||||
MatchCondition match_condition,
|
||||
ASIO_MOVE_ARG(ReadHandler) handler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN(
|
||||
typename AsyncReadStream::executor_type),
|
||||
typename enable_if<is_match_condition<MatchCondition>::value>::type* = 0);
|
||||
|
||||
#endif // !defined(ASIO_NO_IOSTREAM)
|
||||
@@ -2437,12 +2483,17 @@ async_read_until(AsyncReadStream& s,
|
||||
* This data may be the start of a new line, to be extracted by a subsequent
|
||||
* @c async_read_until operation.
|
||||
*/
|
||||
template <typename AsyncReadStream,
|
||||
typename DynamicBuffer_v2, typename ReadHandler>
|
||||
ASIO_INITFN_RESULT_TYPE(ReadHandler,
|
||||
template <typename AsyncReadStream, typename DynamicBuffer_v2,
|
||||
ASIO_COMPLETION_TOKEN_FOR(void (asio::error_code,
|
||||
std::size_t)) ReadHandler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(
|
||||
typename AsyncReadStream::executor_type)>
|
||||
ASIO_INITFN_AUTO_RESULT_TYPE(ReadHandler,
|
||||
void (asio::error_code, std::size_t))
|
||||
async_read_until(AsyncReadStream& s, DynamicBuffer_v2 buffers,
|
||||
char delim, ASIO_MOVE_ARG(ReadHandler) handler,
|
||||
async_read_until(AsyncReadStream& s, DynamicBuffer_v2 buffers, char delim,
|
||||
ASIO_MOVE_ARG(ReadHandler) handler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN(
|
||||
typename AsyncReadStream::executor_type),
|
||||
typename enable_if<
|
||||
is_dynamic_buffer_v2<DynamicBuffer_v2>::value
|
||||
>::type* = 0);
|
||||
@@ -2529,13 +2580,18 @@ async_read_until(AsyncReadStream& s, DynamicBuffer_v2 buffers,
|
||||
* This data may be the start of a new line, to be extracted by a subsequent
|
||||
* @c async_read_until operation.
|
||||
*/
|
||||
template <typename AsyncReadStream,
|
||||
typename DynamicBuffer_v2, typename ReadHandler>
|
||||
ASIO_INITFN_RESULT_TYPE(ReadHandler,
|
||||
template <typename AsyncReadStream, typename DynamicBuffer_v2,
|
||||
ASIO_COMPLETION_TOKEN_FOR(void (asio::error_code,
|
||||
std::size_t)) ReadHandler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(
|
||||
typename AsyncReadStream::executor_type)>
|
||||
ASIO_INITFN_AUTO_RESULT_TYPE(ReadHandler,
|
||||
void (asio::error_code, std::size_t))
|
||||
async_read_until(AsyncReadStream& s, DynamicBuffer_v2 buffers,
|
||||
ASIO_STRING_VIEW_PARAM delim,
|
||||
ASIO_MOVE_ARG(ReadHandler) handler,
|
||||
ASIO_MOVE_ARG(ReadHandler) handler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN(
|
||||
typename AsyncReadStream::executor_type),
|
||||
typename enable_if<
|
||||
is_dynamic_buffer_v2<DynamicBuffer_v2>::value
|
||||
>::type* = 0);
|
||||
@@ -2629,13 +2685,18 @@ async_read_until(AsyncReadStream& s, DynamicBuffer_v2 buffers,
|
||||
* This data may be the start of a new line, to be extracted by a subsequent
|
||||
* @c async_read_until operation.
|
||||
*/
|
||||
template <typename AsyncReadStream,
|
||||
typename DynamicBuffer_v2, typename ReadHandler>
|
||||
ASIO_INITFN_RESULT_TYPE(ReadHandler,
|
||||
template <typename AsyncReadStream, typename DynamicBuffer_v2,
|
||||
ASIO_COMPLETION_TOKEN_FOR(void (asio::error_code,
|
||||
std::size_t)) ReadHandler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(
|
||||
typename AsyncReadStream::executor_type)>
|
||||
ASIO_INITFN_AUTO_RESULT_TYPE(ReadHandler,
|
||||
void (asio::error_code, std::size_t))
|
||||
async_read_until(AsyncReadStream& s, DynamicBuffer_v2 buffers,
|
||||
const boost::regex& expr,
|
||||
ASIO_MOVE_ARG(ReadHandler) handler,
|
||||
ASIO_MOVE_ARG(ReadHandler) handler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN(
|
||||
typename AsyncReadStream::executor_type),
|
||||
typename enable_if<
|
||||
is_dynamic_buffer_v2<DynamicBuffer_v2>::value
|
||||
>::type* = 0);
|
||||
@@ -2771,12 +2832,19 @@ async_read_until(AsyncReadStream& s, DynamicBuffer_v2 buffers,
|
||||
* asio::async_read_until(s, data, match_char('a'), handler);
|
||||
* @endcode
|
||||
*/
|
||||
template <typename AsyncReadStream, typename DynamicBuffer_v2,
|
||||
typename MatchCondition, typename ReadHandler>
|
||||
ASIO_INITFN_RESULT_TYPE(ReadHandler,
|
||||
template <typename AsyncReadStream,
|
||||
typename DynamicBuffer_v2, typename MatchCondition,
|
||||
ASIO_COMPLETION_TOKEN_FOR(void (asio::error_code,
|
||||
std::size_t)) ReadHandler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(
|
||||
typename AsyncReadStream::executor_type)>
|
||||
ASIO_INITFN_AUTO_RESULT_TYPE(ReadHandler,
|
||||
void (asio::error_code, std::size_t))
|
||||
async_read_until(AsyncReadStream& s, DynamicBuffer_v2 buffers,
|
||||
MatchCondition match_condition, ASIO_MOVE_ARG(ReadHandler) handler,
|
||||
MatchCondition match_condition,
|
||||
ASIO_MOVE_ARG(ReadHandler) handler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN(
|
||||
typename AsyncReadStream::executor_type),
|
||||
typename enable_if<
|
||||
is_match_condition<MatchCondition>::value
|
||||
&& is_dynamic_buffer_v2<DynamicBuffer_v2>::value
|
||||
|
||||
@@ -85,9 +85,9 @@ public:
|
||||
#endif // (OPENSSL_VERSION_NUMBER >= 0x10002000L)
|
||||
// && (OPENSSL_VERSION_NUMBER < 0x10100000L)
|
||||
// && !defined(SSL_OP_NO_COMPRESSION)
|
||||
#if !defined(OPENSSL_IS_BORINGSSL)
|
||||
#if !defined(OPENSSL_IS_BORINGSSL) && !defined(ASIO_USE_WOLFSSL)
|
||||
::CONF_modules_unload(1);
|
||||
#endif // !defined(OPENSSL_IS_BORINGSSL)
|
||||
#endif // !defined(OPENSSL_IS_BORINGSSL) && !defined(ASIO_USE_WOLFSSL)
|
||||
#if !defined(OPENSSL_NO_ENGINE) \
|
||||
&& (OPENSSL_VERSION_NUMBER < 0x10100000L)
|
||||
::ENGINE_cleanup();
|
||||
|
||||
@@ -17,6 +17,9 @@
|
||||
|
||||
#include "asio/detail/config.hpp"
|
||||
#include "asio/detail/socket_types.hpp"
|
||||
#if defined(ASIO_USE_WOLFSSL)
|
||||
# include <wolfssl/options.h>
|
||||
#endif // defined(ASIO_USE_WOLFSSL)
|
||||
#include <openssl/conf.h>
|
||||
#include <openssl/ssl.h>
|
||||
#if !defined(OPENSSL_NO_ENGINE)
|
||||
|
||||
@@ -54,7 +54,9 @@ enum stream_errors
|
||||
/// call.
|
||||
unexpected_result
|
||||
#else // defined(GENERATING_DOCUMENTATION)
|
||||
# if (OPENSSL_VERSION_NUMBER < 0x10100000L) && !defined(OPENSSL_IS_BORINGSSL)
|
||||
# if (OPENSSL_VERSION_NUMBER < 0x10100000L) \
|
||||
&& !defined(OPENSSL_IS_BORINGSSL) \
|
||||
&& !defined(ASIO_USE_WOLFSSL)
|
||||
stream_truncated = ERR_PACK(ERR_LIB_SSL, 0, SSL_R_SHORT_READ),
|
||||
# else
|
||||
stream_truncated = 1,
|
||||
|
||||
@@ -386,7 +386,9 @@ context::~context()
|
||||
{
|
||||
if (handle_)
|
||||
{
|
||||
#if (OPENSSL_VERSION_NUMBER >= 0x10100000L) && !defined(LIBRESSL_VERSION_NUMBER)
|
||||
#if ((OPENSSL_VERSION_NUMBER >= 0x10100000L) \
|
||||
&& !defined(LIBRESSL_VERSION_NUMBER)) \
|
||||
|| defined(ASIO_USE_WOLFSSL)
|
||||
void* cb_userdata = ::SSL_CTX_get_default_passwd_cb_userdata(handle_);
|
||||
#else // (OPENSSL_VERSION_NUMBER >= 0x10100000L)
|
||||
void* cb_userdata = handle_->default_passwd_callback_userdata;
|
||||
@@ -397,7 +399,9 @@ context::~context()
|
||||
static_cast<detail::password_callback_base*>(
|
||||
cb_userdata);
|
||||
delete callback;
|
||||
#if (OPENSSL_VERSION_NUMBER >= 0x10100000L) && !defined(LIBRESSL_VERSION_NUMBER)
|
||||
#if ((OPENSSL_VERSION_NUMBER >= 0x10100000L) \
|
||||
&& !defined(LIBRESSL_VERSION_NUMBER)) \
|
||||
|| defined(ASIO_USE_WOLFSSL)
|
||||
::SSL_CTX_set_default_passwd_cb_userdata(handle_, 0);
|
||||
#else // (OPENSSL_VERSION_NUMBER >= 0x10100000L)
|
||||
handle_->default_passwd_callback_userdata = 0;
|
||||
@@ -734,7 +738,9 @@ ASIO_SYNC_OP_VOID context::use_certificate_chain(
|
||||
bio_cleanup bio = { make_buffer_bio(chain) };
|
||||
if (bio.p)
|
||||
{
|
||||
#if (OPENSSL_VERSION_NUMBER >= 0x10100000L) && !defined(LIBRESSL_VERSION_NUMBER)
|
||||
#if ((OPENSSL_VERSION_NUMBER >= 0x10100000L) \
|
||||
&& !defined(LIBRESSL_VERSION_NUMBER)) \
|
||||
|| defined(ASIO_USE_WOLFSSL)
|
||||
pem_password_cb* callback = ::SSL_CTX_get_default_passwd_cb(handle_);
|
||||
void* cb_userdata = ::SSL_CTX_get_default_passwd_cb_userdata(handle_);
|
||||
#else // (OPENSSL_VERSION_NUMBER >= 0x10100000L)
|
||||
@@ -761,7 +767,9 @@ ASIO_SYNC_OP_VOID context::use_certificate_chain(
|
||||
ASIO_SYNC_OP_VOID_RETURN(ec);
|
||||
}
|
||||
|
||||
#if (OPENSSL_VERSION_NUMBER >= 0x10002000L) && !defined(LIBRESSL_VERSION_NUMBER)
|
||||
#if ((OPENSSL_VERSION_NUMBER >= 0x10002000L) \
|
||||
&& !defined(LIBRESSL_VERSION_NUMBER)) \
|
||||
|| defined(ASIO_USE_WOLFSSL)
|
||||
::SSL_CTX_clear_chain_certs(handle_);
|
||||
#else
|
||||
if (handle_->extra_certs)
|
||||
@@ -838,7 +846,9 @@ ASIO_SYNC_OP_VOID context::use_private_key(
|
||||
{
|
||||
::ERR_clear_error();
|
||||
|
||||
#if (OPENSSL_VERSION_NUMBER >= 0x10100000L) && !defined(LIBRESSL_VERSION_NUMBER)
|
||||
#if ((OPENSSL_VERSION_NUMBER >= 0x10100000L) \
|
||||
&& !defined(LIBRESSL_VERSION_NUMBER)) \
|
||||
|| defined(ASIO_USE_WOLFSSL)
|
||||
pem_password_cb* callback = ::SSL_CTX_get_default_passwd_cb(handle_);
|
||||
void* cb_userdata = ::SSL_CTX_get_default_passwd_cb_userdata(handle_);
|
||||
#else // (OPENSSL_VERSION_NUMBER >= 0x10100000L)
|
||||
@@ -905,7 +915,9 @@ ASIO_SYNC_OP_VOID context::use_rsa_private_key(
|
||||
{
|
||||
::ERR_clear_error();
|
||||
|
||||
#if (OPENSSL_VERSION_NUMBER >= 0x10100000L) && !defined(LIBRESSL_VERSION_NUMBER)
|
||||
#if ((OPENSSL_VERSION_NUMBER >= 0x10100000L) \
|
||||
&& !defined(LIBRESSL_VERSION_NUMBER)) \
|
||||
|| defined(ASIO_USE_WOLFSSL)
|
||||
pem_password_cb* callback = ::SSL_CTX_get_default_passwd_cb(handle_);
|
||||
void* cb_userdata = ::SSL_CTX_get_default_passwd_cb_userdata(handle_);
|
||||
#else // (OPENSSL_VERSION_NUMBER >= 0x10100000L)
|
||||
@@ -1144,7 +1156,9 @@ int context::verify_callback_function(int preverified, X509_STORE_CTX* ctx)
|
||||
ASIO_SYNC_OP_VOID context::do_set_password_callback(
|
||||
detail::password_callback_base* callback, asio::error_code& ec)
|
||||
{
|
||||
#if (OPENSSL_VERSION_NUMBER >= 0x10100000L) && !defined(LIBRESSL_VERSION_NUMBER)
|
||||
#if ((OPENSSL_VERSION_NUMBER >= 0x10100000L) \
|
||||
&& !defined(LIBRESSL_VERSION_NUMBER)) \
|
||||
|| defined(ASIO_USE_WOLFSSL)
|
||||
void* old_callback = ::SSL_CTX_get_default_passwd_cb_userdata(handle_);
|
||||
::SSL_CTX_set_default_passwd_cb_userdata(handle_, callback);
|
||||
#else // (OPENSSL_VERSION_NUMBER >= 0x10100000L)
|
||||
|
||||
@@ -430,15 +430,19 @@ public:
|
||||
* const asio::error_code& error // Result of operation.
|
||||
* ); @endcode
|
||||
*/
|
||||
template <typename HandshakeHandler>
|
||||
ASIO_INITFN_RESULT_TYPE(HandshakeHandler,
|
||||
template <
|
||||
ASIO_COMPLETION_TOKEN_FOR(void (asio::error_code))
|
||||
HandshakeHandler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(executor_type)>
|
||||
ASIO_INITFN_AUTO_RESULT_TYPE(HandshakeHandler,
|
||||
void (asio::error_code))
|
||||
async_handshake(handshake_type type,
|
||||
ASIO_MOVE_ARG(HandshakeHandler) handler)
|
||||
ASIO_MOVE_ARG(HandshakeHandler) handler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN(executor_type))
|
||||
{
|
||||
return async_initiate<HandshakeHandler,
|
||||
void (asio::error_code)>(
|
||||
initiate_async_handshake(), handler, this, type);
|
||||
initiate_async_handshake(this), handler, type);
|
||||
}
|
||||
|
||||
/// Start an asynchronous SSL handshake.
|
||||
@@ -462,15 +466,19 @@ public:
|
||||
* std::size_t bytes_transferred // Amount of buffers used in handshake.
|
||||
* ); @endcode
|
||||
*/
|
||||
template <typename ConstBufferSequence, typename BufferedHandshakeHandler>
|
||||
ASIO_INITFN_RESULT_TYPE(BufferedHandshakeHandler,
|
||||
template <typename ConstBufferSequence,
|
||||
ASIO_COMPLETION_TOKEN_FOR(void (asio::error_code,
|
||||
std::size_t)) BufferedHandshakeHandler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(executor_type)>
|
||||
ASIO_INITFN_AUTO_RESULT_TYPE(BufferedHandshakeHandler,
|
||||
void (asio::error_code, std::size_t))
|
||||
async_handshake(handshake_type type, const ConstBufferSequence& buffers,
|
||||
ASIO_MOVE_ARG(BufferedHandshakeHandler) handler)
|
||||
ASIO_MOVE_ARG(BufferedHandshakeHandler) handler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN(executor_type))
|
||||
{
|
||||
return async_initiate<BufferedHandshakeHandler,
|
||||
void (asio::error_code, std::size_t)>(
|
||||
initiate_async_buffered_handshake(), handler, this, type, buffers);
|
||||
initiate_async_buffered_handshake(this), handler, type, buffers);
|
||||
}
|
||||
|
||||
/// Shut down SSL on the stream.
|
||||
@@ -512,14 +520,19 @@ public:
|
||||
* const asio::error_code& error // Result of operation.
|
||||
* ); @endcode
|
||||
*/
|
||||
template <typename ShutdownHandler>
|
||||
ASIO_INITFN_RESULT_TYPE(ShutdownHandler,
|
||||
template <
|
||||
ASIO_COMPLETION_TOKEN_FOR(void (asio::error_code))
|
||||
ShutdownHandler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(executor_type)>
|
||||
ASIO_INITFN_AUTO_RESULT_TYPE(ShutdownHandler,
|
||||
void (asio::error_code))
|
||||
async_shutdown(ASIO_MOVE_ARG(ShutdownHandler) handler)
|
||||
async_shutdown(
|
||||
ASIO_MOVE_ARG(ShutdownHandler) handler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN(executor_type))
|
||||
{
|
||||
return async_initiate<ShutdownHandler,
|
||||
void (asio::error_code)>(
|
||||
initiate_async_shutdown(), handler, this);
|
||||
initiate_async_shutdown(this), handler);
|
||||
}
|
||||
|
||||
/// Write some data to the stream.
|
||||
@@ -594,15 +607,19 @@ public:
|
||||
* ensure that all data is written before the asynchronous operation
|
||||
* completes.
|
||||
*/
|
||||
template <typename ConstBufferSequence, typename WriteHandler>
|
||||
ASIO_INITFN_RESULT_TYPE(WriteHandler,
|
||||
template <typename ConstBufferSequence,
|
||||
ASIO_COMPLETION_TOKEN_FOR(void (asio::error_code,
|
||||
std::size_t)) WriteHandler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(executor_type)>
|
||||
ASIO_INITFN_AUTO_RESULT_TYPE(WriteHandler,
|
||||
void (asio::error_code, std::size_t))
|
||||
async_write_some(const ConstBufferSequence& buffers,
|
||||
ASIO_MOVE_ARG(WriteHandler) handler)
|
||||
ASIO_MOVE_ARG(WriteHandler) handler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN(executor_type))
|
||||
{
|
||||
return async_initiate<WriteHandler,
|
||||
void (asio::error_code, std::size_t)>(
|
||||
initiate_async_write_some(), handler, this, buffers);
|
||||
initiate_async_write_some(this), handler, buffers);
|
||||
}
|
||||
|
||||
/// Read some data from the stream.
|
||||
@@ -677,40 +694,72 @@ public:
|
||||
* ensure that the requested amount of data is read before the asynchronous
|
||||
* operation completes.
|
||||
*/
|
||||
template <typename MutableBufferSequence, typename ReadHandler>
|
||||
ASIO_INITFN_RESULT_TYPE(ReadHandler,
|
||||
template <typename MutableBufferSequence,
|
||||
ASIO_COMPLETION_TOKEN_FOR(void (asio::error_code,
|
||||
std::size_t)) ReadHandler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(executor_type)>
|
||||
ASIO_INITFN_AUTO_RESULT_TYPE(ReadHandler,
|
||||
void (asio::error_code, std::size_t))
|
||||
async_read_some(const MutableBufferSequence& buffers,
|
||||
ASIO_MOVE_ARG(ReadHandler) handler)
|
||||
ASIO_MOVE_ARG(ReadHandler) handler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN(executor_type))
|
||||
{
|
||||
return async_initiate<ReadHandler,
|
||||
void (asio::error_code, std::size_t)>(
|
||||
initiate_async_read_some(), handler, this, buffers);
|
||||
initiate_async_read_some(this), handler, buffers);
|
||||
}
|
||||
|
||||
private:
|
||||
struct initiate_async_handshake
|
||||
class initiate_async_handshake
|
||||
{
|
||||
public:
|
||||
typedef typename stream::executor_type executor_type;
|
||||
|
||||
explicit initiate_async_handshake(stream* self)
|
||||
: self_(self)
|
||||
{
|
||||
}
|
||||
|
||||
executor_type get_executor() const ASIO_NOEXCEPT
|
||||
{
|
||||
return self_->get_executor();
|
||||
}
|
||||
|
||||
template <typename HandshakeHandler>
|
||||
void operator()(ASIO_MOVE_ARG(HandshakeHandler) handler,
|
||||
stream* self, handshake_type type) const
|
||||
handshake_type type) const
|
||||
{
|
||||
// If you get an error on the following line it means that your handler
|
||||
// does not meet the documented type requirements for a HandshakeHandler.
|
||||
ASIO_HANDSHAKE_HANDLER_CHECK(HandshakeHandler, handler) type_check;
|
||||
|
||||
asio::detail::non_const_lvalue<HandshakeHandler> handler2(handler);
|
||||
detail::async_io(self->next_layer_, self->core_,
|
||||
detail::async_io(self_->next_layer_, self_->core_,
|
||||
detail::handshake_op(type), handler2.value);
|
||||
}
|
||||
|
||||
private:
|
||||
stream* self_;
|
||||
};
|
||||
|
||||
struct initiate_async_buffered_handshake
|
||||
class initiate_async_buffered_handshake
|
||||
{
|
||||
public:
|
||||
typedef typename stream::executor_type executor_type;
|
||||
|
||||
explicit initiate_async_buffered_handshake(stream* self)
|
||||
: self_(self)
|
||||
{
|
||||
}
|
||||
|
||||
executor_type get_executor() const ASIO_NOEXCEPT
|
||||
{
|
||||
return self_->get_executor();
|
||||
}
|
||||
|
||||
template <typename BufferedHandshakeHandler, typename ConstBufferSequence>
|
||||
void operator()(ASIO_MOVE_ARG(BufferedHandshakeHandler) handler,
|
||||
stream* self, handshake_type type,
|
||||
const ConstBufferSequence& buffers) const
|
||||
handshake_type type, const ConstBufferSequence& buffers) const
|
||||
{
|
||||
// If you get an error on the following line it means that your
|
||||
// handler does not meet the documented type requirements for a
|
||||
@@ -720,58 +769,108 @@ private:
|
||||
|
||||
asio::detail::non_const_lvalue<
|
||||
BufferedHandshakeHandler> handler2(handler);
|
||||
detail::async_io(self->next_layer_, self->core_,
|
||||
detail::async_io(self_->next_layer_, self_->core_,
|
||||
detail::buffered_handshake_op<ConstBufferSequence>(type, buffers),
|
||||
handler2.value);
|
||||
}
|
||||
|
||||
private:
|
||||
stream* self_;
|
||||
};
|
||||
|
||||
struct initiate_async_shutdown
|
||||
class initiate_async_shutdown
|
||||
{
|
||||
public:
|
||||
typedef typename stream::executor_type executor_type;
|
||||
|
||||
explicit initiate_async_shutdown(stream* self)
|
||||
: self_(self)
|
||||
{
|
||||
}
|
||||
|
||||
executor_type get_executor() const ASIO_NOEXCEPT
|
||||
{
|
||||
return self_->get_executor();
|
||||
}
|
||||
|
||||
template <typename ShutdownHandler>
|
||||
void operator()(ASIO_MOVE_ARG(ShutdownHandler) handler,
|
||||
stream* self) const
|
||||
void operator()(ASIO_MOVE_ARG(ShutdownHandler) handler) const
|
||||
{
|
||||
// If you get an error on the following line it means that your handler
|
||||
// does not meet the documented type requirements for a ShutdownHandler.
|
||||
ASIO_HANDSHAKE_HANDLER_CHECK(ShutdownHandler, handler) type_check;
|
||||
|
||||
asio::detail::non_const_lvalue<ShutdownHandler> handler2(handler);
|
||||
detail::async_io(self->next_layer_, self->core_,
|
||||
detail::async_io(self_->next_layer_, self_->core_,
|
||||
detail::shutdown_op(), handler2.value);
|
||||
}
|
||||
|
||||
private:
|
||||
stream* self_;
|
||||
};
|
||||
|
||||
struct initiate_async_write_some
|
||||
class initiate_async_write_some
|
||||
{
|
||||
public:
|
||||
typedef typename stream::executor_type executor_type;
|
||||
|
||||
explicit initiate_async_write_some(stream* self)
|
||||
: self_(self)
|
||||
{
|
||||
}
|
||||
|
||||
executor_type get_executor() const ASIO_NOEXCEPT
|
||||
{
|
||||
return self_->get_executor();
|
||||
}
|
||||
|
||||
template <typename WriteHandler, typename ConstBufferSequence>
|
||||
void operator()(ASIO_MOVE_ARG(WriteHandler) handler,
|
||||
stream* self, const ConstBufferSequence& buffers) const
|
||||
const ConstBufferSequence& buffers) const
|
||||
{
|
||||
// If you get an error on the following line it means that your handler
|
||||
// does not meet the documented type requirements for a WriteHandler.
|
||||
ASIO_WRITE_HANDLER_CHECK(WriteHandler, handler) type_check;
|
||||
|
||||
asio::detail::non_const_lvalue<WriteHandler> handler2(handler);
|
||||
detail::async_io(self->next_layer_, self->core_,
|
||||
detail::async_io(self_->next_layer_, self_->core_,
|
||||
detail::write_op<ConstBufferSequence>(buffers), handler2.value);
|
||||
}
|
||||
|
||||
private:
|
||||
stream* self_;
|
||||
};
|
||||
|
||||
struct initiate_async_read_some
|
||||
class initiate_async_read_some
|
||||
{
|
||||
public:
|
||||
typedef typename stream::executor_type executor_type;
|
||||
|
||||
explicit initiate_async_read_some(stream* self)
|
||||
: self_(self)
|
||||
{
|
||||
}
|
||||
|
||||
executor_type get_executor() const ASIO_NOEXCEPT
|
||||
{
|
||||
return self_->get_executor();
|
||||
}
|
||||
|
||||
template <typename ReadHandler, typename MutableBufferSequence>
|
||||
void operator()(ASIO_MOVE_ARG(ReadHandler) handler,
|
||||
stream* self, const MutableBufferSequence& buffers) const
|
||||
const MutableBufferSequence& buffers) const
|
||||
{
|
||||
// If you get an error on the following line it means that your handler
|
||||
// does not meet the documented type requirements for a ReadHandler.
|
||||
ASIO_READ_HANDLER_CHECK(ReadHandler, handler) type_check;
|
||||
|
||||
asio::detail::non_const_lvalue<ReadHandler> handler2(handler);
|
||||
detail::async_io(self->next_layer_, self->core_,
|
||||
detail::async_io(self_->next_layer_, self_->core_,
|
||||
detail::read_op<MutableBufferSequence>(buffers), handler2.value);
|
||||
}
|
||||
|
||||
private:
|
||||
stream* self_;
|
||||
};
|
||||
|
||||
Stream next_layer_;
|
||||
|
||||
@@ -45,9 +45,47 @@ namespace asio {
|
||||
template <typename Executor = executor>
|
||||
struct use_awaitable_t
|
||||
{
|
||||
/// Default constructor.
|
||||
ASIO_CONSTEXPR use_awaitable_t()
|
||||
{
|
||||
}
|
||||
|
||||
/// Adapts an executor to add the @c use_awaitable_t completion token as the
|
||||
/// default.
|
||||
template <typename InnerExecutor>
|
||||
struct executor_with_default : InnerExecutor
|
||||
{
|
||||
/// Specify @c use_awaitable_t as the default completion token type.
|
||||
typedef use_awaitable_t default_completion_token_type;
|
||||
|
||||
/// Construct the adapted executor from the inner executor type.
|
||||
executor_with_default(const InnerExecutor& ex) ASIO_NOEXCEPT
|
||||
: InnerExecutor(ex)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
/// Type alias to adapt an I/O object to use @c use_awaitable_t as its
|
||||
/// default completion token type.
|
||||
#if defined(ASIO_HAS_ALIAS_TEMPLATES) \
|
||||
|| defined(GENERATING_DOCUMENTATION)
|
||||
template <typename T>
|
||||
using as_default_on_t = typename T::template rebind_executor<
|
||||
executor_with_default<typename T::executor_type> >::other;
|
||||
#endif // defined(ASIO_HAS_ALIAS_TEMPLATES)
|
||||
// || defined(GENERATING_DOCUMENTATION)
|
||||
|
||||
/// Function helper to adapt an I/O object to use @c use_awaitable_t as its
|
||||
/// default completion token type.
|
||||
template <typename T>
|
||||
static typename T::template rebind_executor<
|
||||
executor_with_default<typename T::executor_type>
|
||||
>::other
|
||||
as_default_on(ASIO_MOVE_ARG(T) object)
|
||||
{
|
||||
return typename as_default_on_t<typename decay<T>::type>::type(
|
||||
ASIO_MOVE_CAST(T)(object));
|
||||
}
|
||||
};
|
||||
|
||||
/// A completion token object that represents the currently executing coroutine.
|
||||
|
||||
@@ -18,6 +18,6 @@
|
||||
// ASIO_VERSION % 100 is the sub-minor version
|
||||
// ASIO_VERSION / 100 % 1000 is the minor version
|
||||
// ASIO_VERSION / 100000 is the major version
|
||||
#define ASIO_VERSION 101400 // 1.14.0
|
||||
#define ASIO_VERSION 101600 // 1.16.0
|
||||
|
||||
#endif // ASIO_VERSION_HPP
|
||||
|
||||
@@ -54,6 +54,14 @@ public:
|
||||
/// The type of the executor associated with the object.
|
||||
typedef Executor executor_type;
|
||||
|
||||
/// Rebinds the handle type to another executor.
|
||||
template <typename Executor1>
|
||||
struct rebind_executor
|
||||
{
|
||||
/// The handle type when rebound to the specified executor.
|
||||
typedef basic_object_handle<Executor1> other;
|
||||
};
|
||||
|
||||
/// The native representation of a handle.
|
||||
#if defined(GENERATING_DOCUMENTATION)
|
||||
typedef implementation_defined native_handle_type;
|
||||
@@ -362,18 +370,17 @@ public:
|
||||
* immediate completion, invocation of the handler will be performed in a
|
||||
* manner equivalent to using asio::post().
|
||||
*/
|
||||
template <typename WaitHandler>
|
||||
ASIO_INITFN_RESULT_TYPE(WaitHandler,
|
||||
template <
|
||||
ASIO_COMPLETION_TOKEN_FOR(void (asio::error_code))
|
||||
WaitHandler ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(executor_type)>
|
||||
ASIO_INITFN_AUTO_RESULT_TYPE(WaitHandler,
|
||||
void (asio::error_code))
|
||||
async_wait(ASIO_MOVE_ARG(WaitHandler) handler)
|
||||
async_wait(
|
||||
ASIO_MOVE_ARG(WaitHandler) handler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN(executor_type))
|
||||
{
|
||||
asio::async_completion<WaitHandler,
|
||||
void (asio::error_code)> init(handler);
|
||||
|
||||
impl_.get_service().async_wait(impl_.get_implementation(),
|
||||
init.completion_handler, impl_.get_implementation_executor());
|
||||
|
||||
return init.result.get();
|
||||
return async_initiate<WaitHandler, void (asio::error_code)>(
|
||||
initiate_async_wait(this), handler);
|
||||
}
|
||||
|
||||
private:
|
||||
@@ -381,6 +388,38 @@ private:
|
||||
basic_object_handle(const basic_object_handle&) ASIO_DELETED;
|
||||
basic_object_handle& operator=(const basic_object_handle&) ASIO_DELETED;
|
||||
|
||||
class initiate_async_wait
|
||||
{
|
||||
public:
|
||||
typedef Executor executor_type;
|
||||
|
||||
explicit initiate_async_wait(basic_object_handle* self)
|
||||
: self_(self)
|
||||
{
|
||||
}
|
||||
|
||||
executor_type get_executor() const ASIO_NOEXCEPT
|
||||
{
|
||||
return self_->get_executor();
|
||||
}
|
||||
|
||||
template <typename WaitHandler>
|
||||
void operator()(ASIO_MOVE_ARG(WaitHandler) handler) const
|
||||
{
|
||||
// If you get an error on the following line it means that your handler
|
||||
// does not meet the documented type requirements for a WaitHandler.
|
||||
ASIO_WAIT_HANDLER_CHECK(WaitHandler, handler) type_check;
|
||||
|
||||
detail::non_const_lvalue<WaitHandler> handler2(handler);
|
||||
self_->impl_.get_service().async_wait(
|
||||
self_->impl_.get_implementation(), handler2.value,
|
||||
self_->impl_.get_implementation_executor());
|
||||
}
|
||||
|
||||
private:
|
||||
basic_object_handle* self_;
|
||||
};
|
||||
|
||||
asio::detail::io_object_impl<
|
||||
asio::detail::win_object_handle_service, Executor> impl_;
|
||||
};
|
||||
|
||||
@@ -57,6 +57,14 @@ public:
|
||||
/// The type of the executor associated with the object.
|
||||
typedef Executor executor_type;
|
||||
|
||||
/// Rebinds the handle type to another executor.
|
||||
template <typename Executor1>
|
||||
struct rebind_executor
|
||||
{
|
||||
/// The handle type when rebound to the specified executor.
|
||||
typedef basic_overlapped_handle<Executor1> other;
|
||||
};
|
||||
|
||||
/// The native representation of a handle.
|
||||
#if defined(GENERATING_DOCUMENTATION)
|
||||
typedef implementation_defined native_handle_type;
|
||||
|
||||
@@ -43,6 +43,14 @@ public:
|
||||
/// The type of the executor associated with the object.
|
||||
typedef Executor executor_type;
|
||||
|
||||
/// Rebinds the handle type to another executor.
|
||||
template <typename Executor1>
|
||||
struct rebind_executor
|
||||
{
|
||||
/// The handle type when rebound to the specified executor.
|
||||
typedef basic_random_access_handle<Executor1> other;
|
||||
};
|
||||
|
||||
/// The native representation of a handle.
|
||||
#if defined(GENERATING_DOCUMENTATION)
|
||||
typedef implementation_defined native_handle_type;
|
||||
@@ -265,26 +273,20 @@ public:
|
||||
* buffers in one go, and how to use it with arrays, boost::array or
|
||||
* std::vector.
|
||||
*/
|
||||
template <typename ConstBufferSequence, typename WriteHandler>
|
||||
ASIO_INITFN_RESULT_TYPE(WriteHandler,
|
||||
template <typename ConstBufferSequence,
|
||||
ASIO_COMPLETION_TOKEN_FOR(void (asio::error_code,
|
||||
std::size_t)) WriteHandler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(executor_type)>
|
||||
ASIO_INITFN_AUTO_RESULT_TYPE(WriteHandler,
|
||||
void (asio::error_code, std::size_t))
|
||||
async_write_some_at(uint64_t offset,
|
||||
const ConstBufferSequence& buffers,
|
||||
ASIO_MOVE_ARG(WriteHandler) handler)
|
||||
ASIO_MOVE_ARG(WriteHandler) handler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN(executor_type))
|
||||
{
|
||||
// If you get an error on the following line it means that your handler does
|
||||
// not meet the documented type requirements for a WriteHandler.
|
||||
ASIO_WRITE_HANDLER_CHECK(WriteHandler, handler) type_check;
|
||||
|
||||
asio::async_completion<WriteHandler,
|
||||
void (asio::error_code, std::size_t)> init(handler);
|
||||
|
||||
this->impl_.get_service().async_write_some_at(
|
||||
this->impl_.get_implementation(), offset,
|
||||
buffers, init.completion_handler,
|
||||
this->impl_.get_implementation_executor());
|
||||
|
||||
return init.result.get();
|
||||
return async_initiate<WriteHandler,
|
||||
void (asio::error_code, std::size_t)>(
|
||||
initiate_async_write_some_at(this), handler, offset, buffers);
|
||||
}
|
||||
|
||||
/// Read some data from the handle at the specified offset.
|
||||
@@ -393,27 +395,88 @@ public:
|
||||
* buffers in one go, and how to use it with arrays, boost::array or
|
||||
* std::vector.
|
||||
*/
|
||||
template <typename MutableBufferSequence, typename ReadHandler>
|
||||
ASIO_INITFN_RESULT_TYPE(ReadHandler,
|
||||
template <typename MutableBufferSequence,
|
||||
ASIO_COMPLETION_TOKEN_FOR(void (asio::error_code,
|
||||
std::size_t)) ReadHandler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(executor_type)>
|
||||
ASIO_INITFN_AUTO_RESULT_TYPE(ReadHandler,
|
||||
void (asio::error_code, std::size_t))
|
||||
async_read_some_at(uint64_t offset,
|
||||
const MutableBufferSequence& buffers,
|
||||
ASIO_MOVE_ARG(ReadHandler) handler)
|
||||
ASIO_MOVE_ARG(ReadHandler) handler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN(executor_type))
|
||||
{
|
||||
// If you get an error on the following line it means that your handler does
|
||||
// not meet the documented type requirements for a ReadHandler.
|
||||
ASIO_READ_HANDLER_CHECK(ReadHandler, handler) type_check;
|
||||
|
||||
asio::async_completion<ReadHandler,
|
||||
void (asio::error_code, std::size_t)> init(handler);
|
||||
|
||||
this->impl_.get_service().async_read_some_at(
|
||||
this->impl_.get_implementation(), offset,
|
||||
buffers, init.completion_handler,
|
||||
this->impl_.get_implementation_executor());
|
||||
|
||||
return init.result.get();
|
||||
return async_initiate<ReadHandler,
|
||||
void (asio::error_code, std::size_t)>(
|
||||
initiate_async_read_some_at(this), handler, offset, buffers);
|
||||
}
|
||||
|
||||
private:
|
||||
class initiate_async_write_some_at
|
||||
{
|
||||
public:
|
||||
typedef Executor executor_type;
|
||||
|
||||
explicit initiate_async_write_some_at(basic_random_access_handle* self)
|
||||
: self_(self)
|
||||
{
|
||||
}
|
||||
|
||||
executor_type get_executor() const ASIO_NOEXCEPT
|
||||
{
|
||||
return self_->get_executor();
|
||||
}
|
||||
|
||||
template <typename WriteHandler, typename ConstBufferSequence>
|
||||
void operator()(ASIO_MOVE_ARG(WriteHandler) handler,
|
||||
uint64_t offset, const ConstBufferSequence& buffers) const
|
||||
{
|
||||
// If you get an error on the following line it means that your handler
|
||||
// does not meet the documented type requirements for a WriteHandler.
|
||||
ASIO_WRITE_HANDLER_CHECK(WriteHandler, handler) type_check;
|
||||
|
||||
detail::non_const_lvalue<WriteHandler> handler2(handler);
|
||||
self_->impl_.get_service().async_write_some_at(
|
||||
self_->impl_.get_implementation(), offset, buffers, handler2.value,
|
||||
self_->impl_.get_implementation_executor());
|
||||
}
|
||||
|
||||
private:
|
||||
basic_random_access_handle* self_;
|
||||
};
|
||||
|
||||
class initiate_async_read_some_at
|
||||
{
|
||||
public:
|
||||
typedef Executor executor_type;
|
||||
|
||||
explicit initiate_async_read_some_at(basic_random_access_handle* self)
|
||||
: self_(self)
|
||||
{
|
||||
}
|
||||
|
||||
executor_type get_executor() const ASIO_NOEXCEPT
|
||||
{
|
||||
return self_->get_executor();
|
||||
}
|
||||
|
||||
template <typename ReadHandler, typename MutableBufferSequence>
|
||||
void operator()(ASIO_MOVE_ARG(ReadHandler) handler,
|
||||
uint64_t offset, const MutableBufferSequence& buffers) const
|
||||
{
|
||||
// If you get an error on the following line it means that your handler
|
||||
// does not meet the documented type requirements for a ReadHandler.
|
||||
ASIO_READ_HANDLER_CHECK(ReadHandler, handler) type_check;
|
||||
|
||||
detail::non_const_lvalue<ReadHandler> handler2(handler);
|
||||
self_->impl_.get_service().async_read_some_at(
|
||||
self_->impl_.get_implementation(), offset, buffers, handler2.value,
|
||||
self_->impl_.get_implementation_executor());
|
||||
}
|
||||
|
||||
private:
|
||||
basic_random_access_handle* self_;
|
||||
};
|
||||
};
|
||||
|
||||
} // namespace windows
|
||||
|
||||
@@ -46,6 +46,14 @@ public:
|
||||
/// The type of the executor associated with the object.
|
||||
typedef Executor executor_type;
|
||||
|
||||
/// Rebinds the handle type to another executor.
|
||||
template <typename Executor1>
|
||||
struct rebind_executor
|
||||
{
|
||||
/// The handle type when rebound to the specified executor.
|
||||
typedef basic_stream_handle<Executor1> other;
|
||||
};
|
||||
|
||||
/// The native representation of a handle.
|
||||
#if defined(GENERATING_DOCUMENTATION)
|
||||
typedef implementation_defined native_handle_type;
|
||||
@@ -258,25 +266,19 @@ public:
|
||||
* buffers in one go, and how to use it with arrays, boost::array or
|
||||
* std::vector.
|
||||
*/
|
||||
template <typename ConstBufferSequence, typename WriteHandler>
|
||||
ASIO_INITFN_RESULT_TYPE(WriteHandler,
|
||||
template <typename ConstBufferSequence,
|
||||
ASIO_COMPLETION_TOKEN_FOR(void (asio::error_code,
|
||||
std::size_t)) WriteHandler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(executor_type)>
|
||||
ASIO_INITFN_AUTO_RESULT_TYPE(WriteHandler,
|
||||
void (asio::error_code, std::size_t))
|
||||
async_write_some(const ConstBufferSequence& buffers,
|
||||
ASIO_MOVE_ARG(WriteHandler) handler)
|
||||
ASIO_MOVE_ARG(WriteHandler) handler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN(executor_type))
|
||||
{
|
||||
// If you get an error on the following line it means that your handler does
|
||||
// not meet the documented type requirements for a WriteHandler.
|
||||
ASIO_WRITE_HANDLER_CHECK(WriteHandler, handler) type_check;
|
||||
|
||||
asio::async_completion<WriteHandler,
|
||||
void (asio::error_code, std::size_t)> init(handler);
|
||||
|
||||
this->impl_.get_service().async_write_some(
|
||||
this->impl_.get_implementation(),
|
||||
buffers, init.completion_handler,
|
||||
this->impl_.get_implementation_executor());
|
||||
|
||||
return init.result.get();
|
||||
return async_initiate<WriteHandler,
|
||||
void (asio::error_code, std::size_t)>(
|
||||
initiate_async_write_some(this), handler, buffers);
|
||||
}
|
||||
|
||||
/// Read some data from the handle.
|
||||
@@ -378,26 +380,87 @@ public:
|
||||
* buffers in one go, and how to use it with arrays, boost::array or
|
||||
* std::vector.
|
||||
*/
|
||||
template <typename MutableBufferSequence, typename ReadHandler>
|
||||
ASIO_INITFN_RESULT_TYPE(ReadHandler,
|
||||
template <typename MutableBufferSequence,
|
||||
ASIO_COMPLETION_TOKEN_FOR(void (asio::error_code,
|
||||
std::size_t)) ReadHandler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(executor_type)>
|
||||
ASIO_INITFN_AUTO_RESULT_TYPE(ReadHandler,
|
||||
void (asio::error_code, std::size_t))
|
||||
async_read_some(const MutableBufferSequence& buffers,
|
||||
ASIO_MOVE_ARG(ReadHandler) handler)
|
||||
ASIO_MOVE_ARG(ReadHandler) handler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN(executor_type))
|
||||
{
|
||||
// If you get an error on the following line it means that your handler does
|
||||
// not meet the documented type requirements for a ReadHandler.
|
||||
ASIO_READ_HANDLER_CHECK(ReadHandler, handler) type_check;
|
||||
|
||||
asio::async_completion<ReadHandler,
|
||||
void (asio::error_code, std::size_t)> init(handler);
|
||||
|
||||
this->impl_.get_service().async_read_some(
|
||||
this->impl_.get_implementation(),
|
||||
buffers, init.completion_handler,
|
||||
this->impl_.get_implementation_executor());
|
||||
|
||||
return init.result.get();
|
||||
return async_initiate<ReadHandler,
|
||||
void (asio::error_code, std::size_t)>(
|
||||
initiate_async_read_some(this), handler, buffers);
|
||||
}
|
||||
|
||||
private:
|
||||
class initiate_async_write_some
|
||||
{
|
||||
public:
|
||||
typedef Executor executor_type;
|
||||
|
||||
explicit initiate_async_write_some(basic_stream_handle* self)
|
||||
: self_(self)
|
||||
{
|
||||
}
|
||||
|
||||
executor_type get_executor() const ASIO_NOEXCEPT
|
||||
{
|
||||
return self_->get_executor();
|
||||
}
|
||||
|
||||
template <typename WriteHandler, typename ConstBufferSequence>
|
||||
void operator()(ASIO_MOVE_ARG(WriteHandler) handler,
|
||||
const ConstBufferSequence& buffers) const
|
||||
{
|
||||
// If you get an error on the following line it means that your handler
|
||||
// does not meet the documented type requirements for a WriteHandler.
|
||||
ASIO_WRITE_HANDLER_CHECK(WriteHandler, handler) type_check;
|
||||
|
||||
detail::non_const_lvalue<WriteHandler> handler2(handler);
|
||||
self_->impl_.get_service().async_write_some(
|
||||
self_->impl_.get_implementation(), buffers, handler2.value,
|
||||
self_->impl_.get_implementation_executor());
|
||||
}
|
||||
|
||||
private:
|
||||
basic_stream_handle* self_;
|
||||
};
|
||||
|
||||
class initiate_async_read_some
|
||||
{
|
||||
public:
|
||||
typedef Executor executor_type;
|
||||
|
||||
explicit initiate_async_read_some(basic_stream_handle* self)
|
||||
: self_(self)
|
||||
{
|
||||
}
|
||||
|
||||
executor_type get_executor() const ASIO_NOEXCEPT
|
||||
{
|
||||
return self_->get_executor();
|
||||
}
|
||||
|
||||
template <typename ReadHandler, typename MutableBufferSequence>
|
||||
void operator()(ASIO_MOVE_ARG(ReadHandler) handler,
|
||||
const MutableBufferSequence& buffers) const
|
||||
{
|
||||
// If you get an error on the following line it means that your handler
|
||||
// does not meet the documented type requirements for a ReadHandler.
|
||||
ASIO_READ_HANDLER_CHECK(ReadHandler, handler) type_check;
|
||||
|
||||
detail::non_const_lvalue<ReadHandler> handler2(handler);
|
||||
self_->impl_.get_service().async_read_some(
|
||||
self_->impl_.get_implementation(), buffers, handler2.value,
|
||||
self_->impl_.get_implementation_executor());
|
||||
}
|
||||
|
||||
private:
|
||||
basic_stream_handle* self_;
|
||||
};
|
||||
};
|
||||
|
||||
} // namespace windows
|
||||
|
||||
@@ -754,11 +754,16 @@ std::size_t write(SyncWriteStream& s, DynamicBuffer_v2 buffers,
|
||||
* std::vector.
|
||||
*/
|
||||
template <typename AsyncWriteStream, typename ConstBufferSequence,
|
||||
typename WriteHandler>
|
||||
ASIO_INITFN_RESULT_TYPE(WriteHandler,
|
||||
ASIO_COMPLETION_TOKEN_FOR(void (asio::error_code,
|
||||
std::size_t)) WriteHandler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(
|
||||
typename AsyncWriteStream::executor_type)>
|
||||
ASIO_INITFN_AUTO_RESULT_TYPE(WriteHandler,
|
||||
void (asio::error_code, std::size_t))
|
||||
async_write(AsyncWriteStream& s, const ConstBufferSequence& buffers,
|
||||
ASIO_MOVE_ARG(WriteHandler) handler,
|
||||
ASIO_MOVE_ARG(WriteHandler) handler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN(
|
||||
typename AsyncWriteStream::executor_type),
|
||||
typename enable_if<
|
||||
is_const_buffer_sequence<ConstBufferSequence>::value
|
||||
>::type* = 0);
|
||||
@@ -830,9 +835,11 @@ async_write(AsyncWriteStream& s, const ConstBufferSequence& buffers,
|
||||
* buffers in one go, and how to use it with arrays, boost::array or
|
||||
* std::vector.
|
||||
*/
|
||||
template <typename AsyncWriteStream, typename ConstBufferSequence,
|
||||
typename CompletionCondition, typename WriteHandler>
|
||||
ASIO_INITFN_RESULT_TYPE(WriteHandler,
|
||||
template <typename AsyncWriteStream,
|
||||
typename ConstBufferSequence, typename CompletionCondition,
|
||||
ASIO_COMPLETION_TOKEN_FOR(void (asio::error_code,
|
||||
std::size_t)) WriteHandler>
|
||||
ASIO_INITFN_AUTO_RESULT_TYPE(WriteHandler,
|
||||
void (asio::error_code, std::size_t))
|
||||
async_write(AsyncWriteStream& s, const ConstBufferSequence& buffers,
|
||||
CompletionCondition completion_condition,
|
||||
@@ -886,13 +893,18 @@ async_write(AsyncWriteStream& s, const ConstBufferSequence& buffers,
|
||||
* immediate completion, invocation of the handler will be performed in a
|
||||
* manner equivalent to using asio::post().
|
||||
*/
|
||||
template <typename AsyncWriteStream,
|
||||
typename DynamicBuffer_v1, typename WriteHandler>
|
||||
ASIO_INITFN_RESULT_TYPE(WriteHandler,
|
||||
template <typename AsyncWriteStream, typename DynamicBuffer_v1,
|
||||
ASIO_COMPLETION_TOKEN_FOR(void (asio::error_code,
|
||||
std::size_t)) WriteHandler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(
|
||||
typename AsyncWriteStream::executor_type)>
|
||||
ASIO_INITFN_AUTO_RESULT_TYPE(WriteHandler,
|
||||
void (asio::error_code, std::size_t))
|
||||
async_write(AsyncWriteStream& s,
|
||||
ASIO_MOVE_ARG(DynamicBuffer_v1) buffers,
|
||||
ASIO_MOVE_ARG(WriteHandler) handler,
|
||||
ASIO_MOVE_ARG(WriteHandler) handler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN(
|
||||
typename AsyncWriteStream::executor_type),
|
||||
typename enable_if<
|
||||
is_dynamic_buffer_v1<typename decay<DynamicBuffer_v1>::type>::value
|
||||
&& !is_dynamic_buffer_v2<typename decay<DynamicBuffer_v1>::type>::value
|
||||
@@ -955,9 +967,11 @@ async_write(AsyncWriteStream& s,
|
||||
* immediate completion, invocation of the handler will be performed in a
|
||||
* manner equivalent to using asio::post().
|
||||
*/
|
||||
template <typename AsyncWriteStream, typename DynamicBuffer_v1,
|
||||
typename CompletionCondition, typename WriteHandler>
|
||||
ASIO_INITFN_RESULT_TYPE(WriteHandler,
|
||||
template <typename AsyncWriteStream,
|
||||
typename DynamicBuffer_v1, typename CompletionCondition,
|
||||
ASIO_COMPLETION_TOKEN_FOR(void (asio::error_code,
|
||||
std::size_t)) WriteHandler>
|
||||
ASIO_INITFN_AUTO_RESULT_TYPE(WriteHandler,
|
||||
void (asio::error_code, std::size_t))
|
||||
async_write(AsyncWriteStream& s,
|
||||
ASIO_MOVE_ARG(DynamicBuffer_v1) buffers,
|
||||
@@ -1012,11 +1026,17 @@ async_write(AsyncWriteStream& s,
|
||||
* immediate completion, invocation of the handler will be performed in a
|
||||
* manner equivalent to using asio::post().
|
||||
*/
|
||||
template <typename AsyncWriteStream, typename Allocator, typename WriteHandler>
|
||||
ASIO_INITFN_RESULT_TYPE(WriteHandler,
|
||||
template <typename AsyncWriteStream, typename Allocator,
|
||||
ASIO_COMPLETION_TOKEN_FOR(void (asio::error_code,
|
||||
std::size_t)) WriteHandler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(
|
||||
typename AsyncWriteStream::executor_type)>
|
||||
ASIO_INITFN_AUTO_RESULT_TYPE(WriteHandler,
|
||||
void (asio::error_code, std::size_t))
|
||||
async_write(AsyncWriteStream& s, basic_streambuf<Allocator>& b,
|
||||
ASIO_MOVE_ARG(WriteHandler) handler);
|
||||
ASIO_MOVE_ARG(WriteHandler) handler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN(
|
||||
typename AsyncWriteStream::executor_type));
|
||||
|
||||
/// Start an asynchronous operation to write a certain amount of data to a
|
||||
/// stream.
|
||||
@@ -1073,9 +1093,11 @@ async_write(AsyncWriteStream& s, basic_streambuf<Allocator>& b,
|
||||
* immediate completion, invocation of the handler will be performed in a
|
||||
* manner equivalent to using asio::post().
|
||||
*/
|
||||
template <typename AsyncWriteStream, typename Allocator,
|
||||
typename CompletionCondition, typename WriteHandler>
|
||||
ASIO_INITFN_RESULT_TYPE(WriteHandler,
|
||||
template <typename AsyncWriteStream,
|
||||
typename Allocator, typename CompletionCondition,
|
||||
ASIO_COMPLETION_TOKEN_FOR(void (asio::error_code,
|
||||
std::size_t)) WriteHandler>
|
||||
ASIO_INITFN_AUTO_RESULT_TYPE(WriteHandler,
|
||||
void (asio::error_code, std::size_t))
|
||||
async_write(AsyncWriteStream& s, basic_streambuf<Allocator>& b,
|
||||
CompletionCondition completion_condition,
|
||||
@@ -1128,12 +1150,17 @@ async_write(AsyncWriteStream& s, basic_streambuf<Allocator>& b,
|
||||
* immediate completion, invocation of the handler will be performed in a
|
||||
* manner equivalent to using asio::post().
|
||||
*/
|
||||
template <typename AsyncWriteStream,
|
||||
typename DynamicBuffer_v2, typename WriteHandler>
|
||||
ASIO_INITFN_RESULT_TYPE(WriteHandler,
|
||||
template <typename AsyncWriteStream, typename DynamicBuffer_v2,
|
||||
ASIO_COMPLETION_TOKEN_FOR(void (asio::error_code,
|
||||
std::size_t)) WriteHandler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(
|
||||
typename AsyncWriteStream::executor_type)>
|
||||
ASIO_INITFN_AUTO_RESULT_TYPE(WriteHandler,
|
||||
void (asio::error_code, std::size_t))
|
||||
async_write(AsyncWriteStream& s, DynamicBuffer_v2 buffers,
|
||||
ASIO_MOVE_ARG(WriteHandler) handler,
|
||||
ASIO_MOVE_ARG(WriteHandler) handler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN(
|
||||
typename AsyncWriteStream::executor_type),
|
||||
typename enable_if<
|
||||
is_dynamic_buffer_v2<DynamicBuffer_v2>::value
|
||||
>::type* = 0);
|
||||
@@ -1195,9 +1222,11 @@ async_write(AsyncWriteStream& s, DynamicBuffer_v2 buffers,
|
||||
* immediate completion, invocation of the handler will be performed in a
|
||||
* manner equivalent to using asio::post().
|
||||
*/
|
||||
template <typename AsyncWriteStream, typename DynamicBuffer_v2,
|
||||
typename CompletionCondition, typename WriteHandler>
|
||||
ASIO_INITFN_RESULT_TYPE(WriteHandler,
|
||||
template <typename AsyncWriteStream,
|
||||
typename DynamicBuffer_v2, typename CompletionCondition,
|
||||
ASIO_COMPLETION_TOKEN_FOR(void (asio::error_code,
|
||||
std::size_t)) WriteHandler>
|
||||
ASIO_INITFN_AUTO_RESULT_TYPE(WriteHandler,
|
||||
void (asio::error_code, std::size_t))
|
||||
async_write(AsyncWriteStream& s, DynamicBuffer_v2 buffers,
|
||||
CompletionCondition completion_condition,
|
||||
|
||||
@@ -456,12 +456,17 @@ std::size_t write_at(SyncRandomAccessWriteDevice& d, uint64_t offset,
|
||||
* std::vector.
|
||||
*/
|
||||
template <typename AsyncRandomAccessWriteDevice, typename ConstBufferSequence,
|
||||
typename WriteHandler>
|
||||
ASIO_INITFN_RESULT_TYPE(WriteHandler,
|
||||
ASIO_COMPLETION_TOKEN_FOR(void (asio::error_code,
|
||||
std::size_t)) WriteHandler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(
|
||||
typename AsyncRandomAccessWriteDevice::executor_type)>
|
||||
ASIO_INITFN_AUTO_RESULT_TYPE(WriteHandler,
|
||||
void (asio::error_code, std::size_t))
|
||||
async_write_at(AsyncRandomAccessWriteDevice& d, uint64_t offset,
|
||||
const ConstBufferSequence& buffers,
|
||||
ASIO_MOVE_ARG(WriteHandler) handler);
|
||||
ASIO_MOVE_ARG(WriteHandler) handler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN(
|
||||
typename AsyncRandomAccessWriteDevice::executor_type));
|
||||
|
||||
/// Start an asynchronous operation to write a certain amount of data at the
|
||||
/// specified offset.
|
||||
@@ -534,14 +539,20 @@ async_write_at(AsyncRandomAccessWriteDevice& d, uint64_t offset,
|
||||
* buffers in one go, and how to use it with arrays, boost::array or
|
||||
* std::vector.
|
||||
*/
|
||||
template <typename AsyncRandomAccessWriteDevice, typename ConstBufferSequence,
|
||||
typename CompletionCondition, typename WriteHandler>
|
||||
ASIO_INITFN_RESULT_TYPE(WriteHandler,
|
||||
template <typename AsyncRandomAccessWriteDevice,
|
||||
typename ConstBufferSequence, typename CompletionCondition,
|
||||
ASIO_COMPLETION_TOKEN_FOR(void (asio::error_code,
|
||||
std::size_t)) WriteHandler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(
|
||||
typename AsyncRandomAccessWriteDevice::executor_type)>
|
||||
ASIO_INITFN_AUTO_RESULT_TYPE(WriteHandler,
|
||||
void (asio::error_code, std::size_t))
|
||||
async_write_at(AsyncRandomAccessWriteDevice& d,
|
||||
uint64_t offset, const ConstBufferSequence& buffers,
|
||||
CompletionCondition completion_condition,
|
||||
ASIO_MOVE_ARG(WriteHandler) handler);
|
||||
ASIO_MOVE_ARG(WriteHandler) handler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN(
|
||||
typename AsyncRandomAccessWriteDevice::executor_type));
|
||||
|
||||
#if !defined(ASIO_NO_EXTENSIONS)
|
||||
#if !defined(ASIO_NO_IOSTREAM)
|
||||
@@ -592,11 +603,17 @@ async_write_at(AsyncRandomAccessWriteDevice& d,
|
||||
* manner equivalent to using asio::post().
|
||||
*/
|
||||
template <typename AsyncRandomAccessWriteDevice, typename Allocator,
|
||||
typename WriteHandler>
|
||||
ASIO_INITFN_RESULT_TYPE(WriteHandler,
|
||||
ASIO_COMPLETION_TOKEN_FOR(void (asio::error_code,
|
||||
std::size_t)) WriteHandler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(
|
||||
typename AsyncRandomAccessWriteDevice::executor_type)>
|
||||
ASIO_INITFN_AUTO_RESULT_TYPE(WriteHandler,
|
||||
void (asio::error_code, std::size_t))
|
||||
async_write_at(AsyncRandomAccessWriteDevice& d, uint64_t offset,
|
||||
basic_streambuf<Allocator>& b, ASIO_MOVE_ARG(WriteHandler) handler);
|
||||
async_write_at(AsyncRandomAccessWriteDevice& d,
|
||||
uint64_t offset, basic_streambuf<Allocator>& b,
|
||||
ASIO_MOVE_ARG(WriteHandler) handler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN(
|
||||
typename AsyncRandomAccessWriteDevice::executor_type));
|
||||
|
||||
/// Start an asynchronous operation to write a certain amount of data at the
|
||||
/// specified offset.
|
||||
@@ -657,13 +674,19 @@ async_write_at(AsyncRandomAccessWriteDevice& d, uint64_t offset,
|
||||
* immediate completion, invocation of the handler will be performed in a
|
||||
* manner equivalent to using asio::post().
|
||||
*/
|
||||
template <typename AsyncRandomAccessWriteDevice, typename Allocator,
|
||||
typename CompletionCondition, typename WriteHandler>
|
||||
ASIO_INITFN_RESULT_TYPE(WriteHandler,
|
||||
template <typename AsyncRandomAccessWriteDevice,
|
||||
typename Allocator, typename CompletionCondition,
|
||||
ASIO_COMPLETION_TOKEN_FOR(void (asio::error_code,
|
||||
std::size_t)) WriteHandler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(
|
||||
typename AsyncRandomAccessWriteDevice::executor_type)>
|
||||
ASIO_INITFN_AUTO_RESULT_TYPE(WriteHandler,
|
||||
void (asio::error_code, std::size_t))
|
||||
async_write_at(AsyncRandomAccessWriteDevice& d, uint64_t offset,
|
||||
basic_streambuf<Allocator>& b, CompletionCondition completion_condition,
|
||||
ASIO_MOVE_ARG(WriteHandler) handler);
|
||||
ASIO_MOVE_ARG(WriteHandler) handler
|
||||
ASIO_DEFAULT_COMPLETION_TOKEN(
|
||||
typename AsyncRandomAccessWriteDevice::executor_type));
|
||||
|
||||
#endif // !defined(ASIO_NO_IOSTREAM)
|
||||
#endif // !defined(ASIO_NO_EXTENSIONS)
|
||||
|
||||
@@ -7,6 +7,148 @@
|
||||
|
||||
[section:history Revision History]
|
||||
|
||||
[heading Asio 1.16.0]
|
||||
|
||||
* Changed the `async_initiate` helper function to automatically deduce its
|
||||
return type. This is enabled for C++11 or later.
|
||||
|
||||
* Changed all asynchronous operations to use automatically deduced return
|
||||
types. This allows completion token implementations to incorporate the
|
||||
asynchronous operation initiation into the initiating function's return type,
|
||||
without type erasure. Note that C++14 or later is required to support
|
||||
completion tokens that use per-operation return type deduction. For C++11 or
|
||||
earlier, a completion token's async_result specialisation must still provide
|
||||
the nested typedef `return_type`.
|
||||
|
||||
* Introduced three new concepts to support `async_initiate`.
|
||||
* `completion_signature<T>`: Checks if `T` is a signature of the form
|
||||
`R(Args...)`.
|
||||
* `completion_handler_for<T, Signature>`: Checks if `T` is usable as a
|
||||
completion handler with the specified signature.
|
||||
* `completion_token_for<T, Signature>`: Checks if `T` is a completion token
|
||||
that can be used with async_initiate and the specified signature.
|
||||
* For backward compatibility with pre-concepts C++, the macros
|
||||
`(BOOST_)ASIO_COMPLETION_SIGNATURE`, `(BOOST_)ASIO_COMPLETION_HANDLER_FOR`, and
|
||||
`(BOOST_)ASIO_COMPLETION_TOKEN_FOR` are provided. These macros expand to
|
||||
`typename` when concepts are unsupported.
|
||||
|
||||
* Added the nested template type `rebind_executor` to all I/O object types, as
|
||||
a way to generically rebind them to use alternative I/O executors. For
|
||||
example:
|
||||
``
|
||||
using my_socket_type = tcp::socket::rebind_executor<my_executor_type>::other;
|
||||
``[br]
|
||||
|
||||
* Changed the asynchronous operations' initiation function objects to report
|
||||
their associated I/O executor via the nested type `executor_type` and member
|
||||
function `get_executor()`. Note that the presence of `executor_type` and
|
||||
`get_executor()` should be treated as optional, and consequently it may be
|
||||
preferable to access them via the `associated_executor` trait and the
|
||||
`get_associated_executor()` helper function.
|
||||
|
||||
* Added the `default_completion_token` trait, so that every I/O executor type
|
||||
now has an associated default completion token type. This trait may be used
|
||||
in asynchronous operation declarations as follows:
|
||||
``
|
||||
template <
|
||||
typename IoObject,
|
||||
typename CompletionToken =
|
||||
typename default_completion_token<
|
||||
typename IoObject::executor_type
|
||||
>::type
|
||||
>
|
||||
auto async_xyz(
|
||||
IoObject& io_object,
|
||||
CompletionToken&& token =
|
||||
typename default_completion_token<
|
||||
typename IoObject::executor_type
|
||||
>::type{}
|
||||
);
|
||||
``[br]
|
||||
If not specialised, this trait type is `void`, meaning no default completion
|
||||
token type is available for the given I/O executor.
|
||||
|
||||
* Specialised the `default_completion_token` trait for the `use_awaitable`
|
||||
completion token, so that it may be used as shown in the following example:
|
||||
``
|
||||
auto socket = use_awaitable.as_default_on(tcp::socket(my_context));
|
||||
// ...
|
||||
co_await socket.async_connect(my_endpoint); // Defaults to use_awaitable.
|
||||
``[br]
|
||||
In this example, the type of the `socket` object is transformed from
|
||||
`tcp::socket` to have an I/O executor with the default completion token set
|
||||
to `use_awaitable`. Alternatively, the socket type may be computed directly:
|
||||
``
|
||||
using tcp_socket = use_awaitable_t<>::as_default_on_t<tcp::socket>;
|
||||
tcp_socket socket(my_context);
|
||||
// ...
|
||||
co_await socket.async_connect(my_endpoint); // Defaults to use_awaitable.
|
||||
``[br]
|
||||
|
||||
* Added missing `async_initiate` to the Windows-specific I/O objects'
|
||||
asynchronous operations.
|
||||
|
||||
* Ensured that the executor type is propagated to newly accepted sockets.
|
||||
When synchronously or asynchronously accepting a new connection, but
|
||||
without specifying an executor or execution context, the accept
|
||||
operation will now correctly propagate the executor type from the
|
||||
acceptor to the socket. For example, if your acceptor type is:
|
||||
``
|
||||
basic_socket_acceptor<ip::tcp, my_executor_type>
|
||||
``[br]
|
||||
then your accepted socket type will be:
|
||||
``
|
||||
basic_stream_socket<ip::tcp, my_executor_type>
|
||||
``[br]
|
||||
|
||||
* Changed to require that `Protocol` copy and move operations never throw.
|
||||
|
||||
* Changed to require that `Endpoint` default constructor and move operations
|
||||
never throw.
|
||||
|
||||
* Added the `noexcept` qualifier to protocol accessors.
|
||||
|
||||
* Added the `noexcept` qualifier to socket move constructors.
|
||||
|
||||
* Fixed issues associated with opening serial ports on Windows:
|
||||
* Use the correct constant to initialise the RTS control flag.
|
||||
* Specify a default baud rate (9600).
|
||||
|
||||
* Fixed a lost "outstanding work count" that can occur when an asynchronous
|
||||
accept operation is automatically restarted.
|
||||
|
||||
[heading Asio 1.14.1]
|
||||
|
||||
* Improved performance slightly by eliminating a redundant move construction
|
||||
when completed handlers are dispatched.
|
||||
|
||||
* Eliminated a compiler warning by annotating a `case` fall-through in
|
||||
the free function `connect()` implementation.
|
||||
|
||||
* Fixed the `is_*_buffer_sequence` detection traits for user-defined sequence
|
||||
types.
|
||||
|
||||
* Fixed some Windows-specific warnings about an incompatible pointer cast when
|
||||
obtaining the `CancelIoEx` entry point.
|
||||
|
||||
* Changed to automatically set the defaults when opening a serial port on
|
||||
Windows.
|
||||
|
||||
* Changed the serial port `get_option()` member function to be const.
|
||||
|
||||
* Fixed a name hiding issue with the WinRT stream-oriented socket backend's
|
||||
`shutdown` function.
|
||||
|
||||
* Applied a minor fix to the documentation for `is_dynamic_buffer`.
|
||||
|
||||
* Added some support for Haiku OS.
|
||||
|
||||
* Added wolfSSL compatability.
|
||||
|
||||
* Changed to require C++17 or later for coroutines TS support with clang.
|
||||
|
||||
* Fixed a doxygen generation problem in the tutorial.
|
||||
|
||||
[heading Asio 1.14.0]
|
||||
|
||||
* Improved I/O object performance by adding runtime detection of native I/O
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user