What is miner supposed to do when waiting for longpoll i am coding simple miner.
I succesfully implemented Getwork in basic form. Next thing is gonna be Longpolling. 
If i understand correctly longpoll is just connection that is waiting for next block. So, what happens when I am waiting for longpoll and submit share ? I am supposed to mine further(increase nonce and continue) or simply wait for longpoll. Using only getwork and SSE2 optimized scrypt I was able to get 5kHash/s on my i5-4670K on single thread.
If you run out of work while waiting for longpoll to finish, then what you should do is submit another getwork request.

Note that just because you find a share in a particular piece of work, doesn't mean that you're done with that piece of work. There still might be shares or even a block solution in there somewhere.