diff options
Diffstat (limited to 'OpenSim/OpenSim.RegionServer/UDPServer.cs')
-rw-r--r-- | OpenSim/OpenSim.RegionServer/UDPServer.cs | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/OpenSim/OpenSim.RegionServer/UDPServer.cs b/OpenSim/OpenSim.RegionServer/UDPServer.cs index 6b3e7b1..f0d3367 100644 --- a/OpenSim/OpenSim.RegionServer/UDPServer.cs +++ b/OpenSim/OpenSim.RegionServer/UDPServer.cs | |||
@@ -135,7 +135,28 @@ namespace OpenSim.RegionServer | |||
135 | ipeSender = new IPEndPoint(IPAddress.Any, 0); | 135 | ipeSender = new IPEndPoint(IPAddress.Any, 0); |
136 | epSender = (EndPoint)ipeSender; | 136 | epSender = (EndPoint)ipeSender; |
137 | Packet packet = null; | 137 | Packet packet = null; |
138 | int numBytes = Server.EndReceiveFrom(result, ref epSender); | 138 | |
139 | int numBytes; | ||
140 | |||
141 | try | ||
142 | { | ||
143 | numBytes = Server.EndReceiveFrom(result, ref epSender); | ||
144 | } | ||
145 | catch (SocketException e) | ||
146 | { | ||
147 | switch( e.SocketErrorCode ) | ||
148 | { | ||
149 | case SocketError.NotConnected: | ||
150 | case SocketError.ConnectionReset: | ||
151 | // At this point, we should clear the client connection altogether. | ||
152 | // The app should hook a disconnect event into the UDPServer. | ||
153 | // But for now, just ignore it. | ||
154 | return; | ||
155 | default: | ||
156 | throw; | ||
157 | } | ||
158 | } | ||
159 | |||
139 | int packetEnd = numBytes - 1; | 160 | int packetEnd = numBytes - 1; |
140 | 161 | ||
141 | packet = Packet.BuildPacket(RecvBuffer, ref packetEnd, ZeroBuffer); | 162 | packet = Packet.BuildPacket(RecvBuffer, ref packetEnd, ZeroBuffer); |
@@ -181,7 +202,7 @@ namespace OpenSim.RegionServer | |||
181 | ServerIncoming = new IPEndPoint(IPAddress.Any, listenPort); | 202 | ServerIncoming = new IPEndPoint(IPAddress.Any, listenPort); |
182 | Server = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp); | 203 | Server = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp); |
183 | Server.Bind(ServerIncoming); | 204 | Server.Bind(ServerIncoming); |
184 | 205 | ||
185 | m_console.Notice("UDPServer.cs:ServerListener() - UDP socket bound, getting ready to listen"); | 206 | m_console.Notice("UDPServer.cs:ServerListener() - UDP socket bound, getting ready to listen"); |
186 | 207 | ||
187 | ipeSender = new IPEndPoint(IPAddress.Any, 0); | 208 | ipeSender = new IPEndPoint(IPAddress.Any, 0); |