Changeset: f392868cd625 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/f392868cd625
Modified Files:
        clients/ChangeLog.Dec2023
        clients/mapilib/mapi.c
Branch: Dec2023
Log Message:

Deal better with server disconnecting mid query.
With this change, mclient will properly exit if the server goes away
while waiting for a query result.


diffs (33 lines):

diff --git a/clients/ChangeLog.Dec2023 b/clients/ChangeLog.Dec2023
--- a/clients/ChangeLog.Dec2023
+++ b/clients/ChangeLog.Dec2023
@@ -1,3 +1,8 @@
 # ChangeLog file for clients
 # This file is updated with Maddlog
 
+* Wed Mar  6 2024 Sjoerd Mullender <sjo...@acm.org>
+- Fixed an issue where mclient wouldn't exit if the server it had
+  connected to exited for whatever reason while the client was waiting
+  for a query result.
+
diff --git a/clients/mapilib/mapi.c b/clients/mapilib/mapi.c
--- a/clients/mapilib/mapi.c
+++ b/clients/mapilib/mapi.c
@@ -1674,7 +1674,7 @@ finish_handle(MapiHdl hdl)
        if (hdl == NULL)
                return MERROR;
        mid = hdl->mid;
-       if (mid->active == hdl && !hdl->needmore &&
+       if (mid->active == hdl && !hdl->needmore && !mnstr_eof(mid->from) &&
            read_into_cache(hdl, 0) != MOK)
                return MERROR;
        if (mid->to) {
@@ -3390,7 +3390,7 @@ read_into_cache(MapiHdl hdl, int lookahe
                line = read_line(mid);
                if (line == NULL) {
                        if (mid->from && mnstr_eof(mid->from)) {
-                               return mapi_setError(mid, "unexpected end of 
file", __func__, MERROR);
+                               return mapi_setError(mid, "unexpected end of 
file", __func__, MTIMEOUT);
                        }
                        return mid->error;
                }
_______________________________________________
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org

Reply via email to