[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Wesnoth-cvs-commits] wesnoth/src network.cpp
From: |
Jon Daniel |
Subject: |
[Wesnoth-cvs-commits] wesnoth/src network.cpp |
Date: |
Wed, 17 Aug 2005 17:48:00 -0400 |
CVSROOT: /cvsroot/wesnoth
Module name: wesnoth
Branch:
Changes by: Jon Daniel <address@hidden> 05/08/17 21:47:59
Modified files:
src : network.cpp
Log message:
Support more platforms with non-blocking IO
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/network.cpp.diff?tr1=1.75&tr2=1.76&r1=text&r2=text
Patches:
Index: wesnoth/src/network.cpp
diff -u wesnoth/src/network.cpp:1.75 wesnoth/src/network.cpp:1.76
--- wesnoth/src/network.cpp:1.75 Wed Aug 17 20:37:20 2005
+++ wesnoth/src/network.cpp Wed Aug 17 21:47:59 2005
@@ -1,4 +1,4 @@
-/* $Id: network.cpp,v 1.75 2005/08/17 20:37:20 j_daniel Exp $ */
+/* $Id: network.cpp,v 1.76 2005/08/17 21:47:59 j_daniel Exp $ */
/*
Copyright (C) 2003-5 by David White <address@hidden>
Part of the Battle for Wesnoth Project http://www.wesnoth.org/
@@ -306,15 +306,31 @@
}
// use non blocking IO
-#ifdef O_NONBLOCK
- fcntl(((_TCPsocket*)sock)->channel, F_SETFL, O_NONBLOCK);
-#else
#if defined(_WIN32) || defined(__WIN32__) || defined(WIN32)
{
unsigned long mode = 1;
ioctlsocket (((_TCPsocket*)sock)->channel, FIONBIO, &mode);
}
+#elif !defined(BEOS)
+ int flags;
+ flags = fcntl(((_TCPsocket*)sock)->channel, F_GETFL, 0);
+#if defined(O_NONBLOCK)
+ flags |= O_NONBLOCK;
+#elif defined(O_NDELAY)
+ flags |= O_NDELAY;
+#elif defined(FNDELAY)
+ flags |= FNDELAY;
#endif
+ if(fcntl(((_TCPsocket*)sock)->channel, F_SETFL, flags) == -1) {
+ error_ = ("Could not make socket non-blocking: " +
std::string(strerror(errno))).c_str();
+ return;
+ }
+#else
+ int on = 1;
+ if(setsockopt(((_TCPsocket*)sock)->channel, SOL_SOCKET, SO_NONBLOCK,
&on, sizeof(int)) < 0) {
+ error_ = ("Could not make socket non-blocking: " +
std::string(strerror(errno))).c_str();
+ return;
+ }
#endif
//if this is a server socket
- [Wesnoth-cvs-commits] wesnoth/src network.cpp, Jon Daniel, 2005/08/08
- [Wesnoth-cvs-commits] wesnoth/src network.cpp, Jon Daniel, 2005/08/08
- [Wesnoth-cvs-commits] wesnoth/src network.cpp, Jon Daniel, 2005/08/09
- [Wesnoth-cvs-commits] wesnoth/src network.cpp,
Jon Daniel <=
- [Wesnoth-cvs-commits] wesnoth/src network.cpp, Jon Daniel, 2005/08/17
- [Wesnoth-cvs-commits] wesnoth/src network.cpp, Jon Daniel, 2005/08/17
- [Wesnoth-cvs-commits] wesnoth/src network.cpp, Jon Daniel, 2005/08/20