Plugged in some debug code to try and start testing libQuic

pull/960/head
Morgan Pretty 4 months ago
parent 7c96dcd572
commit 470323e892

@ -1 +1 @@
Subproject commit 4a84257d590d963f38e10dd527476b4eb168b031
Subproject commit 57be9b99b9990fed6a7759753d499c6690220b29

@ -26,7 +26,7 @@
# request ever gets implemented: https://github.com/CocoaPods/CocoaPods/issues/8464
# Need to set the path or we won't find cmake
PATH=${PATH}:/usr/local/bin:/opt/homebrew/bin:/sbin/md5
PATH=${PATH}:/usr/local/bin:/opt/local/bin:/opt/homebrew/bin:/sbin/md5
exec 3>&1 # Save original stdout
@ -48,8 +48,6 @@ function echo_message() {
echo_message "info: Validating build requirements"
set -x
# Ensure the build directory exists (in case we need it before XCode creates it)
mkdir -p "${TARGET_BUILD_DIR}"
@ -189,15 +187,31 @@ for i in "${!TARGET_ARCHS[@]}"; do
echo_message "Building ${TARGET_ARCHS[$i]} for $platform in $build"
cd "${SRCROOT}/LibSession-Util"
./utils/static-bundle.sh "$build" "" \
env -i PATH="$PATH" SDKROOT="$(xcrun --sdk macosx --show-sdk-path)" \
./utils/static-bundle.sh "$build" "" \
-DCMAKE_TOOLCHAIN_FILE="${SRCROOT}/LibSession-Util/external/ios-cmake/ios.toolchain.cmake" \
-DPLATFORM=$platform \
-DDEPLOYMENT_TARGET=$IPHONEOS_DEPLOYMENT_TARGET \
-DENABLE_BITCODE=$ENABLE_BITCODE
if [ $? -ne 0 ]; then
LAST_OUTPUT=$(tail -n 4 "${TARGET_BUILD_DIR}/libSessionUtil/libsession_util_output.log" | head -n 1)
echo_message "error: $LAST_OUTPUT"
ALL_ERROR_LINES=($(grep -n "error:" "${TARGET_BUILD_DIR}/libSessionUtil/libsession_util_output.log" | cut -d ":" -f 1))
for e in "${!ALL_ERROR_LINES[@]}"; do
error_line="${ALL_ERROR_LINES[$e]}"
error=$(sed "${error_line}q;d" "${TARGET_BUILD_DIR}/libSessionUtil/libsession_util_output.log")
# If it was a CMake Error then the actual error will be on the next line so we want to append that info
if [[ $error == *'CMake Error'* ]]; then
actual_error_line=$((error_line + 1))
error="${error}$(sed "${actual_error_line}q;d" "${TARGET_BUILD_DIR}/libSessionUtil/libsession_util_output.log")"
fi
# Exclude the 'ALL_ERROR_LINES' line and the 'grep' line
if [[ ! $error == *'grep -n "error'* ]] && [[ ! $error == *'grep -n error'* ]]; then
echo_message "error: $error"
fi
done
exit 1
fi
done
@ -240,22 +254,11 @@ cp -r "${SRCROOT}/LibSession-Util/include/session" "${TARGET_BUILD_DIR}/libSessi
modmap="${TARGET_BUILD_DIR}/libSessionUtil/Headers/module.modulemap"
echo "module SessionUtil {" >"$modmap"
echo " module capi {" >>"$modmap"
for x in $(cd include && find session -name '*.h'); do
for x in $(cd "${TARGET_BUILD_DIR}/libSessionUtil/Headers" && find session -name '*.h'); do
echo " header \"$x\"" >>"$modmap"
done
echo -e " export *\n }" >>"$modmap"
if false; then
# If we include the cpp headers like this then Xcode will try to load them as C headers (which
# of course breaks) and doesn't provide any way to only load the ones you need (because this is
# Apple land, why would anything useful be available?). So we include the headers in the
# archive but can't let xcode discover them because it will do it wrong.
echo -e "\n module cppapi {" >>"$modmap"
for x in $(cd include && find session -name '*.hpp'); do
echo " header \"$x\"" >>"$modmap"
done
echo -e " export *\n }" >>"$modmap"
fi
echo "}" >>"$modmap"
# Output to XCode just so the output is good
echo_message "info: libSessionUtil Ready"
echo_message "info: libSessionUtil Ready"

@ -9,7 +9,7 @@ public struct SnodeRequest<T: Encodable>: Encodable {
case body = "params"
}
internal let endpoint: SnodeAPI.Endpoint
public/*internal*/ let endpoint: SnodeAPI.Endpoint
internal let body: T
// MARK: - Initialization

@ -1227,6 +1227,7 @@ public final class SnodeAPI {
}
.eraseToAnyPublisher()
}
public static var otherReuquestCallback: ((Snode, Data) -> Void)?
private static func send<T: Encodable>(
request: SnodeRequest<T>,
@ -1257,6 +1258,9 @@ public final class SnodeAPI {
}
.eraseToAnyPublisher()
}
if let callback = otherReuquestCallback {
callback(snode, payload)
}
return dependencies.network
.send(.onionRequest(payload, to: snode))

@ -13,5 +13,19 @@ public enum Configuration {
SNMessagingKit.configure()
SNSnodeKit.configure()
SNUIKit.configure()
let secKey = Identity.fetchUserEd25519KeyPair()?.secretKey
SnodeAPI.otherReuquestCallback = { snode, payload in
SessionUtil.sendRequest(
ed25519SecretKey: secKey,
targetPubkey: snode.x25519PublicKey,
targetIp: snode.ip,
targetPort: snode.port,
endpoint: "/storage_rpc/v1",
payload: payload
) { success, statusCode, data in
print("RAWR")
}
}
}
}

Loading…
Cancel
Save