[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Stratagus-CVS] stratagus/src include/master.h network/master.c
From: |
Russell Smith |
Subject: |
[Stratagus-CVS] stratagus/src include/master.h network/master.c |
Date: |
Tue, 14 Oct 2003 04:50:40 -0400 |
CVSROOT: /cvsroot/stratagus
Module name: stratagus
Branch:
Changes by: Russell Smith <address@hidden> 03/10/14 04:50:40
Modified files:
src/include : master.h
src/network : master.c
Log message:
Meta Server Updates, Removed crash, bad code. And It now connects.
Patches:
Index: stratagus/src/include/master.h
diff -u stratagus/src/include/master.h:1.10 stratagus/src/include/master.h:1.11
--- stratagus/src/include/master.h:1.10 Sat Oct 11 23:21:37 2003
+++ stratagus/src/include/master.h Tue Oct 14 04:50:39 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: master.h,v 1.10 2003/10/12 03:21:37 mr-russ Exp $
+// $Id: master.h,v 1.11 2003/10/14 08:50:39 mr-russ Exp $
#ifndef __MASTER_H__
#define __MASTER_H__
@@ -41,8 +41,8 @@
-- Defines
----------------------------------------------------------------------------*/
-#define MASTER_HOST "stratagus.dyndns.org"
-#define MASTER_PORT 8123
+#define MASTER_HOST "mohydine.no-ip.com"
+#define MASTER_PORT 7775
/*----------------------------------------------------------------------------
-- Declarations
Index: stratagus/src/network/master.c
diff -u stratagus/src/network/master.c:1.14 stratagus/src/network/master.c:1.15
--- stratagus/src/network/master.c:1.14 Mon Oct 13 20:15:52 2003
+++ stratagus/src/network/master.c Tue Oct 14 04:50:40 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: master.c,v 1.14 2003/10/14 00:15:52 jsalmon3 Exp $
+// $Id: master.c,v 1.15 2003/10/14 08:50:40 mr-russ Exp $
//@{
@@ -85,7 +85,7 @@
{
int TCPConnectStatus; // = 0 if not successful, -1 if not.
int i;
- char** reply;
+ char* reply;
reply = NULL;
sockfd = NetworkFildes;
@@ -109,15 +109,15 @@
return -1;
}
- if (RecvMetaReply(reply) == -1) {
+ if (RecvMetaReply(&reply) == -1) {
//TODO: Notify player that connection was aborted...
return -1;
} else {
- if (MetaServerOK(reply)) {
- free(*reply);
+ if (MetaServerOK(&reply)) {
+ free(reply);
return 0;
} else {
- free(*reply);
+ free(reply);
return -1;
}
}
@@ -230,7 +230,6 @@
global int RecvMetaReply(char** reply)
{
int n;
- int size;
char* p;
char buf[1024];
@@ -238,16 +237,15 @@
return -1;
}
- size = 1;
p = NULL;
- while ((n = NetRecvTCP(sockfd, &buf, 1024))) {
- size += n;
- if ((p = realloc(p, size)) == NULL) {
- return -1;
- }
- strcat(p, buf);
+
+ n = NetRecvTCP(sockfd, &buf, 1024);
+ if (!(p = malloc(n + 1))) {
+ return -1;
}
+ buf[n]='\0';
+ strcpy(p, buf);
- reply = &p;
- return size;
+ *reply = p;
+ return n;
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Stratagus-CVS] stratagus/src include/master.h network/master.c,
Russell Smith <=