diff options
author | (no author) <(no author)@4f64403b-2f21-0410-a795-97e2b3489a10> | 2008-07-14 10:40:27 +0000 |
---|---|---|
committer | (no author) <(no author)@4f64403b-2f21-0410-a795-97e2b3489a10> | 2008-07-14 10:40:27 +0000 |
commit | c37566e93cc0d7ac224a280c04ec7ca1dcfc1c66 (patch) | |
tree | dd006e4758a55a6b3bbc1fd8f8b81e05e74339c5 | |
parent | 93ae1d436de6c4816e84002bfdd6a515e00018cb (diff) |
reorganised connection process, fixed occasional crash
git-svn-id: https://server.scottellis.com.au/svn/mim_plugs@416 4f64403b-2f21-0410-a795-97e2b3489a10
-rw-r--r-- | MySpace/server_con.cpp | 29 | ||||
-rw-r--r-- | MySpace/version.h | 2 |
2 files changed, 8 insertions, 23 deletions
diff --git a/MySpace/server_con.cpp b/MySpace/server_con.cpp index 4c295c0..06735e9 100644 --- a/MySpace/server_con.cpp +++ b/MySpace/server_con.cpp @@ -246,7 +246,7 @@ int waitcallback(unsigned int *timeout) { return server_stop ? 0 : 1;
}
-int try_ports[9] = {1863, 6660,6661,6662,6665,6668,6669,80,0443};
+int try_ports[9] = {1863,6660,6661,6662,6665,6668,6669,80,443};
void try_login(NetMessage &msg, HANDLE connection) {
char nonce[NONCE_SIZE * 2 + 2], *nc1 = nonce, *nc2 = nonce + NONCE_SIZE;
@@ -379,20 +379,13 @@ void __cdecl ServerThreadFunc(void*) { if(connection) Netlib_CloseHandle(connection);
QueueUserAPC(sttMainThreadStatusCallback, mainThread, conn_stat++);
connection = (HANDLE)CallService(MS_NETLIB_OPENCONNECTION, (WPARAM)hNetlibUser, (LPARAM)&conn_data);
- if(!connection) {
- if(tries < 9) {
- conn_data.wPort = try_ports[tries++];
- } else {
- ProtoBroadcastAck(MODULE, 0, ACKTYPE_LOGIN, ACKRESULT_FAILED, (HANDLE)0, (LPARAM)LOGINERR_NOSERVER);
- break;
- }
- }
}
- bytes = Netlib_Recv(connection, (char *)pbuff, SERVER_READ_BUFFER_SIZE - (pbuff - recv_buffer), MSG_DUMPASTEXT);
- buffer_bytes += bytes;
- pbuff[bytes] = 0;
-
- if(bytes == 0) {
+ if(connection) {
+ bytes = Netlib_Recv(connection, (char *)pbuff, SERVER_READ_BUFFER_SIZE - (pbuff - recv_buffer), MSG_DUMPASTEXT);
+ buffer_bytes += bytes;
+ pbuff[bytes] = 0;
+ }
+ if(connection == 0 || bytes == 0 || bytes == SOCKET_ERROR) {
//PUShowMessage("Connection closed", SM_NOTIFY);
if(login && tries < 9) {
conn_data.wPort = try_ports[tries++];
@@ -400,14 +393,6 @@ void __cdecl ServerThreadFunc(void*) { if(login) ProtoBroadcastAck(MODULE, 0, ACKTYPE_LOGIN, ACKRESULT_FAILED, (HANDLE)0, (LPARAM)LOGINERR_NOSERVER);
break;
}
- } else if(bytes == SOCKET_ERROR) {
- //PUShowMessage("Socket ERROR", SM_NOTIFY);
- if(login && tries < 9) {
- conn_data.wPort = try_ports[tries++];
- } else {
- if(login) ProtoBroadcastAck(MODULE, 0, ACKTYPE_LOGIN, ACKRESULT_FAILED, (HANDLE)0, (LPARAM)LOGINERR_NOSERVER);
- break;
- }
} else {
if(login) {
QueueUserAPC(sttMainThreadStatusCallback, mainThread, conn_stat++);
diff --git a/MySpace/version.h b/MySpace/version.h index d6f3c11..bd44a1a 100644 --- a/MySpace/version.h +++ b/MySpace/version.h @@ -5,7 +5,7 @@ #define __MAJOR_VERSION 0
#define __MINOR_VERSION 0
#define __RELEASE_NUM 7
-#define __BUILD_NUM 0
+#define __BUILD_NUM 1
#define __FILEVERSION_STRING __MAJOR_VERSION,__MINOR_VERSION,__RELEASE_NUM,__BUILD_NUM
#define __FILEVERSION_STRING_DOTS __MAJOR_VERSION.__MINOR_VERSION.__RELEASE_NUM.__BUILD_NUM
|