ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/socket/lowlevel.C
(Generate patch)

Comparing deliantra/server/socket/lowlevel.C (file contents):
Revision 1.28 by root, Thu Dec 21 06:12:37 2006 UTC vs.
Revision 1.29 by root, Thu Dec 21 23:37:06 2006 UTC

51#define SOCKET_TIMEOUT2 20 * 1000 51#define SOCKET_TIMEOUT2 20 * 1000
52 52
53void 53void
54client::flush () 54client::flush ()
55{ 55{
56 if (destroyed ())
57 return;
58
56#ifdef __linux__ 59#ifdef __linux__
57 // check time of last ack, and, if too old, kill connection 60 // check time of last ack, and, if too old, kill connection
58 struct tcp_info tcpi; 61 struct tcp_info tcpi;
59 socklen_t len = sizeof (tcpi); 62 socklen_t len = sizeof (tcpi);
60 63
213 216
214bool 217bool
215client::may_execute (const packet_type *pkt) const 218client::may_execute (const packet_type *pkt) const
216{ 219{
217 return (!(pkt->flags & PF_PLAYER) || pl) 220 return (!(pkt->flags & PF_PLAYER) || pl)
218 && (!(pkt->flags & PF_PLAYING) || (pl && pl->state == ST_PLAYING)); 221 && (!(pkt->flags & PF_PLAYING) || state == ST_PLAYING);
219} 222}
220 223
221void 224void
222client::execute (const packet_type *pkt, char *data, int datalen) 225client::execute (const packet_type *pkt, char *data, int datalen)
223{ 226{
294// callback called when socket is either readable or writable 297// callback called when socket is either readable or writable
295void 298void
296client::socket_cb (iow &w, int got) 299client::socket_cb (iow &w, int got)
297{ 300{
298 //TODO remove when we have better socket cleanup logic 301 //TODO remove when we have better socket cleanup logic
299 if (destroyed) 302 if (destroyed ())
300 { 303 {
301 socket_ev.poll (0); 304 socket_ev.poll (0);
302 return; 305 return;
303 } 306 }
304 307
380{ 383{
381 char *buf = (char *)buf_; 384 char *buf = (char *)buf_;
382 char *pos = buf; 385 char *pos = buf;
383 int amt = 0; 386 int amt = 0;
384 387
385 if (destroyed || !buf) 388 if (destroyed () || !buf)
386 return; 389 return;
387 390
388 if ((len + outputbuffer.len) > SOCKETBUFSIZE) 391 if ((len + outputbuffer.len) > SOCKETBUFSIZE)
389 { 392 {
390 LOG (llevDebug, "socket on fd %d has overrun internal buffer - marking as dead\n", fd); 393 LOG (llevDebug, "socket on fd %d has overrun internal buffer - marking as dead\n", fd);
421 * shortcut function. 424 * shortcut function.
422 */ 425 */
423void 426void
424client::send_packet (packet &sl) 427client::send_packet (packet &sl)
425{ 428{
426 if (destroyed) 429 if (destroyed ())
427 return; 430 return;
428 431
429 if (sl.length () >= MAXSOCKBUF) 432 if (sl.length () >= MAXSOCKBUF)
430 { 433 {
431 LOG (llevError, "Trying to send a buffer beyond properly size, len =%d\n", sl.length ()); 434 LOG (llevError, "Trying to send a buffer beyond properly size, len =%d\n", sl.length ());

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines