|
|
|
@ -752,7 +752,10 @@ conn_t *connection_master_link(conn_sys_t *ssys, int sck, struct in_addr *addr)
|
|
|
|
|
if(head->opcode != SNE_SUCCESS) { r = head->opcode; goto __fail3; }
|
|
|
|
|
else { /* opcode is fine */
|
|
|
|
|
/* if we're ready for messaging mode, turn off batch mode */
|
|
|
|
|
if(co->flags & SNSX_MESSAGINGMODE) co->flags &= ~SNSX_BATCHMODE;
|
|
|
|
|
if(co->flags & SNSX_MESSAGINGMODE) {
|
|
|
|
|
co->flags &= ~SNSX_BATCHMODE;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(!head->payload_length) continue; /* pass the following check up */
|
|
|
|
@ -768,6 +771,7 @@ conn_t *connection_master_link(conn_sys_t *ssys, int sck, struct in_addr *addr)
|
|
|
|
|
msg->mhead.payload_length = 0;
|
|
|
|
|
/* deal with it */
|
|
|
|
|
r = __eval_syssexp(co, sx);
|
|
|
|
|
memcpy(head, &msg->mhead, sizeof(sntllv2_head_t));
|
|
|
|
|
head->opcode = r;
|
|
|
|
|
if(r != SNE_SUCCESS) { /* we finish */
|
|
|
|
|
head->payload_length = 0;
|
|
|
|
@ -956,6 +960,7 @@ conn_t *connection_link(conn_sys_t *ssys, const char *host,
|
|
|
|
|
/* form a message -- credentials */
|
|
|
|
|
ln = snprintf(bbuf, 65535 - sizeof(sntllv2_head_t), "(auth-set-credentials \"%s\" \"%s\")",
|
|
|
|
|
login ? login : "nil", passwd ? passwd : "nil");
|
|
|
|
|
|
|
|
|
|
head->opcode = SNE_SUCCESS;
|
|
|
|
|
head->payload_length = ln;
|
|
|
|
|
wr = __conn_write(co, buf, ln + sizeof(sntllv2_head_t));
|
|
|
|
@ -963,12 +968,15 @@ conn_t *connection_link(conn_sys_t *ssys, const char *host,
|
|
|
|
|
|
|
|
|
|
rd = __conn_read(co, head, sizeof(sntllv2_head_t));
|
|
|
|
|
if(rd < 0) goto __fail2;
|
|
|
|
|
if(head->opcode != SNE_SUCCESS) goto __fail2;
|
|
|
|
|
if(head->opcode != SNE_SUCCESS) {
|
|
|
|
|
r = head->opcode;
|
|
|
|
|
goto __fail2;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* ok, get available channels */
|
|
|
|
|
head->opcode = SNE_SUCCESS;
|
|
|
|
|
head->payload_length = ln;
|
|
|
|
|
ln = snprintf(bbuf, 65535 - sizeof(sntllv2_head_t), "(get-channels-list)");
|
|
|
|
|
head->payload_length = ln;
|
|
|
|
|
wr = __conn_write(co, buf, ln + sizeof(sntllv2_head_t));
|
|
|
|
|
if(wr < 0) goto __fail2;
|
|
|
|
|
|
|
|
|
@ -982,6 +990,7 @@ conn_t *connection_link(conn_sys_t *ssys, const char *host,
|
|
|
|
|
/* perform a parsing of the desired message */
|
|
|
|
|
bbuf[rd] = '\0';
|
|
|
|
|
sx = parse_sexp(bbuf, rd);
|
|
|
|
|
if(!sx) { r = SNE_BADPROTO; goto __fail2; }
|
|
|
|
|
r = __eval_syssexp(co, sx);
|
|
|
|
|
destroy_sexp(sx);
|
|
|
|
|
head->opcode = r;
|
|
|
|
|