Skip to content

Commit ae2c885

Browse files
committed
fix: dispatcher cannot bind same signature callbacks
1 parent 838a7db commit ae2c885

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/dispatcher.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,9 @@ class RpcFunctionDispatcher {
1616
template<typename F>
1717
bool bind(MsgPack::str_t name, F&& f) {
1818
if (_count >= N) return false;
19-
static auto wrapper = wrap(std::forward<F>(f));
20-
_entries[_count++] = {name, &wrapper};
19+
using WrapperT = decltype(wrap(std::forward<F>(f)));
20+
WrapperT* instance = new WrapperT(wrap(std::forward<F>(f)));
21+
_entries[_count++] = {name, instance};
2122
return true;
2223
}
2324

0 commit comments

Comments
 (0)