jiridanek commented on a change in pull request #294:
URL: https://github.com/apache/qpid-dispatch/pull/294#discussion_r459886451
##########
File path: src/amqp.c
##########
@@ -90,11 +93,29 @@ const char * const QD_AMQP_COND_CONNECTION_FORCED =
"amqp:connection:forced";
const char * const QD_AMQP_PORT_STR = "5672";
const char * const QD_AMQPS_PORT_STR = "5671";
+const char * const QD_AMQP_DFLT_PROTO = "tcp";
+
int qd_port_int(const char* port_str) {
- if (!strcmp(port_str, QD_AMQP_PORT_STR)) return QD_AMQP_PORT_INT;
- if (!strcmp(port_str, QD_AMQPS_PORT_STR)) return QD_AMQPS_PORT_INT;
errno = 0;
unsigned long n = strtoul(port_str, NULL, 10);
if (errno || n > 0xFFFF) return -1;
+
+ // Port is not an integer (port = 'amqp' or 'amqps')
+ if ( !n && strlen(port_str) > 0 ) {
+ // Resolve service port
+ struct servent serv_info;
+ struct servent *serv_info_res;
+ int buf_len = 4096;
+ char *buf = calloc(buf_len, sizeof(char));
Review comment:
This can be allocated on stack, so `alloca` or `enum {buf_len = 4096 };
char buf[buf_len];`
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]