projects
/
rocksndiamonds.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
fe81860
)
added some missing error handling and more detailed error messages
author
Holger Schemel
<info@artsoft.org>
Thu, 31 May 2018 11:26:51 +0000
(13:26 +0200)
committer
Holger Schemel
<info@artsoft.org>
Mon, 18 Jun 2018 17:47:31 +0000
(19:47 +0200)
src/netserv.c
patch
|
blob
|
history
diff --git
a/src/netserv.c
b/src/netserv.c
index 7c38ceed788b44a2f5921dc6a9c011c2a134cc73..547c2c9141a312b5f121c5539b9f2715fddf3f15 100644
(file)
--- a/
src/netserv.c
+++ b/
src/netserv.c
@@
-483,14
+483,20
@@
void NetworkServer(int port, int serveronly)
#endif
if (SDLNet_ResolveHost(&ip, NULL, port) == -1)
#endif
if (SDLNet_ResolveHost(&ip, NULL, port) == -1)
- Error(ERR_EXIT_NETWORK_SERVER, "SDLNet_ResolveHost() failed");
+ Error(ERR_EXIT_NETWORK_SERVER, "SDLNet_ResolveHost() failed: %s",
+ SDLNet_GetError());
- lfd = SDLNet_TCP_Open(&ip);
- if (!lfd)
-
Error(ERR_EXIT_NETWORK_SERVER, "SDLNet_TCP_Open() failed"
);
+ if ((fds = SDLNet_AllocSocketSet(MAX_PLAYERS + 1)) == NULL)
+ Error(ERR_EXIT_NETWORK_SERVER, "SDLNet_AllocSocketSet() failed: %s"),
+
SDLNet_GetError(
);
- fds = SDLNet_AllocSocketSet(MAX_PLAYERS+1);
- SDLNet_TCP_AddSocket(fds, lfd);
+ if ((lfd = SDLNet_TCP_Open(&ip)) == NULL)
+ Error(ERR_EXIT_NETWORK_SERVER, "SDLNet_TCP_Open() failed: %s"),
+ SDLNet_GetError();
+
+ if (SDLNet_TCP_AddSocket(fds, lfd) == -1)
+ Error(ERR_EXIT_NETWORK_SERVER, "SDLNet_TCP_AddSocket() failed: %s"),
+ SDLNet_GetError();
if (options.verbose)
{
if (options.verbose)
{