Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: SocketTCP::IsValid() not working?  (Read 2745 times)

0 Members and 1 Guest are viewing this topic.

KageJittai

  • Newbie
  • *
  • Posts: 10
    • View Profile
SocketTCP::IsValid() not working?
« on: April 12, 2011, 03:49:21 am »
I get this backtrace:

Code: [Select]
Program received signal SIGPIPE, Broken pipe.
0x00007ffff6d37812 in __libc_send (fd=<value optimized out>, buf=0x6388b0, n=6, flags=<value optimized out>)
    at ../sysdeps/unix/sysv/linux/x86_64/send.c:28
28      ../sysdeps/unix/sysv/linux/x86_64/send.c: No such file or directory.
        in ../sysdeps/unix/sysv/linux/x86_64/send.c
(gdb) bt
#0  0x00007ffff6d37812 in __libc_send (fd=<value optimized out>, buf=0x6388b0, n=6, flags=<value optimized out>)
    at ../sysdeps/unix/sysv/linux/x86_64/send.c:28
#1  0x00007ffff7784a9c in sf::SocketTCP::Send(char const*, unsigned long) () from /usr/lib/libsfml-network.so.1.6
#2  0x00007ffff7784ba6 in sf::SocketTCP::Send(sf::Packet&) () from /usr/lib/libsfml-network.so.1.6
#3  0x0000000000413da9 in Packet::send(sf::SocketTCP) ()
#4  0x0000000000410ded in Client::update() ()
#5  0x0000000000413183 in Server::update() ()
#6  0x0000000000412c22 in main ()


When I close my client.  When I try to send the next packet it crashes, even if I perform a SocketTCP::IsValid() check... it wasn't doing this earlier and I have no idea what I changed to make it not work...

Source code can be found here:  https://gitorious.org/plasma-game/plasmaserv/trees/master/src

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
SocketTCP::IsValid() not working?
« Reply #1 on: April 12, 2011, 07:46:45 am »
Quote
Source code can be found here: https://gitorious.org/plasma-game/plasmaserv/trees/master/src

Do you really expect us to browse your entire project to find what's wrong? ;)

A complete (compilable and executable) and minimal source code that reproduces the problem would be much more helpful.
Laurent Gomila - SFML developer

KageJittai

  • Newbie
  • *
  • Posts: 10
    • View Profile
SocketTCP::IsValid() not working?
« Reply #2 on: April 12, 2011, 07:58:55 am »
Actually, I found the issue, it was gdb, it wasn't a crash at all... gdb apparently stops on any signal sent by the OS.  Typing "continue" works, but I wish I knew how to turn this off.

KageJittai

  • Newbie
  • *
  • Posts: 10
    • View Profile
SocketTCP::IsValid() not working?
« Reply #3 on: April 12, 2011, 08:02:16 am »
Quote from: "Laurent"
Quote
Source code can be found here: https://gitorious.org/plasma-game/plasmaserv/trees/master/src

Do you really expect us to browse your entire project to find what's wrong? ;)

A complete (compilable and executable) and minimal source code that reproduces the problem would be much more helpful.


I would had produced a example if I could, but I couldn't reproduce it in the testing I was going, mainly cause it wasn't a bug... it was a feature  :roll:

Tank

  • SFML Team
  • Hero Member
  • *****
  • Posts: 1486
    • View Profile
    • Blog
    • Email
SocketTCP::IsValid() not working?
« Reply #4 on: April 16, 2011, 02:33:57 pm »
It's indeed a bug. A broken pipe signal occurs when you try, for example, to send data over a socket that isn't bound anymore -- like a broken pipe ;). The callstack exactly reveals that situation.

Do not call Send() on broken sockets.

 

anything