Compare commits

...

3 Commits

Author SHA1 Message Date
jikstra
008fd1cf5f Fix node package ci 2022-05-18 14:20:56 +02:00
bjoern
33b10fa719 re-add removed DC_MSG_ID_MARKER1 as in use on iOS (#3330)
in fact, `get_chat_msgs()` with `marker1before` is not used on iOS,
however, iOS still needs the special chat-id.

in #3274 we did not check this possibility.

it may be changed, of course, however, that would requore some refactorings
in an anyway complicated area and is probably not worth the effort.
2022-05-17 19:31:11 +02:00
link2xt
6d189dab98 Fix race condition in alloc_ongoing()
Hold the same write lock while checking if ongoing
process is already allocated and while allocating it.
Otherwise it is possible for two parallel processes
running alloc_ongoing() to decide that no ongoing
process is allocated and allocate two ongoing processes.
2022-05-17 18:25:51 +02:00
5 changed files with 23 additions and 61 deletions

View File

@@ -8,7 +8,7 @@ on:
jobs:
prebuild:
name: 'Tests & Prebuild'
name: 'Prebuild'
runs-on: ${{ matrix.os }}
strategy:
matrix:
@@ -50,20 +50,6 @@ jobs:
cd node
npm install --verbose
- name: Test
if: runner.os != 'Windows'
run: |
cd node
npm run test
env:
DCC_NEW_TMP_EMAIL: ${{ secrets.DCC_NEW_TMP_EMAIL }}
- name: Run tests on Windows, except lint
if: runner.os == 'Windows'
run: |
cd node
npm run test:mocha
env:
DCC_NEW_TMP_EMAIL: ${{ secrets.DCC_NEW_TMP_EMAIL }}
- name: Build Prebuild
run: |
cd node
@@ -88,19 +74,6 @@ jobs:
- uses: actions/setup-node@v2
with:
node-version: '16'
- name: get tag
id: tag
uses: dawidd6/action-get-tag@v1
continue-on-error: true
- name: Get Pullrequest ID
id: prepare
run: |
tag=${{ steps.tag.outputs.tag }}
if [ -z "$tag" ]; then
node -e "console.log('::set-output name=prid::' + '${{ github.ref }}'.split('/')[2])"
else
echo "No preview will be uploaded this time, but the $tag release"
fi
- name: System info
run: |
rustc -vV
@@ -122,28 +95,31 @@ jobs:
name: windows-latest
- shell: bash
run: |
mkdir prebuilds
tar -xvzf ubuntu-18.04/ubuntu-18.04.tar.gz -C prebuilds
tar -xvzf macos-latest/macos-latest.tar.gz -C prebuilds
tar -xvzf windows-latest/windows-latest.tar.gz -C prebuilds
tree prebuilds
mkdir node/prebuilds
tar -xvzf ubuntu-18.04/ubuntu-18.04.tar.gz -C node/prebuilds
tar -xvzf macos-latest/macos-latest.tar.gz -C node/prebuilds
tar -xvzf windows-latest/windows-latest.tar.gz -C node/prebuilds
tree node/prebuilds
- name: install dependencies without running scripts
run: |
npm install --ignore-scripts
- name: build typescript part
run: |
npm run build:bindings:ts
- name: Set DELTACHAT_NODE_TAR_GZ env variable
run: |
echo "DELTACHAT_NODE_TAR_GZ=deltachat-node-${{ github.ref_name }}" >> $GITHUB_ENV
- name: package
shell: bash
run: |
npm pack .
ls -lah
mv $(find deltachat-node-*) deltachat-node-${{ steps.prepare.outputs.prid }}.tar.gz
mv $(find deltachat-node-*) $DELTACHAT_NODE_TAR_GZ
- name: Upload Prebuild
uses: actions/upload-artifact@v1
with:
name: deltachat-node.tgz
path: deltachat-node-${{ steps.prepare.outputs.prid }}.tar.gz
path: $DELTACHAT_NODE_TAR_GZ
# Upload to download.delta.chat/node/preview/
- name: Upload deltachat-node preview to download.delta.chat/node/preview/
id: upload-preview
@@ -151,14 +127,8 @@ jobs:
run: |
echo -e "${{ secrets.SSH_KEY }}" >__TEMP_INPUT_KEY_FILE
chmod 600 __TEMP_INPUT_KEY_FILE
scp -o StrictHostKeyChecking=no -v -i __TEMP_INPUT_KEY_FILE -P "22" -r deltachat-node-${{ steps.prepare.outputs.prid }}.tar.gz "${{ secrets.USERNAME }}"@"download.delta.chat":"/var/www/html/download/node/preview/"
scp -o StrictHostKeyChecking=no -v -i __TEMP_INPUT_KEY_FILE -P "22" -r $DELTACHAT_NODE_TAR_GZ "${{ secrets.USERNAME }}"@"download.delta.chat":"/var/www/html/download/node/preview/"
continue-on-error: true
- name: "Post links to details"
if: steps.upload-preview.outcome == 'success'
run: node ./node/scripts/postLinksToDetails.js
env:
URL: preview/deltachat-node-${{ steps.prepare.outputs.prid }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Upload to download.delta.chat/node/
- name: Upload deltachat-node build to download.delta.chat/node/
if: ${{ steps.tag.outputs.tag }}
@@ -167,4 +137,4 @@ jobs:
run: |
echo -e "${{ secrets.SSH_KEY }}" >__TEMP_INPUT_KEY_FILE
chmod 600 __TEMP_INPUT_KEY_FILE
scp -o StrictHostKeyChecking=no -v -i __TEMP_INPUT_KEY_FILE -P "22" -r deltachat-node-${{ steps.prepare.outputs.prid }}.tar.gz "${{ secrets.USERNAME }}"@"download.delta.chat":"/var/www/html/download/node/"
scp -o StrictHostKeyChecking=no -v -i __TEMP_INPUT_KEY_FILE -P "22" -r $DELTACHAT_NODE_TAR_GZ "${{ secrets.USERNAME }}"@"download.delta.chat":"/var/www/html/download/node/"

View File

@@ -24,8 +24,12 @@
- node: throw error when getting context with an invalid account id
- node: throw error when instanciating a wrapper class on `null` (Context, Message, Chat, ChatList and so on)
- use same contact-color if email address differ only in upper-/lowercase #3327
- fix race condition in ongoing process (import/export, configuration) allocation
- repair encrypted mails "mixed up" by Google Workspace "Append footer" function #3315
### Removed
- node: remove unmaintained coverage scripts
## 1.80.0

View File

@@ -3446,6 +3446,7 @@ int64_t dc_chat_get_remaining_mute_duration (const dc_chat_t* chat);
*/
#define DC_MSG_ID_MARKER1 1 // this is used by iOS to mark things in the message list
#define DC_MSG_ID_DAYMARKER 9
#define DC_MSG_ID_LAST_SPECIAL 9

View File

@@ -278,13 +278,11 @@ impl Context {
// Ongoing process allocation/free/check
pub(crate) async fn alloc_ongoing(&self) -> Result<Receiver<()>> {
if self.has_ongoing().await {
let mut s = self.running_state.write().await;
if s.ongoing_running || !s.shall_stop_ongoing {
bail!("There is already another ongoing process running.");
}
let s_a = &self.running_state;
let mut s = s_a.write().await;
s.ongoing_running = true;
s.shall_stop_ongoing = false;
let (sender, receiver) = channel::bounded(1);
@@ -294,25 +292,16 @@ impl Context {
}
pub(crate) async fn free_ongoing(&self) {
let s_a = &self.running_state;
let mut s = s_a.write().await;
let mut s = self.running_state.write().await;
s.ongoing_running = false;
s.shall_stop_ongoing = true;
s.cancel_sender.take();
}
pub(crate) async fn has_ongoing(&self) -> bool {
let s_a = &self.running_state;
let s = s_a.read().await;
s.ongoing_running || !s.shall_stop_ongoing
}
/// Signal an ongoing process to stop.
pub async fn stop_ongoing(&self) {
let s_a = &self.running_state;
let mut s = s_a.write().await;
let mut s = self.running_state.write().await;
if let Some(cancel) = s.cancel_sender.take() {
if let Err(err) = cancel.send(()).await {
warn!(self, "could not cancel ongoing: {:?}", err);
@@ -324,7 +313,7 @@ impl Context {
s.shall_stop_ongoing = true;
} else {
info!(self, "No ongoing process to stop.",);
};
}
}
pub(crate) async fn shall_stop_ongoing(&self) -> bool {

View File

@@ -741,7 +741,6 @@ mod tests {
);
let sent = bob.pop_sent_msg().await;
assert!(!bob.ctx.has_ongoing().await);
assert_eq!(sent.recipient(), "alice@example.org".parse().unwrap());
let msg = alice.parse_msg(&sent).await;
assert!(!msg.was_encrypted());
@@ -1291,7 +1290,6 @@ mod tests {
let bob_chat = Chat::load_from_db(&bob.ctx, bob_chatid).await?;
assert!(bob_chat.is_protected());
assert!(bob_chat.typ == Chattype::Group);
assert!(!bob.ctx.has_ongoing().await);
// On this "happy path", Alice and Bob get only a group-chat where all information are added to.
// The one-to-one chats are used internally for the hidden handshake messages,