Changeset: 8cc16c1b5a3e for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/8cc16c1b5a3e Modified Files: clients/mapilib/connect.c clients/mapilib/mapi.c clients/mapilib/mapi_intern.h monetdb5/modules/mal/mal_mapi.c Branch: client_interrupts Log Message:
Only send out-of-band interrupt message to server that can handle it. diffs (61 lines): diff --git a/clients/mapilib/connect.c b/clients/mapilib/connect.c --- a/clients/mapilib/connect.c +++ b/clients/mapilib/connect.c @@ -453,6 +453,17 @@ mapi_handshake(Mapi mid) } } + /* search for OOBINTR option, + * NOTE this consumes the rest of the challenge */ + char *rest = strtok_r(NULL, ":", &strtok_state); + while (rest != NULL) { + if (strcmp(rest, "OOBINTR=1") == 0) { + mid->oobintr = true; + break; + } + rest = strtok_r(NULL, ":", &strtok_state); + } + /* hash password, if not already */ if (password[0] != '\1') { char *pwdhash = NULL; diff --git a/clients/mapilib/mapi.c b/clients/mapilib/mapi.c --- a/clients/mapilib/mapi.c +++ b/clients/mapilib/mapi.c @@ -2702,7 +2702,8 @@ read_line(Mapi mid) len = mnstr_read(mid->from, mid->blk.buf + mid->blk.end, 1, BLOCK); if (len == -1 && mnstr_errnr(mid->from) == MNSTR_INTERRUPT) { mnstr_clearerr(mid->from); - mnstr_putoob(mid->to, 1); + if (mid->oobintr) + mnstr_putoob(mid->to, 1); } else break; } diff --git a/clients/mapilib/mapi_intern.h b/clients/mapilib/mapi_intern.h --- a/clients/mapilib/mapi_intern.h +++ b/clients/mapilib/mapi_intern.h @@ -244,6 +244,7 @@ struct MapiStruct { int handshake_options; /* which settings can be sent during challenge/response? */ bool columnar_protocol; bool sizeheader; + bool oobintr; MapiHdl first; /* start of doubly-linked list */ MapiHdl active; /* set when not all rows have been received */ diff --git a/monetdb5/modules/mal/mal_mapi.c b/monetdb5/modules/mal/mal_mapi.c --- a/monetdb5/modules/mal/mal_mapi.c +++ b/monetdb5/modules/mal/mal_mapi.c @@ -192,8 +192,10 @@ doChallenge(void *data) return; } - // Send the challenge over the block stream - mnstr_printf(fdout, "%s:mserver:9:%s:%s:%s:sql=%d:BINARY=1:", + /* Send the challenge over the block stream + * We can do binary transfers, and we can interrupt queries using + * out-of-band messages */ + mnstr_printf(fdout, "%s:mserver:9:%s:%s:%s:sql=%d:BINARY=1:OOBINTR=1:", challenge, mcrypt_getHashAlgorithms(), #ifdef WORDS_BIGENDIAN "BIG", _______________________________________________ checkin-list mailing list -- checkin-list@monetdb.org To unsubscribe send an email to checkin-list-le...@monetdb.org