Rigner / discord-rpc-java

Java implementation of Discord RPC for rich presence https://github.com/discordapp/discord-rpc
MIT License
25 stars 9 forks source link

Add locks when writing to discord rpc #3

Closed Rigner closed 6 years ago

Rigner commented 6 years ago

https://github.com/PSNRigner/discord-rpc-java/blob/master/src/main/java/net/rigner/discordrpc/impl/BaseConnection.java#L36

Lock over this call to be sure 2 threads can't write at the same time.

Actually using a synchrorized method, but since this method is called twice for header and message, it can still cause race conditions. (saw a few while testing)