Roflincopter / dmp

Distributed Music Player
Other
1 stars 1 forks source link

DmpCallbacks and DmpConnection are becoming too tightly coupled. #12

Open Roflincopter opened 10 years ago

Roflincopter commented 10 years ago

Today I ran into a bug that was indeterministically crashing my client. with a boost serialization exception "invalid signature". This most of time indicates some sort of corruption of the boost::asio::tcp::socket, first and foremost a "double" call to async_receive. But this time it happened because the DmpCallbacks was not past as a reference.

The connection should not have these weird limitations but I cannot think of a better way to do this. The DmpCallbacks class in conjunction with MessageSwitch has saved me considerable dev time because they force you to implement a lot of necessary boilerplate. Without these the program would crash or become quiescent.

So on the one hand I want to keep it just they way it is, but on the other hand, it introduces a hidden requirement on the Connection class.