From 1e76f237de4a199809c672600269a1e440c48b2e Mon Sep 17 00:00:00 2001 From: Luke Ceddia Date: Sat, 31 Jul 2021 00:06:09 +1000 Subject: [PATCH 1/2] Supress SIGPIPE on tcp send --- internal/c/libqb.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/internal/c/libqb.cpp b/internal/c/libqb.cpp index fe2dad252..69389f545 100644 --- a/internal/c/libqb.cpp +++ b/internal/c/libqb.cpp @@ -21740,14 +21740,18 @@ void sub_put2(int32 i,int64 offset,void *element,int32 passed){ void tcp_out(void *connection,void *offset,ptrszint bytes){ #if !defined(DEPENDENCY_SOCKETS) - #elif defined(QB64_WINDOWS) || defined(QB64_UNIX) + #elif defined(QB64_WINDOWS) || defined(QB64_UNIX) + // Handle Windows which might not have this flag (it would be a no-op anyway) + #if !defined(MSG_NOSIGNAL) + #define MSG_NOSIGNAL 0 + #endif tcp_connection *tcp; tcp=(tcp_connection*)connection; int total = 0; // how many bytes we've sent int bytesleft = bytes; // how many we have left to send int n; while(total < bytes) { - n = send(tcp->socket, (char*)((char *)offset + total), bytesleft, 0); + n = send(tcp->socket, (char*)((char *)offset + total), bytesleft, MSG_NOSIGNAL); if (n < 0) { tcp->connected = 0; return; From b8e6d299593eef226aa731109b09edfac1bfb35c Mon Sep 17 00:00:00 2001 From: Luke Ceddia Date: Sat, 31 Jul 2021 00:46:10 +1000 Subject: [PATCH 2/2] Use _cv/_mk for passing _offsets --- internal/support/vwatch/vwatch.bm | 6 +++--- source/ide/ide_methods.bas | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/internal/support/vwatch/vwatch.bm b/internal/support/vwatch/vwatch.bm index c04b1082a..811fb3cbd 100644 --- a/internal/support/vwatch/vwatch.bm +++ b/internal/support/vwatch/vwatch.bm @@ -218,7 +218,7 @@ SUB vwatch (globalVariables AS _OFFSET, localVariables AS _OFFSET) vw_address = _OFFSET(globalVariables) + LEN(vw_address) * vw_localIndex vw_address = _MEMGET(vw_m, vw_address, _OFFSET) 'first resolve pass vw_address = _MEMGET(vw_m, vw_address, _OFFSET) 'second resolve pass - vw_cmd$ = "global var:" + MKL$(vw_tempIndex) + STR$(vw_address) + vw_cmd$ = "global var:" + MKL$(vw_tempIndex) + _MK$(_OFFSET, vw_address) GOSUB SendCommand CASE "local var" vw_tempIndex = CVL(LEFT$(vw_value$, 4)) @@ -228,14 +228,14 @@ SUB vwatch (globalVariables AS _OFFSET, localVariables AS _OFFSET) vw_address = _OFFSET(localVariables) + LEN(vw_address) * vw_localIndex vw_address = _MEMGET(vw_m, vw_address, _OFFSET) 'first resolve pass vw_address = _MEMGET(vw_m, vw_address, _OFFSET) 'second resolve pass - vw_cmd$ = "local var:" + MKL$(vw_tempIndex) + STR$(vw_address) + vw_cmd$ = "local var:" + MKL$(vw_tempIndex) + _MK$(_OFFSET, vw_address) GOSUB SendCommand END IF CASE "get address" vw_tempIndex = CVL(LEFT$(vw_value$, 4)) vw_sequence = CVI(MID$(vw_value$, 5, 2)) vw_varSize = CVL(MID$(vw_value$, 7, 4)) - vw_address = VAL(MID$(vw_value$, 11)) + vw_address = _CV(_OFFSET, MID$(vw_value$, 11)) vw_buf$ = SPACE$(vw_varSize) vw_m = _MEM(vw_address, vw_varSize) vw_m2 = _MEM(_OFFSET(vw_buf$), vw_varSize) diff --git a/source/ide/ide_methods.bas b/source/ide/ide_methods.bas index f0b09e711..ed48d3bc2 100644 --- a/source/ide/ide_methods.bas +++ b/source/ide/ide_methods.bas @@ -7296,7 +7296,7 @@ SUB DebugMode END IF CASE "global var", "local var" tempIndex& = CVL(LEFT$(value$, 4)) - address%& = VAL(MID$(value$, 5)) + address%& = _CV(_OFFSET, MID$(value$, 5)) varType$ = usedVariableList(tempIndex&).varType IF INSTR(varType$, "STRING *") THEN varType$ = "STRING" SELECT CASE varType$ @@ -7310,7 +7310,7 @@ SUB DebugMode CASE "_OFFSET", "_UNSIGNED _OFFSET": varSize& = LEN(dummy%&) CASE "STRING": varSize& = LEN(dummy%&) + LEN(dummy&) END SELECT - cmd$ = "get address:" + MKL$(tempIndex&) + MKI$(1) + MKL$(varSize&) + STR$(address%&) + cmd$ = "get address:" + MKL$(tempIndex&) + MKI$(1) + MKL$(varSize&) + _MK$(_OFFSET, address%&) GOSUB SendCommand CASE "address read" tempIndex& = CVL(LEFT$(value$, 4)) @@ -7342,7 +7342,7 @@ SUB DebugMode strLength& = CVL(MID$(recvData$, 5)) END IF address$ = LEFT$(recvData$, LEN(dummy%&)) 'Pointer to data - cmd$ = "get address:" + MKL$(tempIndex&) + MKI$(2) + MKL$(strLength&) + STR$(address%&) + cmd$ = "get address:" + MKL$(tempIndex&) + MKI$(2) + MKL$(strLength&) + _MK$(_OFFSET, address%&) GOSUB SendCommand GOTO vwatch_string_seq1_done END IF