Skip to content

Commit 3e691cd

Browse files
committed
Merge branch 'main' into ws-endpoint
2 parents 20a5bb7 + 1b94ccc commit 3e691cd

File tree

3 files changed

+16
-14
lines changed

3 files changed

+16
-14
lines changed

.github/workflows/publish-go-tester-task.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ jobs:
6565
#use the strategy instead because we still use the native build
6666
strategy:
6767
matrix:
68-
os: [ubuntu-20.04, windows-2019, macos-12]
68+
os: [ubuntu-20.04, windows-2019, macos-13]
6969
arch: [-amd64]
7070
include:
7171
- os: windows-2019
@@ -130,7 +130,7 @@ jobs:
130130
mv ${{ env.PROJECT_NAME }} ${{ env.PROJECT_NAME}}_amd64
131131
if: runner.os == 'macOS'
132132

133-
- name: Build the Agent for macos amd 64
133+
- name: Build the Agent for macos arm 64
134134
env:
135135
MACOSX_DEPLOYMENT_TARGET: 10.15 # minimum supported version for mac
136136
CGO_CFLAGS: -mmacosx-version-min=10.15

.github/workflows/release.yml

+9-9
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232
prerelease: ${{ steps.prerelease.outputs.IS_PRE }}
3333
strategy:
3434
matrix:
35-
os: [ubuntu-20.04, windows-2019, macos-12]
35+
os: [ubuntu-20.04, windows-2019, macos-13]
3636
arch: [amd64]
3737
include:
3838
- os: windows-2019
@@ -116,7 +116,7 @@ jobs:
116116
run: |
117117
task go:build
118118
mv ${{ env.PROJECT_NAME }} ${{ env.PROJECT_NAME }}_amd64
119-
if: matrix.os == 'macos-12'
119+
if: matrix.os == 'macos-13'
120120

121121
- name: Build the Agent for macos arm64
122122
env:
@@ -128,13 +128,13 @@ jobs:
128128
run: |
129129
task go:build
130130
mv ${{ env.PROJECT_NAME }} ${{ env.PROJECT_NAME }}_arm64
131-
if: matrix.os == 'macos-12'
131+
if: matrix.os == 'macos-13'
132132

133133
- name: Create universal macos executable
134134
run: |
135135
lipo -create -output ${{ env.PROJECT_NAME }} ${{ env.PROJECT_NAME }}_amd64 ${{ env.PROJECT_NAME }}_arm64
136136
rm ${{ env.PROJECT_NAME }}_amd64 ${{ env.PROJECT_NAME }}_arm64
137-
if: matrix.os == 'macos-12'
137+
if: matrix.os == 'macos-13'
138138

139139
# this will create `public/` dir with compressed full bin (<version>/<os>-<arch>.gz) and a json file
140140
- name: Create autoupdate files
@@ -146,7 +146,7 @@ jobs:
146146
run: |
147147
cp darwin-amd64.json darwin-arm64.json
148148
cp ${TAG_VERSION}/darwin-amd64.gz ${TAG_VERSION}/darwin-arm64.gz
149-
if: matrix.os == 'macos-12' && steps.prerelease.outputs.IS_PRE != 'true'
149+
if: matrix.os == 'macos-13' && steps.prerelease.outputs.IS_PRE != 'true'
150150

151151
- name: Create autoupdate files for win32
152152
run: go-selfupdate -platform windows-${{ matrix.arch }} ${{ env.PROJECT_NAME }}${{ matrix.ext }} ${TAG_VERSION}
@@ -181,7 +181,7 @@ jobs:
181181
matrix:
182182
arch: [amd64, arm64]
183183

184-
runs-on: macos-12
184+
runs-on: macos-13
185185
env:
186186
EXE_PATH: "skel/ArduinoCloudAgent.app/Contents/MacOS/"
187187

@@ -195,7 +195,7 @@ jobs:
195195
- name: Download artifact
196196
uses: actions/download-artifact@v4
197197
with:
198-
name: ${{ env.PROJECT_NAME }}-macos-12-amd64 # if we want to support darwin-arm64 in the future for real this has to change.
198+
name: ${{ env.PROJECT_NAME }}-macos-13-amd64 # if we want to support darwin-arm64 in the future for real this has to change.
199199
path: ${{ env.EXE_PATH }}
200200

201201
- name: Remove placeholder file
@@ -252,7 +252,7 @@ jobs:
252252
matrix:
253253
arch: [amd64, arm64]
254254

255-
runs-on: macos-12
255+
runs-on: macos-13
256256
env:
257257
GON_PATH: ${{ github.workspace }}/gon
258258
needs: [build, create-macos-bundle]
@@ -509,7 +509,7 @@ jobs:
509509
matrix:
510510
arch: [amd64]
511511

512-
runs-on: macos-12
512+
runs-on: macos-13
513513
steps:
514514
- name: Checkout repo with icons/background
515515
uses: actions/checkout@v4

serialport.go

+5-3
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import (
2020
"encoding/base64"
2121
"io"
2222
"strconv"
23+
"sync/atomic"
2324
"time"
2425
"unicode/utf8"
2526

@@ -43,7 +44,7 @@ type serport struct {
4344

4445
// Keep track of whether we're being actively closed
4546
// just so we don't show scary error messages
46-
isClosing bool
47+
isClosing atomic.Bool
4748

4849
isClosingDueToError bool
4950

@@ -85,7 +86,7 @@ func (p *serport) reader(buftype string) {
8586
bufferPart := serialBuffer[:n]
8687

8788
//if we detect that port is closing, break out of this for{} loop.
88-
if p.isClosing {
89+
if p.isClosing.Load() {
8990
strmsg := "Shutting down reader on " + p.portConf.Name
9091
log.Println(strmsg)
9192
h.broadcastSys <- []byte(strmsg)
@@ -348,7 +349,8 @@ func spHandlerOpen(portname string, baud int, buftype string) {
348349
}
349350

350351
func (p *serport) Close() {
351-
p.isClosing = true
352+
p.isClosing.Store(true)
353+
352354
p.bufferwatcher.Close()
353355
p.portIo.Close()
354356
serialPorts.MarkPortAsClosed(p.portName)

0 commit comments

Comments
 (0)