)]}'
{
  "commit": "8b0707e5cf7079cedde08e1fcf298538b865b0b9",
  "tree": "26cee77432ab2ea6dbffa7644624a368d8952435",
  "parents": [
    "4cb5c3b6b4377efccb74210e5780c0da9b42ea65"
  ],
  "author": {
    "name": "Nate Bosch",
    "email": "nbosch1@gmail.com",
    "time": "Tue Aug 11 16:23:49 2020 -0700"
  },
  "committer": {
    "name": "GitHub",
    "email": "noreply@github.com",
    "time": "Tue Aug 11 16:23:49 2020 -0700"
  },
  "message": "Avoid an open Peer with a closed Client (dart-lang/json_rpc_2#65)\n\nMay fix https://github.com/dart-lang/sdk/issues/43012\r\n\r\nIf a `Peer` is created with a `StreamChannel` that does not follow the\r\nstated contract it\u0027s possible that the `sink` gets closed without\r\nreceiving a done event from the `channel` which leaves the `Peer`\r\ninstance in a state that\u0027s inconsistent with the underlying `Client`.\r\nThe result is that it\u0027s possible to get a bad state trying to send a\r\nmessage even with `isClosed` returns `false`.\r\n\r\n- Make `isClosed` and `done` forward to the `_client` and `_peer` fields\r\n  so that they can\u0027t be inconsistent.\r\n- Forward errors to the `_server` so that it can forward them through\r\n  `done` without an extra `Completer` to manage.\r\n- Avoid closing the `sink` in the `Peer`. It will end up being closed by\r\n  the server when it is handling the error, and it\u0027s the same `sink`\r\n  instance in both places.\r\n- Add a test that ensures that `isClosed` behaves as expected following\r\n  a call to `close()` even when the `StreamChannel` does not follow it\u0027s\r\n  contract.",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "31e89365163e972fdbd751651ff86b823971d93a",
      "old_mode": 33188,
      "old_path": "pkgs/json_rpc_2/lib/src/peer.dart",
      "new_id": "4cf6aae5b53514e023ca7685968256bfaf691b39",
      "new_mode": 33188,
      "new_path": "pkgs/json_rpc_2/lib/src/peer.dart"
    },
    {
      "type": "modify",
      "old_id": "7284330f5a022158da382a5fcc8c7f6a284f0c6b",
      "old_mode": 33188,
      "old_path": "pkgs/json_rpc_2/test/peer_test.dart",
      "new_id": "e20976314adef644b94f88ba7a5587abe50c4034",
      "new_mode": 33188,
      "new_path": "pkgs/json_rpc_2/test/peer_test.dart"
    }
  ]
}
