I also forgot to add these other changes: 3. Patched server changes against server/protocol.def as per Juan Lang's advice.
4. With more testing, I found that the XSync call has no effect on the reliability of the docking. As Alexandre says they're a bad idea in this case, I just got rid of that patch.