|
Hi Patricio,
Good finding, thank you for taking care about this! The fix looks good in general. There are several spots with the wrong indent (must be 4, not 2): 64 #define ENTER_CONNECTION(connection) do { \ 65 InterlockedIncrement(&connection->refcount); \ 66 if (IS_STATE_CLOSED(connection->state)) { \ 67 setLastErrorMsg("stream closed"); \ 68 InterlockedDecrement(&connection->refcount); \ 69 return SYS_ERR; \ 70 } \ 71 } while (0) 72 73 #define LEAVE_CONNECTION(connection) do { \ 74 InterlockedDecrement(&connection->refcount); \ 75 } while (0)I'd also suggest to move content left and use indent 4 from the side. 414 if (*refcount == 0) { 415 sysEventClose(stream->hasData); 416 sysEventClose(stream->hasSpace); 417 sysIPMutexClose(stream->mutex); 418 break; 419 } ... 535 Stream * stream = &connection->outgoing; 536 if (stream->state == STATE_OPEN) { 537 (void)closeStream(stream, JNI_TRUE, &connection->refcount); 538 } 539 stream = &connection->incoming; 540 if (stream->state == STATE_OPEN) { 541 (void)closeStream(stream, JNI_FALSE, &connection->refcount); 542 } ... 551 if (connection->shutdown) { 552 sysEventClose(connection->shutdown); 553 } 554 } ... 1022 shmemBase_sendByte(SharedMemoryConnection *connection, jbyte data) 1023 { 1024 ENTER_CONNECTION(connection); 1025 jint rc = shmemBase_sendByte_internal(connection, data); 1026 LEAVE_CONNECTION(connection); 1027 return rc; 1028 } ... 1055 jint 1056 shmemBase_receiveByte(SharedMemoryConnection *connection, jbyte *data) 1057 { 1058 ENTER_CONNECTION(connection); 1059 jint rc = shmemBase_receiveByte_internal(connection, data); 1060 LEAVE_CONNECTION(connection); 1061 return rc; 1062 } ... 1136 jint 1137 shmemBase_sendPacket(SharedMemoryConnection *connection, const jdwpPacket *packet) 1138 { 1139 ENTER_CONNECTION(connection); 1140 jint rc = shmemBase_sendPacket_internal(connection, packet); 1141 LEAVE_CONNECTION(connection); 1142 return rc; 1143 }... 1229 jint 1230 shmemBase_receivePacket(SharedMemoryConnection *connection, jdwpPacket *packet) 1231 { 1232 ENTER_CONNECTION(connection); 1233 jint rc = shmemBase_receivePacket_internal(connection, packet); 1234 LEAVE_CONNECTION(connection); 1235 return rc; 1236 } Some other nits were already commented by David and Dan. I'd suggest to test with tier-5 as well for more safety. Thanks, Serguei On 3/17/20 13:14, Patricio Chilano wrote: Hi all, |
- RFR 8240902: JDI shared memory connector can us... Patricio Chilano
- Re: RFR 8240902: JDI shared memory connect... David Holmes
- Re: RFR 8240902: JDI shared memory con... Patricio Chilano
- Re: RFR 8240902: JDI shared memory connect... Daniel D. Daugherty
- Re: RFR 8240902: JDI shared memory con... Patricio Chilano
- Re: RFR 8240902: JDI shared memory connect... [email protected]
- Re: RFR 8240902: JDI shared memory con... Patricio Chilano
- Re: RFR 8240902: JDI shared memory connect... Daniel D. Daugherty
- Re: RFR 8240902: JDI shared memory con... Daniel D. Daugherty
