Skip to content
Snippets Groups Projects
Commit a4c879eb authored by Sergey Yakubov's avatar Sergey Yakubov
Browse files

fix segfault

parent bb20c711
No related branches found
No related tags found
No related merge requests found
#include <common/networking.h> #include <common/networking.h>
#include "consumer/data_broker.h" #include "consumer/data_broker.h"
#include "server_data_broker.h" #include "server_data_broker.h"
#include "consumer//consumer_error.h"
namespace asapo { namespace asapo {
...@@ -10,7 +10,7 @@ std::unique_ptr<DataBroker> Create(const std::string& source_name, ...@@ -10,7 +10,7 @@ std::unique_ptr<DataBroker> Create(const std::string& source_name,
Error* error, Error* error,
Args&& ... args) noexcept { Args&& ... args) noexcept {
if (source_name.empty()) { if (source_name.empty()) {
error->reset(new SimpleError("Empty Data Source")); *error = ConsumerErrorTemplates::kWrongInput.Generate("Empty Data Source");
return nullptr; return nullptr;
} }
......
...@@ -335,11 +335,11 @@ cdef class __PyDataBrokerFactory: ...@@ -335,11 +335,11 @@ cdef class __PyDataBrokerFactory:
cdef unique_ptr[DataBroker] c_broker cdef unique_ptr[DataBroker] c_broker
with nogil: with nogil:
c_broker = self.c_factory.CreateServerBroker(b_server_name,b_source_path,b_has_filesystem,source,&err) c_broker = self.c_factory.CreateServerBroker(b_server_name,b_source_path,b_has_filesystem,source,&err)
if err:
throw_exception(err)
broker = PyDataBroker() broker = PyDataBroker()
broker.c_broker = c_broker.release() broker.c_broker = c_broker.release()
broker.c_broker.SetTimeout(timeout) broker.c_broker.SetTimeout(timeout)
if err:
throw_exception(err)
return broker return broker
def create_server_broker(server_name,source_path,has_filesystem,beamtime_id,stream,token,timeout_ms): def create_server_broker(server_name,source_path,has_filesystem,beamtime_id,stream,token,timeout_ms):
...@@ -354,7 +354,7 @@ def create_server_broker(server_name,source_path,has_filesystem,beamtime_id,stre ...@@ -354,7 +354,7 @@ def create_server_broker(server_name,source_path,has_filesystem,beamtime_id,stre
:rtype: Tuple with broker object and error. :rtype: Tuple with broker object and error.
""" """
factory = __PyDataBrokerFactory() factory = __PyDataBrokerFactory()
return factory.create_server_broker(_bytes(server_name),_bytes(source_path),has_filesystem, _bytes(beamtime_id),_bytes(stream),_bytes(token),timeout_ms) return factory.create_server_broker(server_name,source_path,has_filesystem, beamtime_id,stream,token,timeout_ms)
__version__ = "@PYTHON_ASAPO_VERSION@@ASAPO_VERSION_COMMIT@" __version__ = "@PYTHON_ASAPO_VERSION@@ASAPO_VERSION_COMMIT@"
...@@ -202,6 +202,15 @@ def check_single(broker, group_id): ...@@ -202,6 +202,15 @@ def check_single(broker, group_id):
else: else:
exit_on_noerr("AsapoBrokerServersNotFound") exit_on_noerr("AsapoBrokerServersNotFound")
try:
asapo_consumer.create_server_broker("", "", True, "", "", "", 1000)
except asapo_consumer.AsapoWrongInputError as err:
print(err)
pass
else:
exit_on_noerr("should be AsapoWrongInputError")
def check_dataset(broker, group_id): def check_dataset(broker, group_id):
res = broker.get_next_dataset(group_id) res = broker.get_next_dataset(group_id)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment