version 1.2, 2012/01/27 15:05:38
|
version 1.2.2.1, 2012/04/11 15:08:27
|
Line 2
|
Line 2
|
|
|
|
|
int |
int |
srv_Socket(sl_config * __restrict cfg) | srv_Socket(cfg_root_t * __restrict cfg) |
{ |
{ |
int s = -1, n = 1; |
int s = -1, n = 1; |
struct hostent *host; |
struct hostent *host; |
char szStr[STRSIZ]; | ait_val_t v; |
u_short port; |
u_short port; |
struct sockaddr_storage ss; |
struct sockaddr_storage ss; |
struct sockaddr_in *sin = (struct sockaddr_in*) &ss; |
struct sockaddr_in *sin = (struct sockaddr_in*) &ss; |
Line 14 srv_Socket(sl_config * __restrict cfg)
|
Line 14 srv_Socket(sl_config * __restrict cfg)
|
|
|
ioTRACE(2); |
ioTRACE(2); |
|
|
cfg_LoadAttribute(cfg, CFG("mqttd"), CFG("port"), CFG(szStr), sizeof szStr, MQTT_PORT); | cfg_loadAttribute(cfg, "mqttd", "port", &v, MQTT_PORT); |
port = strtol(szStr, NULL, 0); | port = strtol(AIT_GET_STR(&v), NULL, 0); |
cfg_LoadAttribute(cfg, CFG("mqttd"), CFG("listen"), CFG(szStr), sizeof szStr, MQTT_HOST); | AIT_FREE_VAL(&v); |
| cfg_loadAttribute(cfg, "mqttd", "listen", &v, MQTT_HOST); |
|
|
host = gethostbyname(szStr); | host = gethostbyname(AIT_GET_STR(&v)); |
| AIT_FREE_VAL(&v); |
if (!host) { |
if (!host) { |
printf("Error:: resolver #%d - %s\n", h_errno, hstrerror(h_errno)); |
printf("Error:: resolver #%d - %s\n", h_errno, hstrerror(h_errno)); |
return -1; |
return -1; |