#507 connection_name property is not set on windows platform
This commit is contained in:
parent
38eff4019d
commit
a68cd2ed49
|
|
@ -228,15 +228,14 @@ public:
|
||||||
if (!properties.contains("information")) properties["information"] = "https://github.com/CopernicaMarketingSoftware/AMQP-CPP";
|
if (!properties.contains("information")) properties["information"] = "https://github.com/CopernicaMarketingSoftware/AMQP-CPP";
|
||||||
if (!properties.contains("capabilities")) properties["capabilities"] = capabilities;
|
if (!properties.contains("capabilities")) properties["capabilities"] = capabilities;
|
||||||
|
|
||||||
|
if (!properties.contains("product")) properties["product"] = ProgramName();;
|
||||||
|
if (!properties.contains("connection_name")) properties["connection_name"] = ProgramName();
|
||||||
#if defined(_WIN32) || defined(_WIN64)
|
#if defined(_WIN32) || defined(_WIN64)
|
||||||
// i don't know that much about win32, so let's use hardcoded string
|
// i don't know that much about win32, so let's use hardcoded string
|
||||||
if (!properties.contains("product")) properties["product"] = "application based on AMQP-CPP";
|
|
||||||
if (!properties.contains("platform")) properties["platform"] = "windows";
|
if (!properties.contains("platform")) properties["platform"] = "windows";
|
||||||
#else
|
#else
|
||||||
// on unix-like systems I know how to retrieve application and platform info
|
// on unix-like systems I know how to retrieve application and platform info
|
||||||
if (!properties.contains("product")) properties["product"] = ProgramName();
|
|
||||||
if (!properties.contains("platform")) properties["platform"] = PlatformName();
|
if (!properties.contains("platform")) properties["platform"] = PlatformName();
|
||||||
if (!properties.contains("connection_name")) properties["connection_name"] = ProgramName();
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// send back a connection start ok frame
|
// send back a connection start ok frame
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,11 @@
|
||||||
* Dependencies
|
* Dependencies
|
||||||
*/
|
*/
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
|
#if defined(_WIN32) || defined(_WIN64)
|
||||||
|
#include "Windows.h"
|
||||||
|
#else
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Begin of namespace
|
* Begin of namespace
|
||||||
|
|
@ -47,6 +51,9 @@ public:
|
||||||
*/
|
*/
|
||||||
ProgramName()
|
ProgramName()
|
||||||
{
|
{
|
||||||
|
#if defined(_WIN32) || defined(_WIN64)
|
||||||
|
GetModuleFileNameA(NULL, _path, MAX_PATH);
|
||||||
|
#else
|
||||||
// read the link target
|
// read the link target
|
||||||
auto size = readlink("/proc/self/exe", _path, PATH_MAX);
|
auto size = readlink("/proc/self/exe", _path, PATH_MAX);
|
||||||
|
|
||||||
|
|
@ -55,6 +62,7 @@ public:
|
||||||
|
|
||||||
// set trailing null byte
|
// set trailing null byte
|
||||||
_path[size == PATH_MAX ? PATH_MAX-1 : size] = '\0';
|
_path[size == PATH_MAX ? PATH_MAX-1 : size] = '\0';
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue