summaryrefslogtreecommitdiff
path: root/src/connect.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/connect.c')
-rw-r--r--src/connect.c43
1 files changed, 33 insertions, 10 deletions
diff --git a/src/connect.c b/src/connect.c
index 2a77372..fcdf196 100644
--- a/src/connect.c
+++ b/src/connect.c
@@ -347,23 +347,46 @@ IceOpenConnection (
pSetupMsg->authCount = authUsableCount;
pSetupMsg->mustAuthenticate = mustAuthenticate;
- STORE_STRING (pData, IceVendorString);
- STORE_STRING (pData, IceReleaseString);
+ if (_X_LIKELY(pData != NULL)) {
+ STORE_STRING (pData, IceVendorString);
+ STORE_STRING (pData, IceReleaseString);
- for (i = 0; i < _IceAuthCount; i++)
- if (authUsableFlags[i])
+ for (i = 0; i < _IceAuthCount; i++)
{
- STORE_STRING (pData, _IceAuthNames[i]);
+ if (authUsableFlags[i])
+ {
+ STORE_STRING (pData, _IceAuthNames[i]);
+ }
}
- for (i = 0; i < _IceVersionCount; i++)
- {
- STORE_CARD16 (pData, _IceVersions[i].major_version);
- STORE_CARD16 (pData, _IceVersions[i].minor_version);
+ for (i = 0; i < _IceVersionCount; i++)
+ {
+ STORE_CARD16 (pData, _IceVersions[i].major_version);
+ STORE_CARD16 (pData, _IceVersions[i].minor_version);
+ }
}
+ else {
+ SEND_STRING (iceConn, IceVendorString);
+ SEND_STRING (iceConn, IceReleaseString);
- IceFlush (iceConn);
+ for (i = 0; i < _IceAuthCount; i++)
+ {
+ if (authUsableFlags[i])
+ {
+ SEND_STRING (iceConn, _IceAuthNames[i]);
+ }
+ }
+ for (i = 0; i < _IceVersionCount; i++)
+ {
+ CARD16 v;
+ v = _IceVersions[i].major_version;
+ IceWriteData16 (iceConn, 2, &v);
+ v = _IceVersions[i].minor_version;
+ IceWriteData16 (iceConn, 2, &v);
+ }
+ }
+ IceFlush (iceConn);
/*
* Process messages until we get a Connection Reply or an Error Message.