-
-
Save ResDiaryLewis/77c7696eb9a5eab6d704c7aa3703d0b8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// sessionID - ASPX sessionID returned in this payload | |
// reqID - Identifies membership of the same request triple, so | |
// so any original response or replayed response responding | |
// to the same request will have the same reqID | |
// payloadType - One of {request, originalResponse, replayedResponse}, | |
// though requests shouldn't reach this function. | |
func sessionIDMapping(sessionID, reqID string, payloadType byte) { | |
// If this request has already logged an opposite session ID | |
if otherSessionID, ok := asyncRequestIDQueue[reqID]; ok { | |
switch payloadType { // map original -> replayed | |
case payloadOriginalResponse: // if it's the original response | |
Debug(fmt.Sprintf("Mapping %s to %s", sessionID, otherSessionID)) | |
sessionIDToReplaySessionID[sessionID] = otherSessionID | |
case payloadReplayedResponse: // if it's the replayed response | |
Debug(fmt.Sprintf("Mapping %s to %s", otherSessionID, sessionID)) | |
sessionIDToReplaySessionID[otherSessionID] = sessionID | |
} | |
delete(asyncRequestIDQueue, reqID) // delete entry from the async map for clarity | |
} else { // if this request ID hasn't been logged | |
Debug(fmt.Sprintf("Mapping request ID %s to %s", reqID, sessionID)) | |
asyncRequestIDQueue[reqID] = sessionID | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment