Permalink
Browse files

From Stephan Huber, "Attached you'll find a new ImageSequence.cpp whi…

…ch will fix an issue I had when moving the mouse cursor over the left window-border, as the index becomes negative. And I added a UdpSocket.cpp-file with more debuggin-output via some sprinkled printf-calls. "
  • Loading branch information...
1 parent c0c4295 commit efd55f81279fb34f2fe279e378618f1e2b566bd8 @osg-training-guest osg-training-guest committed Nov 22, 2012
Showing with 10 additions and 5 deletions.
  1. +2 −2 src/osg/ImageSequence.cpp
  2. +8 −3 src/osgPlugins/osc/ip/posix/UdpSocket.cpp
@@ -353,10 +353,10 @@ void ImageSequence::update(osg::NodeVisitor* nv)
if (useDirectTimeRequest)
{
- int i = int(time/_timePerImage);
+ int i = osg::maximum<int>(0, int(time/_timePerImage));
if ((i>=int(_imageDataList.size()) || !_imageDataList[i]._image))
{
- i = osg::clampTo<int>(i, 0, _imageDataList.size()-1);
+ i = osg::minimum<int>(i, _imageDataList.size()-1);
OSG_INFO<<"Requesting file, entry="<<i<<" : _fileNames[i]="<<_imageDataList[i]._filename<<std::endl;
irh->requestImageFile(_imageDataList[i]._filename, this, i, time, fs, _imageDataList[i]._imageRequest, _readOptions.get());
@@ -191,7 +191,12 @@ class UdpSocket::Implementation{
{
struct sockaddr_in bindSockAddr;
SockaddrFromIpEndpointName( bindSockAddr, localEndpoint );
-
+ {
+ IpEndpointName temp = IpEndpointNameFromSockaddr(bindSockAddr);
+ char address[30];
+ temp.AddressAndPortAsString(address);
+ printf("UdpSocket::Bind() %s \n", address);
+ }
if (bind(socket_, (struct sockaddr *)&bindSockAddr, sizeof(bindSockAddr)) < 0) {
throw std::runtime_error("unable to bind udp socket\n");
}
@@ -420,7 +425,7 @@ class SocketReceiveMultiplexer::Implementation{
timeout.tv_usec = (long)((timeoutMs - (timeout.tv_sec * 1000)) * 1000);
timeoutPtr = &timeout;
}
-
+ printf("UdpSocket::Run() waiting for select \n");
if( select( fdmax + 1, &tempfds, 0, 0, timeoutPtr ) < 0 && errno != EINTR ){
throw std::runtime_error("select failed\n");
}
@@ -438,7 +443,7 @@ class SocketReceiveMultiplexer::Implementation{
i != socketListeners_.end(); ++i ){
if( FD_ISSET( i->second->impl_->Socket(), &tempfds ) ){
-
+ printf("UdpSocket::Run() reading from socket \n");
int size = i->second->ReceiveFrom( remoteEndpoint, data, MAX_BUFFER_SIZE );
if( size > 0 ){
i->first->ProcessPacket( data, size, remoteEndpoint );

0 comments on commit efd55f8

Please sign in to comment.