Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SOL-117452: Fix extra P2P topic subscription on request reply publisher #17

Closed
wants to merge 72 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
72 commits
Select commit Hold shift + click to select a range
e1c7599
SOL-111818: added request_reply_message_receiver.go module with inter…
cjwmorgan-sol Jan 29, 2024
19c9aeb
SOL-111817: fixed publisher builder back pressure signature, remove w…
cjwmorgan-sol Jan 30, 2024
6919dae
SOL-111697: Added initial implementation of the request reply publish…
cjwmorgan-sol Jan 30, 2024
7cb2f12
SOL-111858: Added replyTo topic generation
cjwmorgan-sol Feb 2, 2024
4cd6ee0
SOL-111818: Fix up RequestReplyMessageReceiverBuilder typo for proper…
cjwmorgan-sol Feb 3, 2024
c23f473
SOL-112139: Added new request_reply_message_receiver_impl.go module w…
cjwmorgan-sol Feb 3, 2024
c9e1df4
Merge branch 'SOL-62455' into SOL-62455-poc
cjwmorgan-sol Feb 3, 2024
629ccf9
SOL-111860: Added mock core requestor for unit tests compilation
cjwmorgan-sol Feb 5, 2024
7b217e0
SOL-111860: fix go fmt for publisher unit tests
cjwmorgan-sol Feb 5, 2024
ca052a7
SOL-62455: fix staticcheck error for naming and formating
cjwmorgan-sol Feb 6, 2024
5b83551
SOL-62455: Added staticheck analysis to gitactions test workflow
cjwmorgan-sol Feb 6, 2024
dadf361
SOL-112144: fix native ccsmp_helper.c with proper includes and correl…
cjwmorgan-sol Feb 6, 2024
f17c814
SOL-112635: fixed panic when calling Replier.Reply with nil outbound …
cjwmorgan-sol Feb 9, 2024
58a66a6
SOL-112784: Fixed receiver forward dispatch issue with messages from …
cjwmorgan-sol Feb 13, 2024
c5e86f0
SOL-112785: Fixed request reply publisher outstanding request panic o…
cjwmorgan-sol Feb 13, 2024
78dc78f
Merge pull request #40 from SolaceDev/SOL-62455-poc
cjwmorgan-sol Feb 14, 2024
8b614b1
SOL-111860: Added request_reply_message_publisher_impl_test.go module…
cjwmorgan-sol Feb 15, 2024
e478f99
SOL-112352: Instantiation and configuration integration tests for the…
oodigie Feb 20, 2024
af13da4
SOL-112353: added some of the publisher termination integration tests
oodigie Feb 23, 2024
6dc8558
refactor: changed some test titles to better reflect what the test does
oodigie Feb 23, 2024
6d78ecb
refactor: changed some test titles to better reflect what the test does
oodigie Feb 23, 2024
b290ad8
Merge pull request #41 from SolaceDev/SOL-111699--SOL-112352
cjwmorgan-sol Mar 1, 2024
37b0eff
SOL-112353: added more test cases to cover publisher termination
oodigie Mar 1, 2024
eabe0f6
Merge branch 'SOL-62455' into SOL-111699--SOL-112353
oodigie Mar 1, 2024
18a49ef
refactor: renamed the requestReplyPublisher variable in the integrati…
oodigie Mar 1, 2024
de88890
SOL-111860: Added request reply publisher lifecycle and publish unit …
cjwmorgan-sol Mar 5, 2024
283ca0f
SOL-112354: Start and termination of a RequestReplyMessageReceiver in…
oodigie Mar 6, 2024
7fa1ba7
SOL-111860: Added publisher publish tests with publisher buffer testing
cjwmorgan-sol Mar 7, 2024
b48264e
Merge branch 'SOL-62455' into SOL-62455-unittests
cjwmorgan-sol Mar 7, 2024
aa645db
SOL-112144: Added new request_reply_message_receiver_impl_test.go tes…
cjwmorgan-sol Mar 7, 2024
fb6433c
SOL-111860: fixed static check error in request reply publisher unit …
cjwmorgan-sol Mar 7, 2024
01b4e99
SOL-111860: fix test source formatting
cjwmorgan-sol Mar 7, 2024
29c2ea6
SOL-111860: fix static error for exported const string in error_strin…
cjwmorgan-sol Mar 7, 2024
92f078f
feat: updated the tests to fix potential race conditions with the use…
oodigie Mar 7, 2024
35c8a12
feat: added an assertion to check the error returned from replier.Rep…
oodigie Mar 7, 2024
2d4fc0e
Merge branch 'SOL-62455' into SOL-111699--SOL-112354
oodigie Mar 7, 2024
e884982
feat: fixed the failing tests to check that error returns from replie…
oodigie Mar 7, 2024
f9877ae
Merge branch 'SOL-62455' into SOL-111699--SOL-112353
oodigie Mar 7, 2024
9dcb7d3
feat: updated the tests and replaced time.Sleep with select statements
oodigie Mar 7, 2024
d6285d3
SOL-114563: Added request reply receiver back pressure configuration …
cjwmorgan-sol Mar 11, 2024
e7b131a
SOL-112144: Added request reply receiver builder unit tests for confi…
cjwmorgan-sol Mar 11, 2024
8baea10
SOL-112355: Integration tests to cover the requests and responses pro…
oodigie Mar 12, 2024
9bcae08
SOL-112355: updated the integration tests to provide a more consisten…
oodigie Mar 12, 2024
b970424
Merge pull request #43 from SolaceDev/SOL-111699--SOL-112354
cjwmorgan-sol Mar 12, 2024
d31e6fc
Merge branch 'SOL-62455' into SOL-111699--SOL-112355
oodigie Mar 12, 2024
c135977
feat: updated the receiver backpressure config to increase its buffer…
oodigie Mar 12, 2024
adace85
feat: updated the failing tests to accommodate waiting for the messag…
oodigie Mar 13, 2024
2f33dab
Merge pull request #44 from SolaceDev/SOL-111699--SOL-112355
cjwmorgan-sol Mar 13, 2024
c587c55
Version bump to 1.6.0
cjwmorgan-sol Mar 13, 2024
08eb891
SOL-111860: Added addition unit tests for publish timeout and reply o…
cjwmorgan-sol Mar 13, 2024
520ff31
SOL-62455: merged changes from dev branch
cjwmorgan-sol Mar 13, 2024
cabe605
Merge branch 'SOL-62455' into SOL-111699--SOL-112353
oodigie Mar 14, 2024
dbf563a
feat: fixed the pontential race condition in the publisher saturation…
oodigie Mar 14, 2024
a92e699
refactor: removed the focused test flag
oodigie Mar 14, 2024
fe3b170
Merge pull request #42 from SolaceDev/SOL-111699--SOL-112353
cjwmorgan-sol Mar 15, 2024
ac5e423
SOL-115460: Added comments to address usage of SOLCLIENTGO_HAS_REPLY_…
cjwmorgan-sol Apr 2, 2024
4bca021
SOL-115460: fixed issue where native correlation id reply message che…
cjwmorgan-sol Apr 5, 2024
7d819be
SOL-116504: Fixed incorrect error type return on replier io buffer ov…
cjwmorgan-sol Apr 15, 2024
ee304be
feat: fixed the out of bounce read/write access for the traceID and s…
oodigie Apr 17, 2024
b5f3e94
Merge pull request #46 from SolaceDev/SOL-116516
RagnarPaulson Apr 19, 2024
92f8097
Bug SOL-114567:
RagnarPaulson Apr 21, 2024
3ff69e8
SOL-114567:
RagnarPaulson Apr 22, 2024
ebdbaf4
Bug SOL-114567:
RagnarPaulson Apr 22, 2024
6bcacd5
Merge pull request #47 from RagnarPaulson/sol-114567-rp
cjwmorgan-sol Apr 22, 2024
ae79251
SOL-62455: Merged changes from dev to resolve branch conflicts
cjwmorgan-sol Apr 22, 2024
05e1f3c
SOL-62455: Fixed code style from merge from dev
cjwmorgan-sol Apr 23, 2024
89ec625
feat: updated the failing RR integration tests to fix race condition …
oodigie Apr 24, 2024
a9ae3c8
feat: SOL-66163: a race condition in CCSMP may cause the error to be nil
oodigie Apr 24, 2024
ba9d1e6
feat: removed the focused test tag
oodigie Apr 24, 2024
b05043e
feat: commented out the GetCause() assert due to the SOL-66163 race c…
oodigie Apr 25, 2024
688c010
Merge pull request #45 from SolaceDev/SOL-62455
oodigie Apr 25, 2024
b75c232
SOL-117452: Fixed subscription flags on unsubcribe to no longer leak …
cjwmorgan-sol Apr 26, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,15 @@ jobs:
check-latest: true
- name: Check Go Version
run: go version
- name: run go tool staticcheck
# use pinned version of staticcheck this need to match with the go version for compatibility
# Compatibility with go version is listed in the release description of https://github.com/dominikh/go-tools/releases
# need at least version v0.4.4 for go version 1.21
run: |
go install honnef.co/go/tools/cmd/[email protected]
staticcheck -checks=all ./...
- name: Compiles
if: ${{ success() }}
run: go build ./...

- name: Runs go fmt
Expand Down
14 changes: 14 additions & 0 deletions internal/ccsmp/ccsmp_callbacks.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

#include "solclient/solClient.h"
#include "solclient/solClientMsg.h"
#include "./ccsmp_helper.h"

solClient_rxMsgCallback_returnCode_t
messageReceiveCallback(solClient_opaqueSession_pt opaqueSession_p, solClient_opaqueMsg_pt msg_p, void *user_p)
Expand All @@ -30,6 +31,19 @@ messageReceiveCallback(solClient_opaqueSession_pt opaqueSession_p, solClient_opa
return goMessageReceiveCallback(opaqueSession_p, msg_p, user_p);
}

solClient_rxMsgCallback_returnCode_t
requestResponseReplyMessageReceiveCallback(solClient_opaqueSession_pt opaqueSession_p, solClient_opaqueMsg_pt msg_p, void *user_p) {
solClient_rxMsgCallback_returnCode_t goReplyMessageReceiveCallback(solClient_opaqueSession_pt, solClient_opaqueMsg_pt, void *, char *);
char * correlationId = NULL;
// when receiving message that is not a reply deliver to subscription dispatch
if ( SOLCLIENT_OK != solClientgo_msg_isRequestReponseMsg(msg_p, &correlationId) ) {
// discard any message that is not a reply message
// note any subscription that matches the replyto topic will get an independent dispatch callback
return SOLCLIENT_CALLBACK_OK;
}
return goReplyMessageReceiveCallback(opaqueSession_p, msg_p, user_p, correlationId);
}

solClient_rxMsgCallback_returnCode_t
defaultMessageReceiveCallback(solClient_opaqueSession_pt opaqueSession_p, solClient_opaqueMsg_pt msg_p, void *user_p)
{
Expand Down
150 changes: 144 additions & 6 deletions internal/ccsmp/ccsmp_core.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ package ccsmp
#include "./ccsmp_helper.h"

solClient_rxMsgCallback_returnCode_t messageReceiveCallback ( solClient_opaqueSession_pt opaqueSession_p, solClient_opaqueMsg_pt msg_p, void *user_p );
solClient_rxMsgCallback_returnCode_t requestResponseReplyMessageReceiveCallback ( solClient_opaqueSession_pt opaqueSession_p, solClient_opaqueMsg_pt msg_p, void *user_p );
solClient_rxMsgCallback_returnCode_t defaultMessageReceiveCallback ( solClient_opaqueSession_pt opaqueSession_p, solClient_opaqueMsg_pt msg_p, void *user_p );
void eventCallback ( solClient_opaqueSession_pt opaqueSession_p, solClient_session_eventCallbackInfo_pt eventInfo_p, void *user_p );
void handleLogCallback(solClient_log_callbackInfo_pt logInfo_p, void *user_p);
Expand Down Expand Up @@ -69,6 +70,9 @@ type SolClientSessionRxMsgDispatchFuncInfo = C.solClient_session_rxMsgDispatchFu
// SolClientVersionInfo is assigned a value
type SolClientVersionInfo = C.solClient_version_info_t

// SolClientCorrelationID is assigned a value
type SolClientCorrelationID = *C.char

// Reexport various CCSMP variables

// SolClientPropEnableVal is assigned a value
Expand All @@ -77,16 +81,26 @@ var SolClientPropEnableVal = C.SOLCLIENT_PROP_ENABLE_VAL
// SolClientPropDisableVal is assigned a value
var SolClientPropDisableVal = C.SOLCLIENT_PROP_DISABLE_VAL

// Reexport solclientgo variables

// SolClientGoPropCorrelationPrefix property value
// var SolClientGoPropCorrelationPrefix = C.GoString(C.SOLCLIENTGO_REPLY_CORRELATION_PREFIX)
var SolClientGoPropCorrelationPrefix = C.SOLCLIENTGO_REPLY_CORRELATION_PREFIX

// Callbacks

// SolClientMessageCallback is assigned a function
type SolClientMessageCallback = func(msgP SolClientMessagePt, userP unsafe.Pointer) bool

// SolClientReplyMessageCallback assigned a function
type SolClientReplyMessageCallback = func(msgP SolClientMessagePt, userP unsafe.Pointer, correlationP string) bool

// SolClientSessionEventCallback is assigned a function
type SolClientSessionEventCallback = func(sessionEvent SolClientSessionEvent, responseCode SolClientResponseCode, info string, correlationP unsafe.Pointer, userP unsafe.Pointer)

// maps to callbacks
var sessionToRXCallbackMap sync.Map
var sessionToReplyRXCallbackMap sync.Map
var sessionToEventCallbackMap sync.Map

//export goMessageReceiveCallback
Expand All @@ -101,6 +115,19 @@ func goMessageReceiveCallback(sessionP SolClientSessionPt, msgP SolClientMessage
return C.SOLCLIENT_CALLBACK_OK
}

//export goReplyMessageReceiveCallback
func goReplyMessageReceiveCallback(sessionP SolClientSessionPt, msgP SolClientMessagePt, userP unsafe.Pointer, correlationIDP SolClientCorrelationID) C.solClient_rxMsgCallback_returnCode_t {
// propagate to request reponse reply message handler
if callback, ok := sessionToReplyRXCallbackMap.Load(sessionP); ok {
if callback.(SolClientReplyMessageCallback)(msgP, userP, C.GoString(correlationIDP)) {
return C.SOLCLIENT_CALLBACK_TAKE_MSG
}
return C.SOLCLIENT_CALLBACK_OK
}
logging.Default.Error("Received reply message from core API without an associated session callback")
return C.SOLCLIENT_CALLBACK_OK
}

//export goDefaultMessageReceiveCallback
func goDefaultMessageReceiveCallback(sessionP SolClientSessionPt, msgP SolClientMessagePt, userP unsafe.Pointer) C.solClient_rxMsgCallback_returnCode_t {
logging.Default.Error("Received message from core API on the default session callback")
Expand Down Expand Up @@ -207,6 +234,19 @@ func (session *SolClientSession) SetMessageCallback(callback SolClientMessageCal
return nil
}

// SetReplyMessageCallback sets the message callback to use
func (session *SolClientSession) SetReplyMessageCallback(callback SolClientReplyMessageCallback) error {
if session == nil || session.pointer == nil {
return fmt.Errorf("could not set message receive callback for nil session")
}
if callback == nil {
sessionToReplyRXCallbackMap.Delete(session.pointer)
} else {
sessionToReplyRXCallbackMap.Store(session.pointer, callback)
}
return nil
}

// SetEventCallback sets the event callback to use
func (session *SolClientSession) SetEventCallback(callback SolClientSessionEventCallback) error {
if session == nil || session.pointer == nil {
Expand Down Expand Up @@ -289,6 +329,7 @@ func (session *SolClientSession) SolClientSessionDestroy() *SolClientErrorInfoWr
// last line of defence to make sure everything is cleaned up
sessionToEventCallbackMap.Delete(session.pointer)
sessionToRXCallbackMap.Delete(session.pointer)
sessionToReplyRXCallbackMap.Delete(session.pointer)
return handleCcsmpError(func() SolClientReturnCode {
return C.solClient_session_destroy(&session.pointer)
})
Expand All @@ -302,26 +343,82 @@ func (session *SolClientSession) SolClientSessionPublish(message SolClientMessag
})
}

// SolClientSessionSubscribe wraps solClient_session_topicSubscribeWithDispatch
func (session *SolClientSession) SolClientSessionSubscribe(topic string, dispatch *SolClientSessionRxMsgDispatchFuncInfo, correlationID uintptr) *SolClientErrorInfoWrapper {
// solClientSessionSubscribeWithFlags wraps solClient_session_topicSubscribeWithDispatch
func (session *SolClientSession) solClientSessionSubscribeWithFlags(topic string, flags C.solClient_subscribeFlags_t, dispatchID uintptr, correlationID uintptr) *SolClientErrorInfoWrapper {
return handleCcsmpError(func() SolClientReturnCode {
cString := C.CString(topic)
defer C.free(unsafe.Pointer(cString))
// This is not an unsafe usage of unsafe.Pointer as we are using correlationId as data, not as a pointer
return C.solClient_session_topicSubscribeWithDispatch(session.pointer, C.SOLCLIENT_SUBSCRIBE_FLAGS_REQUEST_CONFIRM, cString, dispatch, C.uintptr_to_void_p(C.solClient_uint64_t(correlationID)))
return C.SessionTopicSubscribeWithFlags(session.pointer,
cString,
flags,
C.uintptr_to_void_p(C.solClient_uint64_t(dispatchID)),
C.uintptr_to_void_p(C.solClient_uint64_t(correlationID)))
})
}

// SolClientSessionUnsubscribe wraps solClient_session_topicUnsubscribeWithDispatch
func (session *SolClientSession) SolClientSessionUnsubscribe(topic string, dispatch *SolClientSessionRxMsgDispatchFuncInfo, correlationID uintptr) *SolClientErrorInfoWrapper {
// solClientSessionSubscribeWithFlags wraps solClient_session_topicSubscribeWithDispatch
func (session *SolClientSession) solClientSessionSubscribeReplyTopicWithFlags(topic string, flags C.solClient_subscribeFlags_t, dispatchID uintptr, correlationID uintptr) *SolClientErrorInfoWrapper {
return handleCcsmpError(func() SolClientReturnCode {
cString := C.CString(topic)
defer C.free(unsafe.Pointer(cString))
// This is not an unsafe usage of unsafe.Pointer as we are using correlationId as data, not as a pointer
return C.SessionReplyTopicSubscribeWithFlags(session.pointer,
cString,
flags,
C.uintptr_to_void_p(C.solClient_uint64_t(dispatchID)),
C.uintptr_to_void_p(C.solClient_uint64_t(correlationID)))
})
}

// solClientSessionUnsubscribeWithFlags wraps solClient_session_topicUnsubscribeWithDispatch
func (session *SolClientSession) solClientSessionUnsubscribeWithFlags(topic string, flags C.solClient_subscribeFlags_t, dispatchID uintptr, correlationID uintptr) *SolClientErrorInfoWrapper {
return handleCcsmpError(func() SolClientReturnCode {
cString := C.CString(topic)
defer C.free(unsafe.Pointer(cString))
// This is not an unsafe usage of unsafe.Pointer as we are using correlationId as data, not as a pointer
return C.solClient_session_topicUnsubscribeWithDispatch(session.pointer, C.SOLCLIENT_SUBSCRIBE_FLAGS_REQUEST_CONFIRM, cString, dispatch, C.uintptr_to_void_p(C.solClient_uint64_t(correlationID)))
return C.SessionTopicUnsubscribeWithFlags(session.pointer,
cString,
flags,
C.uintptr_to_void_p(C.solClient_uint64_t(dispatchID)),
C.uintptr_to_void_p(C.solClient_uint64_t(correlationID)))
})
}

// solClientSessionUnsubscribeReplyTopicWithFlags wraps solClient_session_topicUnsubscribeWithDispatch
func (session *SolClientSession) solClientSessionUnsubscribeReplyTopicWithFlags(topic string, flags C.solClient_subscribeFlags_t, dispatchID uintptr, correlationID uintptr) *SolClientErrorInfoWrapper {
return handleCcsmpError(func() SolClientReturnCode {
cString := C.CString(topic)
defer C.free(unsafe.Pointer(cString))
// This is not an unsafe usage of unsafe.Pointer as we are using correlationId as data, not as a pointer
return C.SessionReplyTopicUnsubscribeWithFlags(session.pointer,
cString,
flags,
C.uintptr_to_void_p(C.solClient_uint64_t(dispatchID)),
C.uintptr_to_void_p(C.solClient_uint64_t(correlationID)))
})
}

// SolClientSessionSubscribeReplyTopic wraps solClient_session_topicSubscribeWithDispatch
func (session *SolClientSession) SolClientSessionSubscribeReplyTopic(topic string, dispatchID uintptr, correlationID uintptr) *SolClientErrorInfoWrapper {
return session.solClientSessionSubscribeReplyTopicWithFlags(topic, C.SOLCLIENT_SUBSCRIBE_FLAGS_LOCAL_DISPATCH_ONLY, dispatchID, correlationID)
}

// SolClientSessionUnsubscribeReplyTopic wraps solClient_session_topicUnsubscribeWithDispatch
func (session *SolClientSession) SolClientSessionUnsubscribeReplyTopic(topic string, dispatchID uintptr, correlationID uintptr) *SolClientErrorInfoWrapper {
return session.solClientSessionUnsubscribeReplyTopicWithFlags(topic, C.SOLCLIENT_SUBSCRIBE_FLAGS_LOCAL_DISPATCH_ONLY, dispatchID, correlationID)
}

// SolClientSessionSubscribe wraps solClient_session_topicSubscribeWithDispatch
func (session *SolClientSession) SolClientSessionSubscribe(topic string, dispatchID uintptr, correlationID uintptr) *SolClientErrorInfoWrapper {
return session.solClientSessionSubscribeWithFlags(topic, C.SOLCLIENT_SUBSCRIBE_FLAGS_REQUEST_CONFIRM, dispatchID, correlationID)
}

// SolClientSessionUnsubscribe wraps solClient_session_topicUnsubscribeWithDispatch
func (session *SolClientSession) SolClientSessionUnsubscribe(topic string, dispatchID uintptr, correlationID uintptr) *SolClientErrorInfoWrapper {
return session.solClientSessionUnsubscribeWithFlags(topic, C.SOLCLIENT_SUBSCRIBE_FLAGS_REQUEST_CONFIRM, dispatchID, correlationID)
}

// SolClientEndpointProvision wraps solClient_session_endpointProvision
func (session *SolClientSession) SolClientEndpointProvision(properties []string) *SolClientErrorInfoWrapper {
return handleCcsmpError(func() SolClientReturnCode {
Expand Down Expand Up @@ -396,6 +493,39 @@ func (session *SolClientSession) SolClientSessionGetClientName() (string, *SolCl
return string(clientName[:endIndex]), nil
}

// SolClientSessionGetP2PTopicPrefix wraps solClient_session_getProperty
func (session *SolClientSession) SolClientSessionGetP2PTopicPrefix() (string, *SolClientErrorInfoWrapper) {
const maxTopicSize = 251 // max topic size including the nul terminal
p2pTopicInUseKey := C.CString(SolClientSessionPropP2pinboxInUse)
defer C.free(unsafe.Pointer(p2pTopicInUseKey))
p2pTopicInUse := make([]byte, maxTopicSize)
// Get the P2P topic for this session/transport.
// It is used together with inbox request/reply MEP using
// native CCSMP inbox
// Example CCSMP session
// P2PINBOX_IN_USE: '#P2P/v:mybroker/mPuoLl8m/myhost/5221/00000001/oWxIwBFz28/#'
// This only works if the session is connected
errorInfo := handleCcsmpError(func() SolClientReturnCode {
return C.solClient_session_getProperty(session.pointer, p2pTopicInUseKey, (*C.char)(unsafe.Pointer(&p2pTopicInUse[0])), maxTopicSize)
})
if errorInfo != nil {
return "", errorInfo
}
endIndex := maxTopicSize
for i := 0; i < maxTopicSize; i++ {
if p2pTopicInUse[i] == 0 {
endIndex = i
break
}
}
// truncate last character '#'
if endIndex > 0 {
endIndex = endIndex - 1
p2pTopicInUse[endIndex] = 0
}
return string(p2pTopicInUse[:endIndex]), nil
}

// SolClientVersionGet wraps solClient_version_get
func SolClientVersionGet() (err *SolClientErrorInfoWrapper, version, dateTime, variant string) {
var versionInfo *SolClientVersionInfo
Expand Down Expand Up @@ -445,6 +575,14 @@ func NewSessionDispatch(id uint64) (*SolClientSessionRxMsgDispatchFuncInfo, uint
}, ptr
}

// NewSessionReplyDispatch function
func NewSessionReplyDispatch(id uint64) uintptr {
// This is not a misuse of unsafe.Pointer as we are not storing a pointer.
// CGO defines void* as unsafe.Pointer, however it is just arbitrary data.
// We want to store a number at void*
return uintptr(id)
}

// GetLastErrorInfo should NOT be called in most cases as it is dependent on the thread.
// Unless you know that the goroutine running the code will not be interrupted, do NOT
// call this function!
Expand Down
Loading
Loading